/* =============================================
   CITIFY.CA — Main Stylesheet
   Dark theme default, light mode via toggle
   ============================================= */

/* --- CSS Variables --- */
:root {
  --bg-primary:    #1a1a2e;
  --bg-card:       #16213e;
  --bg-elevated:   #0f3460;
  --accent:        #e94560;
  --accent-hover:  #c73550;
  --gold:          #f5a623;
  --text-primary:  #eaeaea;
  --text-muted:    #a0a0b0;
  --border:        #2a2a4a;
  --success:       #2ecc71;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --radius:        12px;
  --radius-sm:     8px;
  --transition:    0.2s ease;
}

[data-theme="light"] {
  --bg-primary:    #f8f8f8;
  --bg-card:       #ffffff;
  --bg-elevated:   #f0f0f8;
  --text-primary:  #1a1a2e;
  --text-muted:    #666680;
  --border:        #e0e0e0;
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  padding-bottom: 70px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', Arial, sans-serif;
  font-weight: 700;
  color: var(--text-primary);
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* --- Navbar --- */
.citify-navbar {
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0;
  z-index: 1030;
}

.citify-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary) !important;
  letter-spacing: -1px;
  text-decoration: none;
}
.citify-logo:hover { color: var(--accent) !important; }

.citify-search-bar { width: 100%; max-width: 420px; }
.citify-search-bar .form-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.citify-search-bar .form-control:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.citify-search-bar .form-control::placeholder { color: var(--text-muted); }
.nav-link { color: var(--text-muted) !important; font-size: 0.9rem; font-weight: 500; }
.nav-link:hover { color: var(--text-primary) !important; }

/* --- Buttons --- */
.btn-accent {
  background: var(--accent);
  color: var(--on-accent) !important;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-outline-accent {
  border: 1.5px solid var(--accent);
  color: var(--accent) !important;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all var(--transition);
}
.btn-outline-accent:hover { background: var(--accent); color: var(--on-accent) !important; }

/* --- Product Cards --- */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.product-card-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--bg-elevated); }
.product-card-img-placeholder {
  width: 100%; aspect-ratio: 1/1; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 2.5rem;
}
.product-card-body { padding: 0.85rem; flex: 1; display: flex; flex-direction: column; }
.product-card-title {
  font-weight: 600; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 0.25rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-card-price { font-weight: 700; color: var(--accent); font-size: 1rem; margin-top: auto; padding-top: 0.5rem; }
.product-card-price-request { color: var(--text-muted); font-size: 0.85rem; font-style: italic; margin-top: auto; padding-top: 0.5rem; }

/* --- Product Grid — equal-height cards per row --- */
.product-grid { align-items: stretch; }
.product-grid > [class*="col"] { display: flex; }
.product-grid .product-card { width: 100%; }

/* --- Merchant Cards --- */
.merchant-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  height: 100%; display: flex; flex-direction: column;
}
.merchant-card > p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.merchant-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
/* Equal-height merchant cards — stretch anchor and card to fill column */
.row > [class*="col"] > a > .merchant-card,
.row > [class*="col"] > .merchant-card { height: 100%; }
.row > [class*="col"] > a { display: flex; flex-direction: column; height: 100%; }
/* Pin category badge to bottom of merchant card */
.merchant-card .badge:last-child { margin-top: auto; }

/* Merchant logo in cards — fixed size, no overflow, no shrink */
.merchant-logo {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-elevated);
  padding: 4px;
  flex-shrink: 0;
}
.merchant-logo-placeholder {
  width: 56px; height: 56px; min-width: 56px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 1.5rem;
}
/* Constrain name container so long names don't overflow */
.merchant-card .flex-grow-1.min-w-0 { min-width: 0; overflow: hidden; }
.merchant-card h2.h6, .merchant-card h3.h6 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
}

/* --- Verified Badge --- */
.badge-verified {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: rgba(46,204,113,0.15); color: var(--success);
  border: 1px solid rgba(46,204,113,0.3); border-radius: 20px;
  padding: 0.2rem 0.6rem; font-size: 0.75rem; font-weight: 600;
}

/* --- Video Badge -- same shape as verified, blue tone (matches
   product-count badge) so it reads as "extra info" not "trust/certification" --- */
.badge-video {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: rgba(13,110,253,0.12); color: var(--info-text);
  border: 1px solid rgba(13,110,253,0.3); border-radius: 20px;
  padding: 0.2rem 0.6rem; font-size: 0.75rem; font-weight: 600;
}

/* --- Category Grid --- */
.category-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1rem; text-align: center; transition: all var(--transition);
  text-decoration: none; display: block; color: var(--text-primary);
}
.category-card:hover { border-color: var(--accent); background: var(--bg-elevated); transform: translateY(-2px); color: var(--text-primary); }
.category-card .cat-icon { font-size: 2rem; margin-bottom: 0.5rem; display: block; color: var(--accent); }
.category-card .cat-name { font-weight: 600; font-size: 0.85rem; }

/* --- Hero --- */
.citify-hero {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-elevated) 100%);
  padding: 4rem 0 3rem; border-bottom: 1px solid var(--border);
}
.citify-hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.2; }
.citify-hero .hero-search .form-control {
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--text-primary); font-size: 1.1rem; padding: 0.85rem 1.2rem;
  border-radius: var(--radius) 0 0 var(--radius);
}
.citify-hero .hero-search .form-control:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
  background: var(--bg-card); color: var(--text-primary);
}
.citify-hero .hero-search .btn { border-radius: 0 var(--radius) var(--radius) 0; padding: 0.85rem 1.5rem; }

/* --- Section Headers --- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 2px solid var(--border);
}
.section-header h2 { font-size: 1.3rem; margin: 0; }

/* --- Map --- */
.citify-map { height: 280px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; z-index: 1; }

/* --- Merchant Profile Header --- */
.merchant-header { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 2rem 0; }

/* Profile header logo — fixed size, prevent giant images */
.merchant-header-logo {
  width: 88px;
  height: 88px;
  min-width: 88px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--bg-elevated);
  padding: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.merchant-header-logo-placeholder {
  width: 88px; height: 88px; min-width: 88px; border-radius: var(--radius);
  background: var(--bg-elevated); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 2.5rem; border: 2px solid var(--border);
}

/* Social icon links */
.social-links a:not(.btn) {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 1.1rem; transition: all var(--transition);
}
.social-links a:not(.btn):hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Share dropdown button — matches social icon style */
.social-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--transition);
  cursor: pointer;
  padding: 0;
}
.social-share-btn::after { display: none; } /* hide Bootstrap dropdown caret */
.social-share-btn:hover,
.social-share-btn:focus,
.social-share-btn.show { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Share dropdown menu */
.citify-share-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 0.35rem 0;
}
.citify-share-menu .dropdown-item {
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.citify-share-menu .dropdown-item:hover,
.citify-share-menu .dropdown-item:focus {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.citify-share-menu .dropdown-divider { border-color: var(--border); margin: 0.25rem 0; }

/* --- Forms --- */
.citify-form-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm); }
.form-control, .form-select {
  background: var(--bg-elevated) !important; border: 1px solid var(--border) !important;
  color: var(--text-primary) !important; border-radius: var(--radius-sm) !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent) !important;
  background: var(--bg-elevated) !important; color: var(--text-primary) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-label { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; }

/* --- Dashboard --- */
.dashboard-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.dashboard-stat .stat-number { font-family: 'Poppins', sans-serif; font-size: 2.5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.dashboard-stat .stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

/* --- Pagination --- */
.citify-pagination .page-link { background: var(--bg-card); border-color: var(--border); color: var(--text-muted); border-radius: var(--radius-sm) !important; margin: 0 2px; }
.citify-pagination .page-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.citify-pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* --- Footer --- */
.citify-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 3rem 0 2rem; }
.footer-link { color: var(--text-muted); font-size: 0.875rem; transition: color var(--transition); }
.footer-link:hover { color: var(--accent); }

/* --- Mobile Bottom Nav --- */
.citify-mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bar-bg); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); justify-content: space-around; z-index: 1040; padding: 0.5rem 0 0.75rem;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  color: var(--text-muted); text-decoration: none; font-size: 0.65rem; font-weight: 500;
  padding: 0.25rem 0.4rem; transition: color var(--transition); min-width: 52px;
}
.mobile-nav-item i { font-size: 1.3rem; }
.mobile-nav-item.active, .mobile-nav-item:hover { color: var(--accent); }

/* --- Alerts --- */
.alert { border-radius: var(--radius-sm); border: none; }
.alert-success { background: rgba(46,204,113,0.15); color: var(--success); }
.alert-danger  { background: color-mix(in srgb, var(--accent) 15%, transparent);  color: var(--accent); }

/* --- Utilities --- */
.text-accent { color: var(--accent) !important; }
.fw-800 { font-weight: 800 !important; }
.fw-600 { font-weight: 600 !important; }

/* Generic card utility */
.citify-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .citify-hero { padding: 2.5rem 0 2rem; }
  .citify-footer { padding-bottom: 5rem; }
}
@media (min-width: 992px) {
  body { padding-bottom: 0; }
  .citify-mobile-nav { display: none !important; }
}

/* Favourites */
.fav-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: color 0.15s, transform 0.15s;
}
.fav-btn:hover { color: #e74c3c; transform: scale(1.15); }
.fav-btn.fav-active { color: #e74c3c; }

/* Star rating */
.star-input {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.1s;
}
.star-input.hovered,
.star-input.selected { color: #f5a623; }

/* Pure CSS star picker */
.citify-star-picker {
  display: flex; flex-direction: row-reverse; justify-content: flex-end;
  gap: 2px; position: relative;
}
.citify-star-picker input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.citify-star-picker label {
  font-size: 1.8rem; cursor: pointer; color: var(--text-muted);
  transition: color 0.1s; line-height: 1; padding: 0 2px;
}
/* Hover: highlight hovered star and all to its left (higher values in row-reverse) */
.citify-star-picker label:hover,
.citify-star-picker label:hover ~ label { color: #f5a623; }
/* Selected: highlight checked star and all to its left */
.citify-star-picker input[type="radio"]:checked ~ label { color: #f5a623; }
/* Reset stars to the right of selected */
.citify-star-picker input[type="radio"]:checked + label ~ label { color: var(--text-muted); }

/* --- Wider container on large screens ---
   Bootstrap's default .container caps at 1140px (lg) / 1320px (xl/xxl),
   which looks increasingly narrow on larger/high-res monitors as screen
   width grows well past that cap. Raise the ceiling at the two largest
   breakpoints only -- mobile/tablet/small-desktop behavior is untouched. */
@media (min-width: 1200px) {
  .container {
    max-width: 1440px;
  }
}
@media (min-width: 1400px) {
  .container {
    max-width: 1680px;
  }
}


/* === THEMES (added 2026-10-01) === */
:root {
  --on-accent: #ffffff;
  --nav-bg: rgba(26, 26, 46, 0.97);
  --bar-bg: rgba(22, 33, 62, 0.97);
  --info-text: #6ea8fe;
}
[data-theme="light"] {
  --bg-primary: #f8f8f8; --bg-card: #ffffff; --bg-elevated: #f0f0f8;
  --accent: #c92a47; --accent-hover: #a8203a; --gold: #b8730a;
  --text-primary: #1a1a2e; --text-muted: #5f5f78; --border: #e0e0e0;
  --shadow: 0 4px 24px rgba(0,0,0,0.08); --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --on-accent: #ffffff; --nav-bg: rgba(255,255,255,0.97); --bar-bg: rgba(255,255,255,0.97);
  --info-text: #0a58ca;
}
[data-theme="contrast"] {
  --bg-primary: #000000; --bg-card: #0a0a0a; --bg-elevated: #1a1a1a;
  --accent: #ffd60a; --accent-hover: #ffe55c; --gold: #ffd60a;
  --text-primary: #ffffff; --text-muted: #d0d0d0; --border: #8a8a8a;
  --shadow: none; --shadow-sm: none;
  --on-accent: #000000; --nav-bg: #000000; --bar-bg: #000000;
  --info-text: #8ab4ff;
}
[data-theme="contrast"] a:focus-visible,
[data-theme="contrast"] button:focus-visible,
[data-theme="contrast"] .form-control:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
[data-theme="forest"] {
  --bg-primary: #10231c; --bg-card: #17332a; --bg-elevated: #1f4337;
  --accent: #f2b84b; --accent-hover: #d9a03a; --gold: #f2b84b;
  --text-primary: #eaf3ee; --text-muted: #a3bdb2; --border: #2a4a3e;
  --shadow: 0 4px 24px rgba(0,0,0,0.4); --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --on-accent: #1a1405; --nav-bg: rgba(16,35,28,0.97); --bar-bg: rgba(23,51,42,0.97);
  --info-text: #7fb7ff;
}
[data-theme="sand"] {
  --bg-primary: #f4ede1; --bg-card: #fffaf1; --bg-elevated: #ece2d1;
  --accent: #b4432b; --accent-hover: #93331f; --gold: #a86a0a;
  --text-primary: #2b2118; --text-muted: #6b5a47; --border: #ddd0bb;
  --shadow: 0 4px 24px rgba(60,40,10,0.10); --shadow-sm: 0 2px 8px rgba(60,40,10,0.08);
  --on-accent: #ffffff; --nav-bg: rgba(255,250,241,0.97); --bar-bg: rgba(255,250,241,0.97);
  --info-text: #0a58ca;
}

/* === THEME PICKER (added 2026-10-01) === */
.citify-navbar .navbar-toggler { color: var(--text-primary); }
.theme-menu { background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.theme-menu .dropdown-item { color: var(--text-primary); }
.theme-menu .dropdown-item:hover, .theme-menu .dropdown-item:focus { background: var(--bg-elevated); color: var(--text-primary); }
.theme-menu .bi-check2 { color: var(--accent); }

/* === FAVOURITE PRODUCTS === */
.fav-prod { background: rgba(0,0,0,0.55); border: none; color: #fff; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; line-height: 1; font-size: 1rem; transition: transform .15s, color .15s; }
.fav-prod:hover { transform: scale(1.12); color: #ff8fa0; }
.fav-prod:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fav-prod.fav-active { color: #e74c3c; }
.fav-prod.fav-abs { position: absolute; top: .6rem; right: .6rem; z-index: 2; }
.fav-prod.fav-inline { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); flex-shrink: 0; }
.fav-prod.fav-inline:hover { color: #e74c3c; }
.fav-prod.fav-inline.fav-active { color: #e74c3c; }
