/* ============================================================
   PoolConnex — Main Application CSS v2.0
   Mobile-first, dark mode, glassmorphism, app-like.
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Colors */
  --navy-950:  #020617;
  --navy-900:  #0a1628;
  --navy-800:  #0f1f3d;
  --navy-700:  #162d55;
  --navy-600:  #1e3a6e;
  --navy-500:  #2a4d8a;

  --cyan-300:  #67e8f9;
  --cyan-400:  #22d3ee;
  --cyan-500:  #06b6d4;
  --cyan-600:  #0891b2;
  --cyan-700:  #0e7490;

  --teal-400:  #2dd4bf;
  --teal-500:  #14b8a6;
  --blue-400:  #60a5fa;
  --blue-500:  #3b82f6;
  --purple-400:#a78bfa;
  --emerald-400:#34d399;
  --emerald-500:#10b981;
  --amber-400: #fbbf24;
  --rose-400:  #fb7185;
  --rose-500:  #f43f5e;

  /* Text */
  --text-primary:   rgba(255,255,255,0.95);
  --text-secondary: rgba(255,255,255,0.70);
  --text-muted:     rgba(255,255,255,0.45);
  --text-disabled:  rgba(255,255,255,0.25);

  /* Glass */
  --glass-bg:       rgba(255,255,255,0.05);
  --glass-bg-hover: rgba(255,255,255,0.08);
  --glass-bg-active:rgba(255,255,255,0.12);
  --glass-border:   rgba(255,255,255,0.10);
  --glass-border-lg:rgba(255,255,255,0.15);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, var(--cyan-500), var(--cyan-700));
  --grad-teal:    linear-gradient(135deg, var(--teal-400), var(--cyan-600));
  --grad-blue:    linear-gradient(135deg, var(--blue-400), var(--blue-500));
  --grad-success: linear-gradient(135deg, var(--emerald-400), var(--teal-500));
  --grad-warning: linear-gradient(135deg, var(--amber-400), #f59e0b);
  --grad-danger:  linear-gradient(135deg, var(--rose-400), var(--rose-500));
  --grad-surface: linear-gradient(180deg, var(--navy-800), var(--navy-900));

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:0 0 30px rgba(6,182,212,0.2);

  /* Spacing */
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 20px;  --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Typography */
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Layout */
  --header-h:   60px;
  --bottom-nav-h: 70px;
  --sidebar-w:  260px;
  --max-content: 1200px;

  /* Motion */
  --ease-out:   cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in:    cubic-bezier(0.4, 0.0, 1, 1);
  --ease:       cubic-bezier(0.4, 0.0, 0.2, 1);
  --spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-1: 100ms;
  --duration-2: 200ms;
  --duration-3: 300ms;
  --duration-5: 500ms;

  /* Status colors */
  --status-pending:   var(--amber-400);
  --status-active:    var(--emerald-400);
  --status-success:   var(--emerald-500);
  --status-danger:    var(--rose-500);
  --status-warning:   var(--amber-400);
  --status-info:      var(--cyan-400);
  --status-neutral:   rgba(255,255,255,0.4);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--navy-950);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { text-decoration: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Ambient Background ───────────────────────────────────── */
.ambient-bg {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none; overflow: hidden;
}
.ambient-bg .orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px); opacity: 0.18;
}
.orb-1 { width: 600px; height: 600px; background: var(--cyan-600); top: -200px; right: -200px; animation: float-orb 20s ease-in-out infinite; }
.orb-2 { width: 400px; height: 400px; background: var(--blue-500); bottom: -100px; left: -100px; animation: float-orb 25s ease-in-out infinite reverse; }
.orb-3 { width: 300px; height: 300px; background: var(--teal-500); top: 40%; left: 30%; animation: float-orb 18s ease-in-out infinite 5s; }

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.98); }
}

/* ── App Shell Layout ─────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* Content area — accounts for top header + bottom nav on mobile */
.app-content {
  flex: 1;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 20px) + 20px);
  position: relative;
}
.app-content.no-bottom-nav { padding-bottom: 0; }

/* ── Top Header ───────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-4);
}

.header-logo {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 700; font-size: 17px;
  color: var(--text-primary);
}
.header-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--grad-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.header-pool-selector {
  flex: 1; max-width: 180px;
}
.pool-selector-btn {
  width: 100%;
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  transition: all var(--duration-2) var(--ease);
}
.pool-selector-btn:hover { background: var(--glass-bg-hover); }
.pool-selector-btn .chevron { margin-left: auto; opacity: 0.6; font-size: 10px; }

.header-actions { display: flex; gap: var(--space-2); margin-left: auto; }

.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 18px;
  transition: all var(--duration-2) var(--ease);
  position: relative;
}
.icon-btn:hover { background: var(--glass-bg-hover); color: var(--text-primary); }
.icon-btn .badge {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--rose-500);
  border-radius: var(--radius-full);
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--navy-950);
}

/* ── Bottom Navigation (mobile) ───────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--glass-border);
  z-index: 100;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 8px 4px;
  color: var(--text-muted);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.3px;
  transition: all var(--duration-2) var(--ease);
  position: relative;
}
.bottom-nav .nav-item.active { color: var(--cyan-400); }
.bottom-nav .nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--grad-primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.bottom-nav .nav-item svg, .bottom-nav .nav-item .nav-icon { font-size: 20px; }
.bottom-nav .nav-item:hover { color: var(--text-secondary); }

/* Desktop sidebar shows instead of bottom nav */
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .app-content { padding-bottom: 0; padding-left: var(--sidebar-w); }
}

/* ── Desktop Sidebar ──────────────────────────────────────── */
.sidebar {
  display: none;
  position: fixed; top: var(--header-h); bottom: var(--bottom-nav-h); left: 0;
  width: var(--sidebar-w);
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  z-index: 90;
  padding: var(--space-4) 0;
  transform: translateX(-100%);
  transition: transform var(--duration-3) var(--ease);
}
.sidebar.active {
  display: block;
  transform: translateX(0);
}
@media (min-width: 768px) { 
  .sidebar { 
    display: block; 
    bottom: 0;
    transform: translateX(0);
  }
}

/* ── Mobile Category Filters ──────────────────────────────── */
@media (max-width: 768px) {
  .shop-sidebar .card-header { display: none; }
  .shop-sidebar .card-body { padding: 12px; }
  .category-list {
    flex-direction: row !important;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .category-list::-webkit-scrollbar { display: none; } /* Webkit */
  .category-list a {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
  }
  .category-list a.text-cyan {
    background: rgba(6,182,212,0.1);
    border-color: rgba(6,182,212,0.3);
  }
}

/* ── Shop & Services Layouts ──────────────────────────────── */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.3); border-color: rgba(6, 182, 212, 0.3); }
.service-card:hover { transform: translateY(-2px); border-color: rgba(6, 182, 212, 0.3); }
.product-detail-grid { display: grid; grid-template-columns: 1fr 1fr; }
.service-detail-grid { display: grid; grid-template-columns: 1fr 1fr; }
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }

@media (max-width: 768px) {
  .shop-layout { grid-template-columns: minmax(0, 1fr); }
  .product-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .service-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .cart-layout { grid-template-columns: minmax(0, 1fr); }
  
  .shop-sidebar { min-width: 0; } /* Prevent flex/grid blowout */
  
  .service-card { flex-direction: column; text-align: center; }
  .service-card > div:nth-child(2) { min-width: 0; }
  .service-card > div:last-child { align-items: center !important; width: 100%; margin-top: 12px; }
  .service-card > div:last-child .btn { width: 100%; }
  
  .cart-item { flex-direction: column; text-align: center; }
  .cart-item > div:last-child { justify-content: center !important; width: 100%; margin-top: 16px; }
}

.sidebar-section { padding: 0 var(--space-4); margin-bottom: var(--space-4); }
.sidebar-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); padding: 0 var(--space-3); margin-bottom: var(--space-2); }

.sidebar-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  transition: all var(--duration-2) var(--ease);
  margin-bottom: 2px;
}
.sidebar-link svg, .sidebar-link .link-icon { width: 18px; height: 18px; opacity: 0.8; flex-shrink: 0; }
.sidebar-link:hover { background: var(--glass-bg-hover); color: var(--text-primary); }
.sidebar-link.active { background: rgba(6,182,212,0.1); color: var(--cyan-400); }
.sidebar-link.active svg, .sidebar-link.active .link-icon { opacity: 1; }
.sidebar-link .link-badge {
  margin-left: auto;
  background: var(--rose-500);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* ── Page Container ───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4);
}
@media (min-width: 640px) { .container { padding: var(--space-6) var(--space-6); } }
@media (min-width: 1024px) { .container { padding: var(--space-8) var(--space-8); } }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-6);
}
.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: var(--space-1); }

.header-banner {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
}
.header-banner .banner-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.header-banner .banner-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}
/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.card-body { padding: var(--space-5); }
.card-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--glass-border);
}
.card-header-title { font-size: 15px; font-weight: 600; }
.card-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--glass-border); }

.card.elevated { box-shadow: var(--shadow-md); }
.card.glow { box-shadow: var(--shadow-glow); }

/* ── Glass Card ───────────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all var(--duration-3) var(--ease);
}
.glass-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-lg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── KPI/Stat Cards ───────────────────────────────────────── */
.stat-cards, .dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
@media (min-width: 640px) { .stat-cards, .dashboard-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .stat-cards, .dashboard-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Generic Grids ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.grid-4 { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4);
  position: relative; overflow: hidden;
  transition: all var(--duration-3) var(--ease);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-primary);
  opacity: 0; transition: opacity var(--duration-3);
}
.stat-card:hover { background: var(--glass-bg-hover); transform: translateY(-2px); }
.stat-card:hover::before { opacity: 1; }

.stat-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: var(--space-3);
  background: rgba(6,182,212,0.15);
  color: var(--cyan-400);
}
.stat-card-icon svg {
  width: 20px; height: 20px;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card .stat-change { font-size: 11px; margin-top: var(--space-2); }
.stat-card .stat-change.up { color: var(--emerald-400); }
.stat-card .stat-change.down { color: var(--rose-400); }

/* ── Gradient variants for stat icons ────────────────────── */
.icon-cyan    { background: rgba(6,182,212,0.15); color: var(--cyan-400); }
.icon-emerald { background: rgba(16,185,129,0.15); color: var(--emerald-400); }
.icon-amber   { background: rgba(251,191,36,0.15); color: var(--amber-400); }
.icon-rose    { background: rgba(244,63,94,0.15);  color: var(--rose-400); }
.icon-blue    { background: rgba(59,130,246,0.15); color: var(--blue-400); }
.icon-purple  { background: rgba(167,139,250,0.15);color: var(--purple-400); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: 0 var(--space-5);
  height: 44px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; letter-spacing: 0.2px;
  border: none; cursor: pointer; white-space: nowrap;
  transition: all var(--duration-2) var(--ease);
  position: relative; overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background var(--duration-1);
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active::after { background: rgba(255,255,255,0.15); }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(6,182,212,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(6,182,212,0.5); transform: translateY(-1px); }

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-lg); }

.btn-success {
  background: var(--grad-success);
  color: white;
  box-shadow: 0 4px 15px rgba(16,185,129,0.35);
}
.btn-danger {
  background: var(--grad-danger);
  color: white;
  box-shadow: 0 4px 15px rgba(244,63,94,0.3);
}
.btn-warning {
  background: var(--grad-warning);
  color: var(--navy-950);
}

.btn-sm  { height: 34px; padding: 0 var(--space-4); font-size: 13px; }
.btn-lg  { height: 52px; padding: 0 var(--space-8); font-size: 15px; }
.btn-xl  { height: 58px; padding: 0 var(--space-10); font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.4; pointer-events: none; transform: none;
}

.btn-loading { pointer-events: none; }
.btn-loading::before {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: var(--space-2);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.form-label .required { color: var(--rose-400); margin-left: 2px; }

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  height: 46px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--duration-2) var(--ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--cyan-500);
  background: rgba(6,182,212,0.05);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:invalid:not(:placeholder-shown) { border-color: var(--rose-400); }

textarea.form-control { height: auto; padding-top: var(--space-3); padding-bottom: var(--space-3); resize: vertical; min-height: 100px; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff60' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }

.form-control-sm { height: 36px; font-size: 13px; padding: 0 var(--space-3); }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--rose-400); margin-top: 6px; display: flex; align-items: center; gap: 4px; }

/* GPS location detection field */
.location-field-wrap { position: relative; }
.location-detect-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--cyan-400);
  display: flex; align-items: center; gap: 4px;
  cursor: pointer; transition: all var(--duration-2);
}
.location-detect-btn:hover { background: rgba(6,182,212,0.15); }
.location-detect-btn.detecting { pointer-events: none; opacity: 0.6; }
.location-field-wrap .form-control { padding-right: 110px; }

/* ── Checkboxes & Radios ──────────────────────────────────── */
.form-check { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; padding: var(--space-1) 0; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { display: none; }
.form-check-box {
  width: 20px; height: 20px; flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  transition: all var(--duration-2) var(--ease);
  display: flex; align-items: center; justify-content: center;
}
.form-check input[type="checkbox"]:checked + .form-check-box {
  background: var(--cyan-500); border-color: var(--cyan-500);
}
.form-check input[type="checkbox"]:checked + .form-check-box::after {
  content: '✓'; color: white; font-size: 12px; font-weight: 700;
}
.form-check-label { font-size: 14px; color: var(--text-secondary); padding-top: 1px; }
.form-check:hover .form-check-box { border-color: var(--cyan-500); }

/* Checklist items (technician use) */
.checklist-item {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-2);
}
.checklist-item:hover { background: var(--glass-bg); }
.checklist-item.checked .form-check-box { background: var(--emerald-500); border-color: var(--emerald-500); }
.checklist-item.checked .checklist-text { text-decoration: line-through; color: var(--text-muted); }
.checklist-item .required-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rose-400); margin-top: 8px; flex-shrink: 0; }

/* ── Toggle Switch ────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: var(--space-3); }
.toggle { width: 48px; height: 26px; position: relative; cursor: pointer; }
.toggle input { display: none; }
.toggle-track {
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  transition: all var(--duration-3) var(--ease);
}
.toggle input:checked ~ .toggle-track { background: var(--cyan-500); border-color: var(--cyan-500); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white; border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: transform var(--duration-3) var(--spring);
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(22px); }
.toggle-label { font-size: 14px; font-weight: 500; }

/* ── Alerts / Flash Messages ──────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 14px;
  border: 1px solid;
  margin-bottom: var(--space-4);
  animation: slide-in-top var(--duration-3) var(--spring);
}
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: var(--emerald-400); }
.alert-error   { background: rgba(244,63,94,0.1);  border-color: rgba(244,63,94,0.3);  color: var(--rose-400); }
.alert-warning { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); color: var(--amber-400); }
.alert-info    { background: rgba(6,182,212,0.1);  border-color: rgba(6,182,212,0.3);  color: var(--cyan-400); }
.alert-dismiss { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 16px; }

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--emerald-400); }
.badge-pending { background: rgba(251,191,36,0.15); color: var(--amber-400); }
.badge-danger  { background: rgba(244,63,94,0.15);  color: var(--rose-400); }
.badge-info    { background: rgba(6,182,212,0.15);  color: var(--cyan-400); }
.badge-neutral { background: var(--glass-bg);       color: var(--text-muted); }
.badge-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-xl); border: 1px solid var(--glass-border); }
table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
thead tr { border-bottom: 1px solid var(--glass-border); }
thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background var(--duration-1); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--glass-bg); }
tbody td { padding: var(--space-3) var(--space-4); color: var(--text-secondary); vertical-align: middle; }
tbody td strong, tbody td .td-primary { color: var(--text-primary); font-weight: 500; }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-3) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}

.modal {
  width: 100%; max-width: 520px;
  background: var(--navy-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--duration-3) var(--spring);
}
.modal-overlay.open .modal { transform: translateY(0); }

@media (min-width: 640px) {
  .modal { border-radius: var(--radius-2xl); transform: scale(0.92) translateY(0); }
  .modal-overlay.open .modal { transform: scale(1); }
}

.modal-handle { width: 40px; height: 4px; background: var(--glass-border-lg); border-radius: 2px; margin: 12px auto 0; }
.modal-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-6) var(--space-4); }
.modal-title  { font-size: 18px; font-weight: 700; flex: 1; }
.modal-close  { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); color: var(--text-muted); cursor: pointer; font-size: 18px; }
.modal-body   { padding: 0 var(--space-6) var(--space-6); }
.modal-footer { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--glass-border); }

/* ── Loading Overlay ──────────────────────────────────────── */
.page-loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--navy-950);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-2) var(--ease);
}
.page-loader.active { opacity: 1; pointer-events: auto; }
.loader-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--cyan-400);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-text { font-size: 13px; color: var(--text-muted); }

/* ── AJAX Content Transition ──────────────────────────────── */
.content-fade { animation: content-appear var(--duration-3) var(--ease-out); }
@keyframes content-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Map Container ────────────────────────────────────────── */
.map-container {
  width: 100%; height: 300px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative;
}
.map-container.fullscreen { height: 100vh; border-radius: 0; border: none; }

/* Leaflet overrides for dark theme */
.leaflet-container { background: var(--navy-900) !important; }
.leaflet-control-zoom a { background: var(--navy-800) !important; color: var(--text-primary) !important; border-color: var(--glass-border) !important; }
.leaflet-popup-content-wrapper { background: var(--navy-800) !important; color: var(--text-primary) !important; border: 1px solid var(--glass-border) !important; border-radius: var(--radius-md) !important; }
.leaflet-popup-tip { background: var(--navy-800) !important; }

/* ── Pool Card ────────────────────────────────────────────── */
.pool-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--duration-3) var(--ease);
}
.pool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pool-card-cover { height: 140px; background: var(--grad-teal); position: relative; overflow: hidden; }
.pool-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.pool-card-cover .pool-type-badge { position: absolute; top: var(--space-3); left: var(--space-3); }
.pool-card-body { padding: var(--space-4); }
.pool-card-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.pool-card-addr { font-size: 12px; color: var(--text-muted); }
.pool-card-meta { display: flex; gap: var(--space-3); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--glass-border); }
.pool-card-meta-item { display: flex; flex-direction: column; gap: 2px; }
.pool-card-meta-item .meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.pool-card-meta-item .meta-value { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* ── Service Card ─────────────────────────────────────────── */
.service-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex; gap: var(--space-4);
  transition: all var(--duration-3) var(--ease);
  cursor: pointer;
}
.service-card:hover { background: var(--glass-bg-hover); transform: translateY(-2px); border-color: rgba(6,182,212,0.3); }
.service-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.service-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.service-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.service-meta { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.service-price { font-size: 16px; font-weight: 700; color: var(--cyan-400); }
.service-duration { font-size: 12px; color: var(--text-muted); }

/* ── Order/Delivery Timeline ──────────────────────────────── */
.timeline { padding-left: var(--space-5); }
.timeline-item { display: flex; gap: var(--space-4); position: relative; padding-bottom: var(--space-5); }
.timeline-item::before { content: ''; position: absolute; left: -var(--space-5); top: 0; bottom: 0; width: 2px; background: var(--glass-border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--glass-border); flex-shrink: 0; margin-top: 5px; position: relative; z-index: 1; }
.timeline-dot.active { background: var(--cyan-400); box-shadow: 0 0 0 4px rgba(6,182,212,0.2); }
.timeline-dot.done   { background: var(--emerald-400); }
.timeline-content .tl-label { font-size: 13px; font-weight: 600; }
.timeline-content .tl-time  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Water Chemistry Slider ───────────────────────────────── */
.chem-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.chem-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
.chem-input-wrap { display: flex; align-items: center; gap: var(--space-2); }
.chem-input { width: 80px; }
.chem-unit { font-size: 11px; color: var(--text-muted); }
.chem-status { font-size: 11px; margin-top: 4px; }
.chem-status.ok  { color: var(--emerald-400); }
.chem-status.low { color: var(--amber-400); }
.chem-status.high{ color: var(--rose-400); }

/* ── Signature Canvas ─────────────────────────────────────── */
.signature-wrap {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.02);
  position: relative; overflow: hidden;
}
.signature-canvas { width: 100%; height: 160px; display: block; touch-action: none; }
.signature-clear {
  position: absolute; top: var(--space-2); right: var(--space-2);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); padding: 4px 10px;
  font-size: 11px; color: var(--text-muted); cursor: pointer;
}

/* ── Photo Upload Area ────────────────────────────────────── */
.photo-upload-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-2) var(--ease);
}
.photo-upload-zone:hover, .photo-upload-zone.dragover {
  border-color: var(--cyan-500);
  background: rgba(6,182,212,0.05);
}
.photo-upload-zone .upload-icon { font-size: 36px; margin-bottom: var(--space-3); opacity: 0.5; }
.photo-upload-zone .upload-text { font-size: 14px; color: var(--text-secondary); }
.photo-upload-zone .upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.photo-previews {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2); margin-top: var(--space-3);
}
.photo-preview-item { position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 1; background: var(--glass-bg); }
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-item .remove-photo {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; border: none;
}

/* ── GPS Tracking Map Overlay ─────────────────────────────── */
.tracking-bar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex; align-items: center; gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.tracking-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--grad-primary); flex-shrink: 0; }
.tracking-info .driver-name { font-weight: 600; font-size: 15px; }
.tracking-info .eta { font-size: 13px; color: var(--cyan-400); margin-top: 2px; }
.tracking-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--cyan-400); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{ transform:scale(1); opacity:1; } 50%{ transform:scale(1.5); opacity:0.6; } }

/* ── Cart Badge ───────────────────────────────────────────── */
.cart-fab {
  position: fixed; bottom: calc(var(--bottom-nav-h) + 16px); right: 16px;
  width: 56px; height: 56px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(6,182,212,0.4);
  z-index: 80; border: none; cursor: pointer;
  transition: all var(--duration-2) var(--spring);
}
.cart-fab:hover { transform: scale(1.1); }
.cart-fab .cart-count { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; background: var(--rose-500); border-radius: 50%; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--navy-950); }

@media (min-width: 768px) { .cart-fab { bottom: 24px; right: 24px; } }

/* ── Auth Pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-4);
  position: relative; overflow: hidden;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: var(--space-8); }
.auth-logo .logo-mark { font-size: 36px; margin-bottom: var(--space-2); }
.auth-logo .logo-mark svg { width: 48px; height: 48px; color: var(--cyan-400); margin: 0 auto; }
.auth-logo .logo-name { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.auth-logo .logo-tag { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: var(--space-2); }
.auth-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: var(--space-6); }
.auth-footer { text-align: center; margin-top: var(--space-6); font-size: 14px; color: var(--text-muted); }
.auth-footer a { color: var(--cyan-400); font-weight: 600; }
.auth-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0; color: var(--text-muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--glass-border); }

/* ── Installer ────────────────────────────────────────────── */
.installer-wrap {
  min-height: 100vh;
  background: var(--navy-950);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.installer-card {
  width: 100%; max-width: 640px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.installer-header {
  background: var(--grad-primary);
  padding: var(--space-8);
  text-align: center;
}
.installer-header h1 { font-size: 24px; font-weight: 800; color: white; margin-bottom: 4px; }
.installer-header p  { font-size: 14px; color: rgba(255,255,255,0.8); }
.installer-steps { display: flex; gap: 0; border-bottom: 1px solid var(--glass-border); }
.installer-step {
  flex: 1; padding: var(--space-3) var(--space-2);
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: all var(--duration-2);
}
.installer-step.active { color: var(--cyan-400); border-bottom-color: var(--cyan-400); }
.installer-step.done   { color: var(--emerald-400); border-bottom-color: var(--emerald-400); }
.installer-body { padding: var(--space-8); }
.installer-footer { display: flex; justify-content: space-between; padding: var(--space-5) var(--space-8); border-top: 1px solid var(--glass-border); }

.req-check { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); margin-bottom: 2px; }
.req-check.pass { background: rgba(16,185,129,0.08); }
.req-check.fail { background: rgba(244,63,94,0.08); }
.req-check .req-icon { font-size: 16px; flex-shrink: 0; }
.req-check .req-label { font-size: 14px; font-weight: 500; flex: 1; }
.req-check .req-val   { font-size: 12px; color: var(--text-muted); }

/* ── Admin Dashboard ──────────────────────────────────────── */
.admin-shell { display: flex; min-height: 100vh; }
.admin-main  { flex: 1; min-width: 0; padding: var(--space-5); padding-top: calc(var(--header-h) + var(--space-5)); padding-bottom: calc(var(--bottom-nav-h) + var(--space-5)); }

@media (min-width: 768px) {
  .admin-main { padding: var(--space-6) var(--space-8); padding-top: calc(var(--header-h) + var(--space-6)); padding-left: calc(var(--sidebar-w) + var(--space-8)); padding-bottom: var(--space-6); }
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}
.section-title-lg { font-size: 20px; font-weight: 700; }
.section-actions  { display: flex; gap: var(--space-2); }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 2px; }
.activity-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--duration-1);
}
.activity-item:hover { background: var(--glass-bg); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.activity-text { font-size: 13px; flex: 1; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Permissions matrix */
.perm-matrix { overflow-x: auto; }
.perm-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.perm-row:last-child { border-bottom: none; }
.perm-section { flex: 1; font-size: 14px; font-weight: 500; }
.perm-section.locked { color: var(--text-muted); }
.perm-lock { font-size: 12px; color: var(--text-muted); margin-left: var(--space-2); }
.perm-levels { display: flex; gap: var(--space-2); }
.perm-radio label {
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  transition: all var(--duration-2); display: block;
}
.perm-radio input:checked + label { background: rgba(6,182,212,0.2); border-color: var(--cyan-500); color: var(--cyan-400); }
.perm-radio input { display: none; }

/* ── Driver Dashboard ─────────────────────────────────────── */
.go-online-banner {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex; align-items: center; gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.online-indicator { width: 12px; height: 12px; border-radius: 50%; background: var(--glass-border); transition: all var(--duration-3); flex-shrink: 0; }
.online-indicator.online { background: var(--emerald-400); animation: pulse 2s ease-in-out infinite; }
.go-online-text { flex: 1; }
.go-online-text strong { font-size: 15px; display: block; }
.go-online-text span   { font-size: 13px; color: var(--text-muted); }

.delivery-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-3);
  transition: all var(--duration-2) var(--ease);
}
.delivery-card:hover { border-color: rgba(6,182,212,0.3); }
.delivery-card-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
}
.delivery-card-body { padding: 0 var(--space-4) var(--space-4); display: none; }
.delivery-card.expanded .delivery-card-body { display: block; animation: content-appear var(--duration-2) var(--ease); }

/* Status action buttons (large, touch-friendly for drivers/techs) */
.status-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.status-btn {
  width: 100%; height: 56px;
  border-radius: var(--radius-lg);
  font-size: 15px; font-weight: 700;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  transition: all var(--duration-2) var(--spring);
}
.status-btn:active { transform: scale(0.97); }

/* ── Misc Utilities ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 639px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap-2  { display: flex; align-items: center; gap: var(--space-2); }
.flex-gap-3  { display: flex; align-items: center; gap: var(--space-3); }
.flex-gap-4  { display: flex; align-items: center; gap: var(--space-4); }

.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted{ color: var(--text-muted); }
.text-cyan { color: var(--cyan-400); }
.text-green{ color: var(--emerald-400); }
.text-red  { color: var(--rose-400); }
.text-amber{ color: var(--amber-400); }
.text-center{ text-align: center; }
.font-bold  { font-weight: 700; }
.font-semibold{ font-weight: 600; }

.mt-auto { margin-top: auto; }
.mb-4    { margin-bottom: var(--space-4); }
.mb-6    { margin-bottom: var(--space-6); }
.mt-4    { margin-top: var(--space-4); }
.mt-6    { margin-top: var(--space-6); }
.p-4     { padding: var(--space-4); }
.p-5     { padding: var(--space-5); }
.gap-2   { gap: var(--space-2); }
.gap-3   { gap: var(--space-3); }
.gap-4   { gap: var(--space-4); }

.divider { height: 1px; background: var(--glass-border); margin: var(--space-6) 0; }
.empty-state { text-align: center; padding: var(--space-12); }
.empty-state .empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: var(--space-4); }
.empty-state .empty-title { font-size: 18px; font-weight: 700; margin-bottom: var(--space-2); }
.empty-state .empty-text  { font-size: 14px; color: var(--text-muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide-in-top { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.animate-spin { animation: spin 1s linear infinite; }
.animate-fade  { animation: fade-in var(--duration-3) var(--ease); }
.animate-scale { animation: scale-in var(--duration-3) var(--spring); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border-lg); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Focus States (a11y) ──────────────────────────────────── */
:focus-visible { outline: 2px solid var(--cyan-400); outline-offset: 2px; border-radius: 4px; }

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .bottom-nav, .sidebar, .app-header, .ambient-bg { display: none !important; }
  .app-content { padding: 0 !important; }
  body { background: white; color: black; }
}

/* ── SVG Utility Classes ────────────────────────────────── */
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.w-24 { width: 6rem; }
.h-24 { height: 6rem; }
.text-cyan-400 { color: var(--cyan-400); }
.text-rose-500 { color: var(--rose-500); }
.text-emerald-500 { color: var(--emerald-500); }
.text-amber-500 { color: var(--amber-500); }
