/* PharmacyPulse Design System — Modern, rounded, community-first */
/* Primary: #008F82 (teal) | Serif: DM Serif Display | Sans: Plus Jakarta Sans */

:root {
  --bg: #FAFBFC;
  --surface: #ffffff;
  --border: #E5E7EB;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --primary: #008F82;
  --primary-light: #E6F7F5;
  --primary-dark: #006B62;
  --primary-foreground: #ffffff;
  --secondary: #7c3aed;
  --secondary-light: #f3f0ff;
  --warning: #F59E0B;
  --destructive: #ef4444;
  --success: #10B981;
  --radius: 1rem;
  --radius-pill: 9999px;
  --radius-input: 0.75rem;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.08);
  --gold: #F5D060;
  --gold-dark: #ECC94B;
  --purple-dark: #3D1952;
}

/* Base font-size bumped from 16px → 17px per 2026-04-16 sync: users shouldn't need A+ to read comfortably. All rem-based sizes across the site scale automatically. */
html { font-size: 17px; }
body { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
input, select, textarea { background: white !important; color: var(--text) !important; }
/* Checkbox/radio styling handled by framework (layout.go end-of-body injection) */
/* Display headings — same humanist sans as body, heavier weight + tight tracking for a sharp, modern feel. */
.font-serif { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif; font-weight: 800; letter-spacing: -0.02em; }
/* Defense-in-depth: override any inline DM Serif Display styles across the site. */
[style*="DM Serif Display"] { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important; font-weight: 800 !important; letter-spacing: -0.02em !important; font-style: normal !important; }

/* ===== DOT GRID BACKGROUND ===== */
.dot-grid {
  background-image: linear-gradient(#e5e7eb33 1px, transparent 1px), linear-gradient(90deg, #e5e7eb33 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ===== LAYOUT ===== */
.page-container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 6rem;
  min-height: 100vh;
}

/* ===== TOP NAV ===== */
.topbar {
  display: none;
}
/* topbar styles are inline in the partial */

/* ===== BOTTOM NAV (mobile) ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #ffffff;
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: 0.625rem 0 calc(0.625rem + env(safe-area-inset-bottom, 0px));
}
.bottom-nav > div {
  display: grid; grid-template-columns: repeat(5, 1fr); max-width: 100%; padding: 0 0.5rem;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0.25rem 0; font-size: 0.5625rem; font-weight: 600;
  color: var(--text-muted); text-decoration: none; transition: color 0.15s;
  letter-spacing: 0.02em;
}
.bottom-nav a:hover, .bottom-nav a.active { color: var(--primary); }
.bottom-nav a svg { width: 22px; height: 22px; stroke: currentColor; }

/* Bottom nav hidden by default — only shows in PWA standalone mode */
.bottom-nav { display: none !important; }

/* ===== ADMIN SIDEBAR ===== */
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px;
  background: #0f172a;
  color: white; padding: 0; z-index: 40; overflow-y: auto;
  font-size: 0.9375rem;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.admin-sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.admin-sidebar nav {
  padding: 0.75rem 0.75rem;
  flex: 1;
}
.admin-sidebar a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 1rem; color: #94a3b8; text-decoration: none;
  font-size: 0.875rem; font-weight: 500; transition: all 0.15s;
  border-radius: 0.625rem; margin-bottom: 0.125rem;
}
.admin-sidebar a .pp-emoji { font-size: 1.0625rem; line-height: 1; flex-shrink: 0; }
.admin-sidebar a:hover { color: #e2e8f0; background: rgba(255,255,255,0.07); }
.admin-sidebar a.active { color: #ffffff; background: rgba(0,143,130,0.25); border-left: 2.5px solid #008F82; padding-left: calc(1rem - 2.5px); }
.admin-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

/* Admin content area */
.admin-content { margin-left: 240px; flex: 1; min-width: 0; min-height: 100vh; background: #e8edf4; }

/* Page header bar */
.admin-pg-header {
  background: #ffffff;
  border-bottom: 1px solid #dde3ec;
  padding: 1.25rem 2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 4px rgba(15,23,42,0.07);
}
.admin-pg-header-left h1 {
  font-size: 1.375rem; font-weight: 800; color: #0f172a; margin: 0 0 0.125rem;
  letter-spacing: -0.025em;
}
.admin-pg-header-left p { font-size: 0.8125rem; color: #64748b; margin: 0; }
.admin-pg-body { padding: 1.75rem 2rem; }

/* Cards in admin — lift off gray bg */
.admin-content .glass-card {
  box-shadow: 0 1px 3px rgba(15,23,42,0.08), 0 8px 24px rgba(15,23,42,0.06);
  border-color: #dde3ec;
}
.admin-content .stat-card {
  box-shadow: 0 1px 3px rgba(15,23,42,0.08), 0 8px 24px rgba(15,23,42,0.06);
  border-color: #dde3ec;
  border-radius: 0.875rem;
}

/* Stat metric components */
.stat-num { font-size: 2.25rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: #0f172a; }
.stat-lbl { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; }

/* Metric icon box (right-aligned in stat cards) */
.metric-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.625rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.metric-icon-teal   { background: #ddf3f1; color: #007a6f; }
.metric-icon-purple { background: #ede9fe; color: #6d28d9; }
.metric-icon-amber  { background: #fef3c7; color: #b45309; }
.metric-icon-slate  { background: #e2e8f0; color: #475569; }
.metric-icon-green  { background: #dcfce7; color: #15803d; }
.metric-icon-red    { background: #fee2e2; color: #b91c1c; }

/* Admin table styling */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table thead tr { background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
.admin-table thead th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #64748b;
}
.admin-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background 0.1s; }
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table tbody td { padding: 0.875rem 1rem; color: #1e293b; vertical-align: middle; }

/* ===== ADMIN STAT CARD VARIANTS ===== */
.stat-card-teal   { border-top: 3px solid #008F82; }
.stat-card-purple { border-top: 3px solid #7c3aed; }
.stat-card-amber  { border-top: 3px solid #f59e0b; }
.stat-card-red    { border-top: 3px solid #ef4444; }
.stat-card-blue   { border-top: 3px solid #3b82f6; }
.stat-card-slate  { border-top: 3px solid #64748b; }
.stat-card-green  { border-top: 3px solid #10b981; }

.stat-icon { width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; margin-bottom: 0.5rem; }
.stat-icon-teal   { background: #e6f7f5; }
.stat-icon-purple { background: #f3f0ff; }
.stat-icon-amber  { background: #fffbeb; }
.stat-icon-red    { background: #fef2f2; }
.stat-icon-blue   { background: #eff6ff; }
.stat-icon-slate  { background: #f1f5f9; }
.stat-icon-green  { background: #f0fdf4; }

/* Admin info/note banner */
.admin-info-banner { background: #f8fafc; border: 1px solid #e2e8f0; border-left: 3px solid #008F82; border-radius: 0.75rem; padding: 1rem 1.25rem; }
.admin-code { font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 0.75rem; background: #1e293b; color: #7dd3fc; padding: 0.75rem 1rem; border-radius: 0.5rem; white-space: pre; overflow-x: auto; display: block; margin-top: 0.5rem; }

/* Section heading inside glass cards */
.admin-card-heading { font-size: 0.8125rem; font-weight: 700; color: #0f172a; margin: 0 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid #f1f5f9; letter-spacing: -0.01em; }

/* Missing badges */
.badge-flagged   { background: #fffbeb; color: #d97706; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-suspended { background: #fef2f2; color: #dc2626; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-active    { background: #f0fdf4; color: #16a34a; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--primary); color: white; font-weight: 600;
  padding: 0.625rem 1.5rem; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none; border: none; cursor: pointer; font-size: 0.875rem;
  transition: all 0.2s; box-shadow: 0 1px 3px rgba(0,143,130,0.2);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(0,143,130,0.25); }

.btn-outline {
  background: white; color: var(--text); font-weight: 600;
  padding: 0.625rem 1.5rem; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); display: inline-flex; align-items: center;
  gap: 0.5rem; text-decoration: none; cursor: pointer; font-size: 0.875rem;
  transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-card); }

.btn-ghost {
  background: transparent; color: var(--text-secondary); font-weight: 500;
  padding: 0.5rem 1rem; border-radius: var(--radius-pill); border: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none; cursor: pointer; font-size: 0.875rem; transition: all 0.15s;
}
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

.btn-secondary {
  background: var(--secondary); color: white; font-weight: 600;
  padding: 0.625rem 1.5rem; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none; border: none; cursor: pointer; font-size: 0.875rem;
  transition: all 0.2s;
}
.btn-secondary:hover { opacity: 0.9; }

.btn-destructive {
  background: var(--destructive); color: white; font-weight: 600;
  padding: 0.625rem 1.5rem; border-radius: var(--radius-pill); border: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none; cursor: pointer; font-size: 0.875rem; transition: all 0.2s;
}
.btn-destructive:hover { opacity: 0.9; }

/* ===== CARDS ===== */
.card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; transition: all 0.2s; box-shadow: var(--shadow-card);
}
.card:hover { box-shadow: var(--shadow-hover); }

.pharmacy-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; transition: all 0.2s; box-shadow: var(--shadow-card);
}
.pharmacy-card:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); }

.stat-card {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-card);
}

.glass-panel {
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.glass-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }

/* ===== FORM ELEMENTS ===== */
.input-field {
  width: 100%; padding: 0.625rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-input);
  font-size: 0.875rem; background: white; color: var(--text);
  transition: all 0.15s;
}
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,143,130,0.1); }
.input-field::placeholder { color: var(--text-muted); }

/* ===== BADGES ===== */
.badge-current { background: #fef2f2; color: #dc2626; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-resolved { background: #f0fdf4; color: #16a34a; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-discontinued { background: #f1f5f9; color: #64748b; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-pending { background: #fffbeb; color: #d97706; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-approved { background: #f0fdf4; color: #16a34a; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-rejected { background: #fef2f2; color: #dc2626; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }

/* ===== TABS ===== */
.tab-group {
  display: flex; gap: 0.25rem; background: #f1f5f9;
  padding: 0.25rem; border-radius: var(--radius);
}
.tab-btn {
  padding: 0.5rem 1rem; border-radius: 0.75rem; font-size: 0.8125rem; font-weight: 500;
  color: var(--text-secondary); background: transparent; border: none; cursor: pointer;
  transition: all 0.15s; text-decoration: none;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: white; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-radius: 0.75rem; }

/* ===== FILTER CHIPS ===== */
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.375rem 0.875rem; border-radius: 9999px; font-size: 0.8125rem; font-weight: 500;
  border: 1.5px solid var(--border); background: white; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== STARS ===== */
.star-filled { color: #F59E0B; }
.star-empty { color: #e5e7eb; }

/* ===== CONFIDENCE BAR ===== */
.confidence-bar { height: 6px; border-radius: 3px; background: #f1f5f9; overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.confidence-high { background: var(--success); }
.confidence-medium { background: var(--warning); }
.confidence-low { background: var(--destructive); }

/* ===== RATING OPTIONS ===== */
.rating-option {
  width: 48px; height: 48px; border-radius: var(--radius);
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.125rem; cursor: pointer; transition: all 0.15s;
  color: var(--text-secondary);
}
.rating-option:hover { border-color: var(--primary); color: var(--primary); }
.rating-option.selected, .peer:checked ~ .rating-option {
  background: var(--primary); border-color: var(--primary); color: white;
}

/* ===== SERVICE BADGES ===== */
.service-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.7rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.service-walk_in { background: var(--primary-light); color: var(--primary-dark); }
.service-delivery { background: var(--secondary-light); color: var(--secondary); }
.service-online { background: #e0f2fe; color: #0369a1; }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.animate-fade-up { animation: fadeUp 0.4s ease-out forwards; }
.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }
.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }

/* ===== LANDING PAGE ===== */
.hero-grid {
  background-image: linear-gradient(#e5e7eb33 1px, transparent 1px), linear-gradient(90deg, #e5e7eb33 1px, transparent 1px);
  background-size: 48px 48px;
}
.hero-orb-teal { position: absolute; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(0,143,130,0.08), transparent 70%); pointer-events: none; }
.hero-orb-purple { position: absolute; width: 400px; height: 400px; border-radius: 50%; background: radial-gradient(circle, rgba(124,58,237,0.05), transparent 70%); pointer-events: none; }
.hero-underline {
  text-decoration: none;
  background-image: linear-gradient(var(--primary), var(--primary));
  background-position: 0 85%;
  background-repeat: no-repeat;
  background-size: 100% 6px;
}

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #f8fafc 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 0.5rem;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ===== MAP ===== */
#pharmacy-map { height: 400px; border-radius: var(--radius); z-index: 1; border: 1px solid var(--border); }

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 639px) {
  /* GoodRx-style mobile readability */
  body { font-size: 15px; line-height: 1.65; }
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  /* Admin sidebar: full-width overlay on mobile */
  .admin-sidebar { width: 100%; }
  .admin-content { margin-left: 0; }

  /* Footer: auto columns on mobile */
  .pp-footer .grid { grid-template-columns: 1fr !important; }

  /* Metric strips: 2x2 grid */
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Inputs: prevent iOS zoom */
  input, select, textarea { font-size: 16px !important; }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 640px) {
  .page-container { max-width: 42rem; padding: 2rem 1.5rem 2rem; }
}
@media (min-width: 768px) {
  .page-container { max-width: 48rem; }
}
/* Base: responsive auto-fit so the grid uses every available column at any
   viewport width (the prod media-query rules below override this at common
   breakpoints, but this base catches narrow & in-between widths). */
.pharmacy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.75rem; }
@media (min-width: 1024px) {
  .topbar { display: block; }
  .page-container { max-width: 72rem; padding: 2.5rem 2rem 3rem; }
  .pharmacy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}
@media (min-width: 1280px) {
  .page-container { max-width: 72rem; padding-left: 1.5rem; padding-right: 1.5rem; }
  .pharmacy-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== PWA STANDALONE / NATIVE APP MODE ===== */
/* When installed as PWA or running in Capacitor WebView */
@media (display-mode: standalone) {
  header[style*="sticky"] { display: none !important; }
  .bottom-nav { display: flex !important; }
  .page-container { padding-top: 1rem; }
  body { padding-top: env(safe-area-inset-top, 0px); }
}
/* Capacitor native app — JS adds .native-app to body */
body.native-app header[style*="sticky"] { display: none !important; }
body.native-app .bottom-nav { display: grid !important; }
body.native-app .page-container { padding-top: 1rem; padding-bottom: 5rem; }
body.native-app { padding-top: env(safe-area-inset-top, 0px); padding-bottom: 4.5rem; }
body.native-app .pp-footer { display: none !important; }

/* ===== FOOTER ===== */
.pp-footer { padding: 1.5rem; background: #F9FAFB; color: var(--text-secondary); border-top: 1px solid var(--border); }
.pp-footer a { color: var(--text-secondary); text-decoration: none; transition: color 0.15s; }
.pp-footer a:hover { color: var(--primary); }
.pp-footer h4 { color: var(--text); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.pp-footer ul { list-style: none; padding: 0; margin: 0; }
.pp-footer li { margin-bottom: 0.5rem; }
.pp-footer li a { font-size: 0.8125rem; }

/* ===== MOBILE TWEAKS ===== */
@media (max-width: 639px) {
  .search-dropdown { max-height: 60vh; }
  .pp-modal { max-width: 100% !important; margin: 0 0.5rem; border-radius: var(--radius) !important; }
}
