/**
 * PharmIQ — Script Solution Calculator
 * Brand-compliant stylesheet
 * Built against PharmIQ Brand Guidelines v1.2 (March 2026)
 */

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
  /* ── PharmIQ Design Tokens (v1.2) ────────────────────────── */
  --color-brand-teal:         #0F766E;
  --color-brand-teal-light:   #14B8A6;
  --color-brand-teal-dark:    #0D5D5A;
  --color-brand-teal-50:      #F0FDFA;
  --color-brand-teal-100:     #CCFBF1;

  --color-brand-amber:        #D97706;
  --color-brand-amber-light:  #FDE68A;
  --color-brand-amber-50:     #FFFBEB;
  --color-brand-amber-dark:   #92400E;

  --color-brand-navy:         #0F172A;
  --color-brand-navy-mid:     #1E3A5F;
  --color-brand-sky:          #0EA5E9;

  /* Semantic colors */
  --color-success:            #10B981;
  --color-success-bg:         #ECFDF5;
  --color-warning:            #D97706;
  --color-warning-bg:         #FFFBEB;
  --color-critical:           #EF4444;
  --color-critical-bg:        #FEF2F2;

  /* Neutral palette */
  --color-white:              #FFFFFF;
  --color-surface:            #F8FAFC;
  --color-border-light:       #E2E8F0;
  --color-border-mid:         #CBD5E1;
  --color-text-primary:       #0F172A;
  --color-text-secondary:     #475569;
  --color-text-muted:         #94A3B8;

  /* Typography */
  --font-heading:   'Space Grotesk', 'Sora', system-ui, sans-serif;
  --font-body:      'Inter', system-ui, -apple-system, sans-serif;

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

  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-xl:    16px;

  /* Elevation */
  --shadow-sm:    0 1px 3px rgba(15,23,42,0.10), 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md:    0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.06);
  --shadow-lg:    0 10px 15px rgba(15,23,42,0.10), 0 4px 6px rgba(15,23,42,0.05);

  /* Glass tokens */
  --glass-opacity-surface: 0.8;
  --glass-opacity-border:  0.5;
  --glass-blur-md:         12px;
  --shadow-glass-inner: inset 0 1px 0 rgba(255,255,255,0.4);

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── Dark Mode (Navy base) ────────────────────────────────── */
[data-theme="dark"] {
  --color-white:          #0F172A;
  --color-surface:        #1E293B;
  --color-border-light:   #334155;
  --color-border-mid:     #475569;
  --color-text-primary:   #F1F5F9;
  --color-text-secondary: #94A3B8;
  --color-text-muted:     #64748B;
  
  --color-brand-teal:     #14B8A6;
  --glass-opacity-surface: 0.15;
}

/* ── Tailwind Replacements ───────────────────────────────────── */
.p-4 { padding: 1rem; }
.p-8 { padding: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-6xl { max-width: 72rem; }
.max-w-md { max-width: 28rem; }
.max-w-xs { max-width: 20rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-x-8 { column-gap: 2rem; }
.gap-y-4 { row-gap: 1rem; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-gray-600 { color: var(--color-text-secondary); }
.text-gray-700 { color: var(--color-text-primary); }
.border-b { border-bottom: 1px solid var(--color-border-light); }
.pb-3 { padding-bottom: 0.75rem; }
.rounded-lg { border-radius: var(--radius-lg); }
.overflow-x-auto { overflow-x: auto; }
.list-disc { list-style-type: disc; }
.list-none { list-style-type: none; }
.pl-0 { padding-left: 0; }
.pl-5 { padding-left: 1.25rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.bg-gray-100 { background-color: var(--color-surface); }

@media (min-width: 768px) {
  .md\:p-8 { padding: 2rem; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Global Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  line-height: 1.6;
  margin: 0;
}

/* ── SITE HEADER ──────────────────────────────────────────────── */
.pharmiq-site-header {
  background-color: var(--color-brand-navy);
  background-image:
    radial-gradient(ellipse 70% 60% at 80% 0%,  rgba(15,118,110,0.28) 0%, transparent 55%),
    radial-gradient(ellipse 45% 50% at 5% 100%,  rgba(30,58,95,0.55) 0%, transparent 50%);
  text-align: center;
  padding: 2.25rem 1.5rem 1.875rem;
  margin-bottom: 2rem;
  position: relative;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, transform 150ms var(--ease-out-quart);
  z-index: 10;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* Teal/amber gradient rule at bottom of header */
.pharmiq-site-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-brand-teal-100) 10%,
    var(--color-brand-teal) 30%,
    var(--color-brand-teal-light) 50%,
    var(--color-brand-amber) 75%,
    transparent 100%
  );
}

.pharmiq-logo-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  margin-bottom: 0.625rem;
  flex-wrap: wrap;
}

.pharmiq-logo-lockup svg {
  height: 34px;
  width: auto;
  flex-shrink: 0;
}

.pharmiq-divider {
  width: 1px;
  height: 26px;
  background: rgba(255,255,255,0.18);
  flex-shrink: 0;
}

.pharmiq-tool-name {
  font-family: var(--font-heading);
  font-size: 1.3125rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.pharmiq-tool-desc {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(255,255,255,0.65);
  margin: 0;
  letter-spacing: 0.005em;
}

/* ── PAGE ENTRANCE ────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(13px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tableRowIn {
  from { opacity: 0; transform: translateX(-5px); }
  to   { opacity: 1; transform: translateX(0); }
}

.pharmiq-site-header {
  animation: fadeSlideUp 500ms var(--ease-out-quart) both;
}

.tab-nav {
  animation: fadeSlideUp 500ms var(--ease-out-quart) 70ms both;
}

/* ── TAB NAVIGATION ───────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.tab-button {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border: 1.5px solid var(--color-border-light);
  background: var(--color-white);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: none;
  margin-right: 0.125rem;
}

.tab-button:hover {
  background: var(--color-brand-teal-50);
  color: var(--color-brand-teal);
  border-color: var(--color-brand-teal-100);
}

.tab-button.active {
  background: var(--color-brand-teal);
  color: var(--color-white);
  border-color: var(--color-brand-teal);
}

.tab-content { display: none; }
.tab-content.active {
  display: block !important;
  animation: fadeSlideUp 260ms var(--ease-out-quart) 80ms both;
}

/* ── CARDS: Liquid Glass Pattern ────────────────────────────── */
.calculator-card {
  background: rgba(255, 255, 255, var(--glass-opacity-surface));
  backdrop-filter: blur(var(--glass-blur-md));
  border: 1px solid rgba(226, 232, 240, var(--glass-opacity-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-glass-inner);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
}

.calculator-card h2 {
  font-family: var(--font-heading) !important;
  font-size: 1.375rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: var(--color-text-primary) !important;
  margin: 0 0 1.5rem !important;
  padding-bottom: 0.875rem !important;
  border-bottom: 1.5px solid var(--color-border-light) !important;
  letter-spacing: -0.025em !important;
}

.calculator-card h3 {
  font-family: var(--font-heading) !important;
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.015em !important;
  color: var(--color-text-primary) !important;
}

/* ── INPUT FIELDS: Succinct Entry Pattern ───────────────────── */
.input-field {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  border: 1.5px solid var(--color-border-mid);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.04);
  transition: all 150ms var(--ease-out-quart);
  font-variant-numeric: tabular-nums;
}

.input-field:focus {
  outline: none;
  border-color: var(--color-brand-teal);
  box-shadow: 0 0 0 4px rgba(15,118,110,0.1);
  background: #FFFFFF;
}

/* Amber Usage Restraint: removed yellow-input decoration from standard inputs */
.yellow-input {
  /* No longer decorative amber; remains for compatibility but uses standard Succinct Entry styling */
  background: rgba(255, 255, 255, 0.9);
}

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn-primary {
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--color-brand-teal);
  color: var(--color-white);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: all 150ms ease;
  box-shadow: 0 2px 6px rgba(15,118,110,0.28);
}

.btn-primary:hover {
  background: var(--color-brand-teal-dark);
  box-shadow: 0 4px 14px rgba(15,118,110,0.38);
  transform: translateY(-1px);
}

/* ── RESULTS TABLES ────────────────────────────────────────────── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.results-table th {
  background: var(--color-brand-navy);
  color: rgba(255,255,255,0.78);
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.5625rem 0.875rem;
  text-align: left;
}

.results-table td {
  padding: 0.5625rem 0.875rem;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
}

.results-table tbody tr:hover td { background: var(--color-brand-teal-50); }

/* ── SPECIALIZED CARD VARIANTS ─────────────────────────────── */
.current-performance-card {
  background: var(--color-brand-teal-50);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.scenario-section {
  background: var(--color-brand-teal-50);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.current-state {
  background: var(--color-brand-amber-50);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.target-section {
  background: var(--color-success-bg);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
}

/* ── ANIMATIONS ────────────────────────────────────────────────── */
@keyframes valueUpdated {
  0%   { text-shadow: none; }
  22%  { text-shadow: 0 0 10px rgba(15,118,110,0.50); }
  100% { text-shadow: none; }
}

.value-flash {
  animation: valueUpdated 700ms var(--ease-out-quart);
}

/* ── FAQ ACCORDION ───────────────────────────────────────────────── */
.faq-item {
  background: var(--color-white);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: all 200ms ease;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  transition: all 150ms ease;
}

.faq-question:hover { background: var(--color-brand-teal-50); }

.faq-question.active {
  background: var(--color-brand-teal-50);
  color: var(--color-brand-teal);
}

.faq-arrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform 200ms ease;
}

.faq-question.active .faq-arrow {
  transform: rotate(180deg);
  color: var(--color-brand-teal);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease;
}

.faq-answer.active {
  max-height: 500px;
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.faq-answer p {
  margin: 0.5rem 0;
}

.faq-answer ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.faq-answer li {
  margin: 0.25rem 0;
}

/* ── RESPONSIVE & UTILS ────────────────────────────────────────── */
[data-value], .metric, td.number, .badge-count {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .pharmiq-site-header { padding: 1.75rem 1rem 1.5rem; }
  .calculator-card     { padding: 1.25rem; }
}

