/* DrugInsight.org — Design System */
/* Brand: Medical/Pharma Blue palette */

:root {
  /* Blues */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a5f;

  /* Reds (danger/warnings) */
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  /* Orange (moderate) */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-500: #f59e0b;
  --orange-600: #d97706;

  /* Green (safe/resolved) */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;

  /* Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic */
  --accent: var(--blue-600);
  --accent-hover: var(--blue-700);
  --accent-light: var(--blue-50);
  --danger: var(--red-600);
  --danger-light: var(--red-50);
  --warning: var(--orange-500);
  --warning-light: var(--orange-50);
  --success: var(--green-600);
  --success-light: var(--green-50);
  --info: var(--blue-500);

  /* Layout */
  --bg: var(--gray-50);
  --bg-card: #ffffff;
  --bg-alt: var(--blue-50);
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);

  /* Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Container */
  --max-w: 1200px;
  --max-w-narrow: 800px;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-alt: #1a2744;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.4);
    --accent: var(--blue-400);
    --accent-hover: var(--blue-300);
    --accent-light: #1e3a5f;
    --danger-light: #3b1111;
    --warning-light: #3b2a08;
    --success-light: #0a2e14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-alt: #1a2744;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --accent: var(--blue-400);
  --accent-hover: var(--blue-300);
  --accent-light: #1e3a5f;
  --danger-light: #3b1111;
  --warning-light: #3b2a08;
  --success-light: #0a2e14;
  color-scheme: dark;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: var(--text-base); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.5rem; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--text-3xl); font-weight: 800; margin-bottom: 0.5rem; }
h2 { font-size: var(--text-2xl); margin: 2rem 0 1rem; }
h3 { font-size: var(--text-xl); margin: 1.5rem 0 0.75rem; }
p { margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
th { font-weight: 600; background: var(--bg-alt); position: sticky; top: 0; }
.hidden { display: none !important; }

/* Container */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-lg); font-weight: 800; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--blue-600), var(--blue-800)); color: #fff; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 800; letter-spacing: -0.5px; }
.nav-main { display: flex; gap: 0.25rem; margin-left: auto; }
.nav-main a { padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); transition: all .15s; white-space: nowrap; }
.nav-main a:hover, .nav-main a.active { color: var(--accent); background: var(--accent-light); text-decoration: none; }
.theme-toggle, .nav-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg, .nav-toggle svg { width: 18px; height: 18px; }
.nav-toggle { display: none; }

/* Hero */
.hero { padding: 4rem 0 3rem; text-align: center; background: linear-gradient(135deg, var(--blue-600), var(--blue-800)); color: #fff; }
.hero h1 { font-size: var(--text-4xl); color: #fff; margin-bottom: 1rem; }
.hero p { font-size: var(--text-lg); opacity: 0.9; max-width: 600px; margin: 0 auto 2rem; }

/* Search Box */
.search-box { max-width: 600px; margin: 0 auto; position: relative; }
.search-box input { width: 100%; padding: 1rem 1.25rem 1rem 3rem; font-size: var(--text-lg); border: 2px solid rgba(255,255,255,0.3); border-radius: var(--radius-xl); background: rgba(255,255,255,0.15); color: #fff; font-family: var(--font); backdrop-filter: blur(10px); }
.search-box input::placeholder { color: rgba(255,255,255,0.7); }
.search-box input:focus { outline: none; border-color: #fff; background: rgba(255,255,255,0.25); }
.search-box .search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.7); }
.search-box .search-icon svg { width: 20px; height: 20px; }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: 0.5rem; box-shadow: var(--shadow-md); max-height: 400px; overflow-y: auto; z-index: 50; }
.search-dropdown a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text); font-size: var(--text-sm); border-bottom: 1px solid var(--border); }
.search-dropdown a:hover { background: var(--accent-light); text-decoration: none; }
.search-dropdown a:last-child { border-bottom: none; }
.search-dropdown .drug-type { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; }

/* Page search (non-hero) */
.page-search { max-width: 600px; position: relative; }
.page-search input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.75rem; font-size: var(--text-base); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); color: var(--text); font-family: var(--font); }
.page-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.page-search .search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* Stats Bar */
.stats-bar { display: flex; justify-content: center; gap: 2rem; padding: 1.5rem 0; flex-wrap: wrap; }
.hero .stats-bar { border-top: 1px solid rgba(255,255,255,0.2); margin-top: 2rem; }
.stat-item { text-align: center; }
.stat-num { font-size: var(--text-2xl); font-weight: 800; }
.hero .stat-num { color: #fff; }
.stat-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.8; }

/* Sections */
.section { padding: 3rem 0; }
.section-alt { background: var(--bg-alt); }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.card:hover { box-shadow: var(--shadow-md); }
.card h3 { margin-top: 0; }

/* Tool Cards */
.tool-card { display: flex; align-items: flex-start; gap: 1rem; padding: 1.25rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: all .2s; text-decoration: none; color: var(--text); }
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.tool-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.tool-card h3 { font-size: var(--text-base); margin: 0 0 0.25rem; }
.tool-card p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }

/* Grids */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* Category Chips */
.cat-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.4rem 0.75rem; border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: 500; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; font-family: var(--font); }
.cat-chip:hover, .cat-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; background: var(--accent-light); color: var(--accent); }
.badge-red { background: var(--danger-light); color: var(--red-600); }
.badge-orange { background: var(--warning-light); color: var(--orange-600); }
.badge-green { background: var(--success-light); color: var(--green-600); }
.badge-blue { background: var(--accent-light); color: var(--blue-600); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-rx { background: var(--blue-600); color: #fff; }
.badge-otc { background: var(--green-600); color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.25rem; border-radius: var(--radius); font-size: var(--text-sm); font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: all .15s; text-decoration: none; font-family: var(--font); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline { border-color: var(--border); color: var(--text); background: var(--bg-card); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: var(--text-base); }

/* Table Wrap */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.table-wrap table { margin: 0; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 1rem; }

/* Recall Cards */
.recall-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; border-left: 4px solid var(--border); }
.recall-card.class-i { border-left-color: var(--red-600); }
.recall-card.class-ii { border-left-color: var(--orange-500); }
.recall-card.class-iii { border-left-color: var(--orange-600); }
.recall-card h3 { font-size: var(--text-base); margin: 0 0 0.5rem; }
.recall-card p { font-size: var(--text-sm); color: var(--text-muted); margin: 0.25rem 0; }
.recall-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.75rem; font-size: var(--text-xs); color: var(--text-muted); }

/* Drug Detail */
.drug-header { margin-bottom: 2rem; }
.drug-header h1 { margin-bottom: 0.25rem; }
.drug-generic { font-size: var(--text-lg); color: var(--text-muted); font-weight: 400; margin-bottom: 0.75rem; }
.drug-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.drug-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
.drug-main { min-width: 0; }
.drug-sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

/* Quick Facts */
.quick-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.quick-fact { background: var(--bg-card); padding: 0.75rem 1rem; }
.quick-fact dt { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.quick-fact dd { font-weight: 600; font-size: var(--text-sm); margin: 0; }

/* Black Box Warning */
.black-box-warning { background: var(--danger-light); border: 2px solid var(--red-600); border-radius: var(--radius-lg); padding: 1.25rem; margin: 1.5rem 0; }
.black-box-warning h3 { color: var(--red-600); font-size: var(--text-base); margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.black-box-warning p { font-size: var(--text-sm); margin: 0; }

/* Side Effects List */
.side-effects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.se-item { display: flex; align-items: center; gap: 0.5rem; font-size: var(--text-sm); padding: 0.5rem 0.75rem; background: var(--bg-alt); border-radius: var(--radius); }
.se-freq { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; }

/* AE Chart Box */
.chart-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }

/* Interaction Results */
.interaction-result { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; border-left: 4px solid var(--border); }
.interaction-result.major { border-left-color: var(--red-600); }
.interaction-result.moderate { border-left-color: var(--orange-500); }
.interaction-result.minor { border-left-color: var(--green-600); }
.interaction-result h3 { font-size: var(--text-base); margin: 0 0 0.5rem; }
.interaction-result p { font-size: var(--text-sm); color: var(--text-muted); margin: 0.25rem 0; }

/* Shortage Card */
.shortage-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.shortage-card.active { border-left: 4px solid var(--red-600); }
.shortage-card.resolved { border-left: 4px solid var(--green-600); }

/* Pill Identifier */
.pill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 0.5rem; }
.pill-option { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.75rem; border: 2px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: all .15s; font-size: var(--text-xs); text-align: center; }
.pill-option:hover, .pill-option.active { border-color: var(--accent); background: var(--accent-light); }
.pill-swatch { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); }

/* Calculator */
.calc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.calc-form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: 0.25rem; }
.field input, .field select { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: var(--text-base); background: var(--bg-card); color: var(--text); font-family: var(--font); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.calc-result { background: var(--accent-light); border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 1.5rem; }
.result-num { font-size: var(--text-4xl); font-weight: 800; color: var(--accent); }
.result-label { font-size: var(--text-sm); color: var(--text-muted); }

/* Approval Card */
.approval-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.approval-card .approval-type { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* Drug Class Card */
.class-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; transition: all .2s; text-decoration: none; color: var(--text); display: block; }
.class-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; }
.class-card h3 { margin: 0 0 0.5rem; font-size: var(--text-lg); }
.class-card p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }
.class-drugs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.75rem; }

/* Article Cards */
.article-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all .2s; }
.article-card:hover { box-shadow: var(--shadow-md); }
.article-card-body { padding: 1.25rem; }
.article-card h3 { font-size: var(--text-base); margin: 0 0 0.5rem; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--accent); }
.article-card p { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }
.article-meta { font-size: var(--text-xs); color: var(--text-muted); display: flex; gap: 0.75rem; margin-top: 0.75rem; }

/* Breadcrumbs */
.breadcrumbs { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 0.5rem; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; gap: 0; }
.tab { padding: 0.75rem 1.25rem; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; background: none; border-top: none; border-left: none; border-right: none; font-family: var(--font); }
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Disclaimer */
.disclaimer-box { background: var(--warning-light); border: 1px solid var(--warning); border-radius: var(--radius-lg); padding: 1rem 1.25rem; font-size: var(--text-sm); margin: 1.5rem 0; }
.disclaimer-box strong { color: var(--orange-600); }

/* Source Badges */
.source-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.source-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.6rem; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; background: var(--bg-alt); border: 1px solid var(--border); }

/* Footer */
.site-footer { background: var(--gray-900); color: var(--gray-400); padding: 2rem 0; margin-top: 3rem; font-size: var(--text-sm); }
.footer-bottom { text-align: center; }
.footer-bottom p { margin: 0.25rem 0; }
.footer-disclaimer { font-size: var(--text-xs); color: var(--gray-500); max-width: 700px; margin: 0.5rem auto 0; line-height: 1.5; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--gray-400); }
.footer-links a:hover { color: #fff; }

/* Helpers */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Responsive */
@media (max-width: 1024px) {
  .drug-layout { grid-template-columns: 1fr; }
  .drug-sidebar { order: -1; }
}
@media (max-width: 768px) {
  .nav-main { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); flex-direction: column; padding: 1rem; box-shadow: var(--shadow-md); }
  .nav-main.open { display: flex; }
  .nav-toggle { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: var(--text-2xl); }
  .hero h1 { font-size: var(--text-3xl); }
  .hero { padding: 3rem 0 2rem; }
  .stats-bar { gap: 1rem; }
  .calc-form { grid-template-columns: 1fr; }
  .quick-facts { grid-template-columns: 1fr; }
  .side-effects-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}
@media (max-width: 480px) {
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: var(--text-2xl); }
  .hero p { font-size: var(--text-base); }
  .stat-num { font-size: var(--text-xl); }
}
