/* ============================================
   ShopSphere — Design System & App CSS
   Mobile-first, Android App-like feel
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --primary-bg: #EEF2FF;
  --secondary: #F59E0B;
  --secondary-dark: #D97706;
  --success: #10B981;
  --success-bg: #D1FAE5;
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --info: #3B82F6;
  --info-bg: #DBEAFE;

  --bg-base: #F8F9FF;
  --bg-card: #FFFFFF;
  --bg-dark: #1E1B4B;
  --text-primary: #1E1B4B;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-sm: 0 1px 3px rgba(79,70,229,0.08);
  --shadow-md: 0 4px 16px rgba(79,70,229,0.12);
  --shadow-lg: 0 8px 32px rgba(79,70,229,0.18);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --bottom-nav-h: 64px;
  --top-nav-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { border: none; outline: none; cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; border: none; }
ul, ol { list-style: none; }

/* ---- App Shell ---- */
.app-wrapper { min-height: 100vh; padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); }
.app-wrapper.no-bottom-nav { padding-bottom: 0; }

/* ---- Top Navigation Bar ---- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  height: var(--top-nav-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.top-nav .nav-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.top-nav .nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.top-nav .nav-logo img { width: 32px; height: 32px; border-radius: 8px; }
.top-nav .nav-logo span { font-size: 18px; font-weight: 800; color: var(--primary); }
.nav-icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-base);
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}
.nav-icon-btn:active { background: var(--primary-bg); color: var(--primary); transform: scale(0.92); }
.nav-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--bottom-nav-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}
.bottom-nav .nav-item .nav-icon { width: 24px; height: 24px; transition: transform 0.2s; }
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item.active .nav-icon { transform: translateY(-2px); }
.bottom-nav .nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.bottom-nav .nav-item:active { transform: scale(0.9); }

/* ---- Search Bar ---- */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 14px;
  height: 44px;
  gap: 10px;
  transition: all 0.2s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-padded { padding: 16px; }
.card-hover { transition: all 0.2s; }
.card-hover:active { transform: scale(0.98); box-shadow: var(--shadow-md); }

/* ---- Product Card ---- */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}
.product-card:active { transform: scale(0.97); }
.product-card .img-wrap {
  aspect-ratio: 1;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-card .img-wrap .badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}
.product-card .img-wrap .fav-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.product-card .card-body { padding: 10px 12px 12px; }
.product-card .product-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; margin-bottom: 4px; }
.product-card .store-name { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.product-card .price-row { display: flex; align-items: center; gap: 6px; }
.product-card .price { font-size: 15px; font-weight: 800; color: var(--primary); }
.product-card .mrp { font-size: 11px; color: var(--text-muted); text-decoration: line-through; }

/* ---- Store Card ---- */
.store-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  cursor: pointer;
}
.store-card:active { transform: scale(0.98); }
.store-card .store-logo {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--primary-bg);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.store-card .store-info { flex: 1; min-width: 0; }
.store-card .store-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.store-card .store-cat { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.store-card .store-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.store-card .open-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--success-bg);
  color: var(--success);
}
.store-card .closed-badge {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---- Category Chips ---- */
.cat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 72px;
}
.cat-chip:active { transform: scale(0.94); }
.cat-chip .cat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.cat-chip .cat-name { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-align: center; line-height: 1.2; }
.cat-chip.active .cat-name { color: var(--primary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,0.35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-base); color: var(--text-primary); border: 1.5px solid var(--border); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,0.35); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-whatsapp { background: #25D366; color: #fff; box-shadow: 0 4px 12px rgba(37,211,102,0.35); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 15px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-full); }

/* ---- Form Fields ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.2s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-textarea { height: auto; padding: 12px 14px; resize: vertical; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.section-link { font-size: 13px; font-weight: 600; color: var(--primary); }

/* ---- Hero Banner ---- */
.hero-banner {
  margin: 12px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366F1 50%, #818CF8 100%);
  border-radius: var(--radius-xl);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -20px; right: 20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.hero-banner h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.hero-banner p { font-size: 13px; opacity: 0.85; margin-bottom: 14px; }
.hero-banner .btn { position: relative; z-index: 1; }

/* ---- Scrollable Row ---- */
.scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-row::-webkit-scrollbar { display: none; }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 16px; }

/* ---- Divider ---- */
.divider { height: 1px; background: var(--border-light); margin: 8px 0; }
.section-divider { height: 8px; background: var(--bg-base); margin: 8px 0; }

/* ---- Tags / Badges ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-secondary { background: var(--bg-base); color: var(--text-secondary); border: 1px solid var(--border); }

/* ---- Rating ---- */
.rating { display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: #F59E0B; }
.rating span { color: var(--text-muted); font-weight: 400; }

/* ---- Modal / Sheet ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 16px 32px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }

/* ---- Toast Notification ---- */
.toast-container {
  position: fixed;
  top: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 448px;
}
.toast {
  background: #1F2937;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  box-shadow: var(--shadow-lg);
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ---- Skeleton Loader ---- */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #f0f0f0 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ---- Page Header (inner pages) ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 50;
}
.back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-base);
  color: var(--text-primary);
  flex-shrink: 0;
}
.back-btn:active { background: var(--primary-bg); color: var(--primary); }
.page-title { font-size: 16px; font-weight: 700; flex: 1; }

/* ---- Location Row ---- */
.location-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  cursor: pointer;
}
.location-row svg { color: var(--primary); }
.location-row .loc-name { font-weight: 600; color: var(--text-primary); }

/* ---- Stats Card ---- */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.stat-card .stat-change { font-size: 11px; font-weight: 600; margin-top: 2px; }
.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}

/* ---- Map Container ---- */
#map { width: 100%; height: 240px; border-radius: var(--radius-lg); z-index: 1; }
#map-full { width: 100%; height: 380px; border-radius: var(--radius-lg); z-index: 1; }

/* ---- Avatar ---- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

/* ---- Scrollable tabs/filters ---- */
.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-tab:active { transform: scale(0.95); }

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.empty-state svg { color: var(--border); }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-secondary); }
.empty-state p { font-size: 13px; color: var(--text-muted); }

/* ---- Floating Action Button ---- */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px + var(--safe-bottom));
  right: 20px;
  width: 52px; height: 52px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(79,70,229,0.45);
  z-index: 90;
  transition: all 0.2s;
}
.fab:active { transform: scale(0.92); }

/* ---- Subscription Banner ---- */
.sub-banner {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 16px;
  color: #fff;
}
.sub-banner .sub-icon { font-size: 28px; }
.sub-banner h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.sub-banner p { font-size: 12px; opacity: 0.9; }

/* ---- Invoice ---- */
.invoice-wrap { background: #fff; padding: 24px 16px; }
.invoice-header { border-bottom: 2px solid var(--primary); padding-bottom: 16px; margin-bottom: 16px; }
.invoice-items table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invoice-items th { background: var(--primary-bg); color: var(--primary); padding: 8px; text-align: left; font-weight: 600; }
.invoice-items td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.invoice-total { font-size: 16px; font-weight: 800; color: var(--primary); }

/* ---- Quantity Stepper ---- */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 36px;
}
.qty-stepper button {
  width: 36px; height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  transition: background 0.15s;
}
.qty-stepper button:active { background: var(--primary-bg); }
.qty-stepper input {
  width: 48px; height: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ---- Page Transitions ---- */
.page-enter { animation: pageEnter 0.25s ease; }
@keyframes pageEnter { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ---- PWA Install Banner ---- */
.install-banner {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.install-banner .close-btn { margin-left: auto; opacity: 0.8; cursor: pointer; }

/* ---- Responsive ---- */
@media (min-width: 480px) {
  body { box-shadow: 0 0 40px rgba(0,0,0,0.15); }
  .bottom-nav { width: 480px; }
}

/* ---- Dark mode support (optional) ---- */
@media (prefers-color-scheme: dark) {
  /* Future: dark mode variables */
}

/* ============================================
   Phase 2 — Additional Utility Classes
   ============================================ */

/* Nav icon button */
.nav-icon-btn {
  width: 36px; height: 36px;
  background: none;
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}
.nav-icon-btn:hover { background: var(--bg-base); }

/* Card hover */
.card-hover:hover { transform: translateY(-1px); box-shadow: var(--shadow-md) !important; }
.card-hover { transition: all 0.2s ease; }

/* Stat card */
.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

/* Card padded */
.card.card-padded { padding: 16px; }

/* Subscription banner */
.sub-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  color: #fff;
}
.sub-banner .sub-icon { font-size: 28px; flex-shrink: 0; }
.sub-banner h4 { font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.sub-banner p { font-size: 11px; opacity: 0.85; }

/* Button variants */
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:active { opacity: 0.85; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:active { opacity: 0.85; }

.btn-lg {
  height: 52px;
  font-size: 15px;
  font-weight: 800;
}

/* Toggle switch (reused in settings/products) */
.toggle {
  width: 44px; height: 24px;
  border-radius: 12px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--success); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: left 0.2s;
}
.toggle.on::after { left: 22px; }

/* Radio card for payment methods */
.pay-method-btn { transition: all 0.15s ease; }
.pay-method-btn:active { transform: scale(0.97); }

/* Chart canvas */
canvas { border-radius: var(--radius-md); }

/* Invoice print styles */
@media print {
  .no-print { display: none !important; }
  .bottom-nav { display: none !important; }
  .fab { display: none !important; }
  body { background: #fff !important; }
  .app-wrapper { padding: 0 !important; }
}

/* Shimmer loading placeholder */
.shimmer {
  background: linear-gradient(90deg, var(--bg-base) 25%, #e2e8f0 50%, var(--bg-base) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Leaflet map overrides */
.leaflet-control-attribution { display: none !important; }

/* ============================================
   Location & Distance Radius System
   ============================================ */

/* Mobile Location Row */
.location-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
.location-row:active {
  background: var(--primary-bg);
}
.loc-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.loc-info-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.loc-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-radius-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  border: 1px solid #C7D2FE;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.loc-radius-pill.active-radius {
  background: #4F46E5;
  color: #FFFFFF;
  border-color: #4F46E5;
}
.loc-arrow-down {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

/* Active Location Filter Banner on Home/Marketplace */
.active-loc-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 16px 16px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 1px solid #C7D2FE;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.06);
}
.loc-filter-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #3730A3;
  min-width: 0;
}
.loc-filter-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: locPulse 2s infinite;
  flex-shrink: 0;
}
@keyframes locPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}
.loc-filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.loc-action-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.loc-change-btn {
  background: #4F46E5;
  color: #FFFFFF;
}
.loc-change-btn:active {
  background: #3730A3;
}
.loc-reset-btn {
  background: rgba(255, 255, 255, 0.85);
  color: #4B5563;
  border: 1px solid #D1D5DB;
}
.loc-reset-btn:active {
  background: #E5E7EB;
}

/* Card Distance Pill Badges */
.distance-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
  margin-left: auto;
  white-space: nowrap;
}
.product-distance-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 999px;
  background: #F3F4F6;
  color: #4F46E5;
  border: 1px solid #E5E7EB;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Location Modal Styles */
.loc-modal-overlay {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.loc-modal-sheet {
  max-width: 500px;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  padding: 16px 20px 28px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.loc-drag-handle {
  width: 40px;
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  margin: 0 auto 12px;
}
.loc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #F1F5F9;
}
.loc-modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.loc-modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #EEF2FF;
  color: #4F46E5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.loc-modal-heading {
  font-size: 16.5px;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  line-height: 1.3;
}
.loc-modal-subheading {
  font-size: 12px;
  color: #64748B;
  margin: 0;
}
.loc-modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F8FAFC;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
}
.loc-modal-close-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}

/* Modal Body */
.loc-modal-body {
  overflow-y: auto;
  padding: 14px 2px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* GPS Button */
.loc-gps-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  border: 1.5px solid #C7D2FE;
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.05);
}
.loc-gps-action-card:hover {
  background: linear-gradient(135deg, #E0E7FF 0%, #EDE9FE 100%);
  border-color: #818CF8;
  transform: translateY(-1px);
}
.loc-gps-action-card:active {
  transform: scale(0.98);
}
.loc-gps-icon-ring {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #4F46E5;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.loc-gps-info {
  flex: 1;
  min-width: 0;
}
.loc-gps-title {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #1E1B4B;
  margin-bottom: 2px;
}
.loc-gps-desc {
  display: block;
  font-size: 11px;
  color: #4F46E5;
}
.loc-gps-chevron {
  color: #818CF8;
  flex-shrink: 0;
}
.loc-detecting .loc-gps-icon-ring svg {
  animation: spin 1s linear infinite;
}
.loc-spinner-inline {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid #C7D2FE;
  border-top-color: #4F46E5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

/* OR divider */
.loc-or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 2px 0;
}
.loc-or-divider::before,
.loc-or-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #E2E8F0;
}
.loc-or-divider span {
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94A3B8;
}

/* Search input */
.loc-search-container {
  display: flex;
  align-items: center;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 0 12px;
  height: 44px;
  gap: 10px;
  transition: all 0.2s;
}
.loc-search-container:focus-within {
  background: #FFFFFF;
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.loc-search-svg {
  color: #94A3B8;
  flex-shrink: 0;
}
#loc-search-input {
  flex: 1;
  font-size: 13px;
  color: #0F172A;
  background: transparent;
  border: none;
  outline: none;
}
#loc-search-input::placeholder {
  color: #94A3B8;
  font-size: 12.5px;
}
#loc-search-clear {
  color: #94A3B8;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}
.loc-search-dropdown {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.loc-search-group-title {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94A3B8;
  background: #F8FAFC;
  border-bottom: 1px solid #F1F5F9;
}
.loc-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #F8FAFC;
  cursor: pointer;
  transition: background 0.15s;
}
.loc-search-item:hover {
  background: #F1F5F9;
}
.loc-item-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.loc-item-text {
  flex: 1;
  min-width: 0;
}
.loc-item-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-item-sub {
  display: block;
  font-size: 10.5px;
  color: #64748B;
}
.loc-search-empty,
.loc-search-loading {
  padding: 14px;
  font-size: 12px;
  color: #64748B;
  text-align: center;
}

/* Towns grid */
.loc-section-title {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
}
.loc-towns-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 480px) {
  .loc-towns-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.loc-town-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-town-btn:hover {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: #4F46E5;
}
.loc-town-btn.active {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
}
.town-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  flex-shrink: 0;
}
.loc-town-btn.active .town-dot {
  background: #34D399;
}

/* Distance Radius Container */
.loc-radius-container {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px;
}
.loc-radius-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.loc-radius-hint {
  font-size: 11px;
  color: #64748B;
}
.loc-radius-pill-indicator {
  font-size: 12px;
  font-weight: 800;
  color: #4F46E5;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Custom Slider */
.loc-slider-container {
  margin-bottom: 12px;
}
#loc-radius-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}
#loc-radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4F46E5;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
#loc-radius-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.loc-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94A3B8;
  margin-top: 6px;
  font-weight: 600;
}

/* Radius Preset Buttons */
.loc-radius-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.loc-rad-btn {
  flex: 1;
  min-width: 48px;
  text-align: center;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.loc-rad-btn:hover {
  background: #EEF2FF;
  border-color: #818CF8;
  color: #4F46E5;
}
.loc-rad-btn.active {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* Selected Summary Card */
.loc-summary-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #F1F5F9;
  border-radius: 12px;
  border-left: 3px solid #4F46E5;
}
.loc-summary-pin {
  font-size: 18px;
}
.loc-summary-heading {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.3px;
}
.loc-summary-val {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
}

/* Modal Footer */
.loc-modal-footer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #F1F5F9;
}
.loc-btn-reset {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  background: #F1F5F9;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.15s;
}
.loc-btn-reset:hover {
  background: #E2E8F0;
}
.loc-btn-apply {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.2s;
}
.loc-btn-apply:hover {
  background: linear-gradient(135deg, #4338CA 0%, #3730A3 100%);
  transform: translateY(-1px);
}
.loc-btn-apply:active {
  transform: scale(0.98);
}

/* Empty State Radius Expand Buttons */
.expand-radius-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
