/* ═══════════════════════════════════════════════
   Pediatric Fever Dosing Sheet — styles.css
   Original styles preserved; lang selector +
   RTL overrides appended at bottom.
═══════════════════════════════════════════════ */

:root {
  --red: #C0392B;
  --red-light: #F9E8E7;
  --blue: #1A3A5C;
  --blue-mid: #2563A8;
  --blue-light: #E8F0FA;
  --orange: #D9651A;
  --orange-light: #FEF3E7;
  --ink: #1C1C1E;
  --mid: #5A5A6E;
  --rule: #D8DCE6;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --shadow: 0 2px 12px rgba(26,58,92,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
}

.screen-wrapper {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.header-left h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.header-left h1 span { color: var(--red); }
.header-left p {
  font-size: 0.82rem;
  color: var(--mid);
  margin-top: 5px;
  max-width: 500px;
  line-height: 1.5;
}

.print-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 9px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.print-btn:hover { background: var(--blue-mid); }
.print-btn svg { width: 15px; height: 15px; }

/* ── FEVER DEFINITION BOX ── */
.fever-box {
  background: #fff;
  border: 1.5px solid #b8cfe8;
  border-left: 4px solid var(--blue-mid);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 16px;
  align-items: start;
}
.fever-icon { font-size: 1.6rem; line-height: 1; margin-top: 2px; }
.fever-box h3 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--blue-mid);
  margin-bottom: 6px;
}
.fever-temps {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}
.temp-chip {
  background: var(--blue-light);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
}
.temp-chip span { font-weight: 400; color: var(--mid); font-size: 0.72rem; margin-inline-start: 4px; }
.fever-note {
  font-size: 0.75rem;
  color: var(--mid);
  line-height: 1.6;
}
.fever-note strong { color: var(--ink); }

/* ── INPUT CARD ── */
.input-card {
  background: var(--blue);
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.input-card label {
  color: rgba(255,255,255,0.7);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 7px;
}
.weight-row { display: flex; align-items: center; gap: 9px; }
.weight-input {
  background: rgba(255,255,255,0.13);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 9px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  width: 100px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
}
.weight-input::placeholder { color: rgba(255,255,255,0.3); }
.weight-input:focus { border-color: rgba(255,255,255,0.65); }

.unit-toggle {
  display: flex;
  border-radius: 7px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.25);
}
.unit-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.unit-btn.active { background: rgba(255,255,255,0.2); color: #fff; }

/* Age Toggle */
.age-toggle-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 9px;
  color: rgba(255,255,255,0.8);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.age-toggle-btn.under6 {
  background: rgba(192,57,43,0.45);
  border-color: rgba(255,140,120,0.5);
  color: #fff;
}
.check-circle {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s;
}
.age-toggle-btn.under6 .check-circle {
  background: #fff;
  border-color: #fff;
  color: var(--red);
}

.dose-display { text-align: end; }
.dose-display .dose-label {
  color: rgba(255,255,255,0.6);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.dose-display .dose-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}
.dose-display .dose-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}

.input-age-note {
  width: 100%;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.74rem;
  line-height: 1.45;
}
.input-age-note.hidden { display: none; }
.input-age-note.warn { background: rgba(192,57,43,0.3); color: #ffd5d1; }

/* ── MAX BANNER ── */
.max-banner {
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--blue-light);
  border: 1px solid #b8cfe8;
}
.max-item { flex: 1; min-width: 130px; }
.max-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--blue-mid);
  margin-bottom: 3px;
}
.max-val { font-size: 1.15rem; font-weight: 700; color: var(--blue); }
.max-sub { font-size: 0.68rem; color: var(--mid); margin-top: 1px; }

/* ── DRUG SECTIONS ── */
.drug-section { margin-bottom: 22px; }
.drug-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.drug-badge {
  border-radius: 7px;
  padding: 5px 13px;
  font-size: 0.88rem;
  font-weight: 700;
}
.badge-tylenol { background: var(--red); color: #fff; }
.badge-advil   { background: var(--orange); color: #fff; }
.drug-generic { font-size: 0.78rem; color: var(--mid); }
.drug-dose-range { margin-inline-start: auto; font-size: 0.76rem; color: var(--mid); text-align: end; }
.drug-dose-range strong { color: var(--ink); font-weight: 600; }

/* ── DOSING TABLE ── */
.dose-table-wrap {
  background: var(--card);
  border-radius: 12px;
  border: 1.5px solid var(--rule);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.dose-table thead tr {
  background: var(--bg);
}
.dose-table.tylenol thead tr { border-top: 3px solid var(--red); }
.dose-table.advil   thead tr { border-top: 3px solid var(--orange); }

.dose-table th {
  padding: 9px 14px;
  text-align: start;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mid);
  border-bottom: 1.5px solid var(--rule);
  white-space: nowrap;
}
.dose-table th.col-amount { text-align: center; }

.dose-table td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--rule);
}
.dose-table tbody tr:last-child td { border-bottom: none; }
.dose-table tbody tr:hover { background: #fafbfd; }

.td-formulation { font-weight: 600; color: var(--ink); }
.td-conc { font-size: 0.75rem; color: var(--mid); margin-top: 1px; }
.td-note-tag {
  display: inline-block;
  margin-top: 3px;
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.65rem;
  color: var(--mid);
  font-weight: 500;
}

.td-amount {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.td-amount.tylenol-amt { color: var(--red); }
.td-amount.advil-amt   { color: var(--orange); }
.td-amount.pending     { color: var(--rule); font-size: 0.8rem; font-weight: 400; }

.td-unit {
  font-size: 0.7rem;
  color: var(--mid);
  margin-top: 2px;
  text-align: center;
}

.td-freq {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.td-freq-sub {
  font-size: 0.7rem;
  color: var(--mid);
  font-weight: 400;
  margin-top: 1px;
}

/* ── ADVIL WARNING ── */
.advil-warning {
  background: #FFF4E5;
  border: 2px solid var(--orange);
  border-radius: 13px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: none;
  align-items: flex-start;
  gap: 16px;
}
.advil-warning.show { display: flex; }
.advil-warning-icon { font-size: 2rem; flex-shrink: 0; }
.advil-warning h3 { font-size: 0.95rem; font-weight: 700; color: #7D3600; margin-bottom: 7px; }
.advil-warning p { font-size: 0.8rem; color: #7D3600; line-height: 1.6; }
.advil-warning p strong { font-weight: 700; }

/* ── SCHEDULE ── */
.schedule-section { margin-bottom: 20px; }
.schedule-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 10px;
}
.schedule-tabs { display: flex; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.sched-tab {
  background: var(--card);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--mid);
  cursor: pointer;
  transition: all 0.15s;
}
.sched-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.schedule-card {
  background: var(--card);
  border-radius: 12px;
  border: 1.5px solid var(--rule);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.schedule-card h4 { font-size: 0.82rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.sched-desc { font-size: 0.74rem; color: var(--mid); margin-bottom: 14px; line-height: 1.55; }

/* Timeline */
.timeline { display: flex; flex-direction: column; }

.tl-row { display: flex; align-items: stretch; }
.tl-time {
  width: 60px;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--mid);
  padding-top: 9px;
  padding-inline-end: 10px;
  text-align: end;
}
.tl-spine {
  width: 22px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tl-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  margin-top: 9px;
  flex-shrink: 0;
  border: 2px solid #fff;
}
.tl-dot.t-dot    { background: var(--red);    box-shadow: 0 0 0 2px #f0c5c2; }
.tl-dot.a-dot    { background: var(--orange);  box-shadow: 0 0 0 2px #fcd9b5; }
.tl-dot.both-dot {
  background: linear-gradient(135deg, var(--red) 50%, var(--orange) 50%);
  box-shadow: 0 0 0 2px #e0d0c0;
}
.tl-line { width: 2px; flex: 1; background: var(--rule); min-height: 8px; }
.tl-row:last-child .tl-line { display: none; }
.tl-content { flex: 1; padding: 5px 0 13px 10px; }
.tl-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.tl-pill {
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 0.7rem;
  font-weight: 700;
}
.tl-pill.t { background: var(--red-light); color: var(--red); }
.tl-pill.a { background: var(--orange-light); color: var(--orange); }
.tl-note { font-size: 0.68rem; color: var(--mid); }

/* ── SAFETY CARDS ── */
.safety-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.safety-card { border-radius: 11px; padding: 13px 15px; font-size: 0.74rem; line-height: 1.55; }
.safety-card.tylenol-safe { background: var(--red-light); border: 1px solid #f0c5c2; }
.safety-card.advil-safe   { background: var(--orange-light); border: 1px solid #fcd9b5; }
.safety-card h4 {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.safety-card.tylenol-safe h4 { color: var(--red); }
.safety-card.advil-safe h4   { color: var(--orange); }
.safety-card ul { padding-inline-start: 14px; color: var(--mid); }
.safety-card li { margin-bottom: 3px; }

/* ── FOOTER ── */
footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 0.67rem;
  color: var(--mid);
  line-height: 1.6;
}
footer strong { color: var(--ink); }

/* ══════════════════════════════════════════
   LANGUAGE SELECTOR
══════════════════════════════════════════ */
.lang-selector-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}
.lang-selector-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--mid);
  white-space: nowrap;
}
#langSelect {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--rule);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  max-width: 200px;
}
#langSelect:focus { border-color: var(--blue-mid); }
#langSelect:hover { border-color: var(--blue-mid); }

/* ══════════════════════════════════════════
   RIGHT-TO-LEFT (Arabic, Farsi, Urdu)
══════════════════════════════════════════ */
[dir="rtl"] body {
  font-family: 'Noto Sans Arabic', 'Segoe UI', 'Inter', sans-serif;
}

/* Flip the fever box border accent */
[dir="rtl"] .fever-box {
  border-left: 1.5px solid #b8cfe8;
  border-right: 4px solid var(--blue-mid);
}

/* Header: keep logo left, controls right — reverse for RTL */
[dir="rtl"] header {
  flex-direction: row-reverse;
}
[dir="rtl"] .header-left {
  text-align: start;
}

/* Input card: align dose displays to start (left in LTR = right in RTL) */
[dir="rtl"] .dose-display {
  text-align: start;
}

/* Drug dose range: margin-inline-start already handles this via logical props */

/* Timeline: flip the time column to the right side */
[dir="rtl"] .tl-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .tl-time {
  text-align: start;
  padding-inline-end: 0;
  padding-inline-start: 10px;
}
[dir="rtl"] .tl-content {
  padding: 5px 10px 13px 0;
}

/* Table headers */
[dir="rtl"] .dose-table th {
  text-align: start;
}

/* Safety list bullets on the correct side */
[dir="rtl"] .safety-card ul {
  padding-inline-start: 14px;
  padding-inline-end: 0;
}

/* ══════════════════════════════════════════
   PRINT
══════════════════════════════════════════ */
@media print {
   .no-print { display: none !important; }
  @page { size: letter portrait; margin: 13mm 13mm 13mm 13mm; }
  body {
    background: #fff !important;
    font-size: 9pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .screen-wrapper { padding: 0; max-width: 100%; }
  .print-btn,
  .schedule-tabs,
  .age-toggle-btn,
  .lang-selector-wrap { display: none !important; }
  header { margin-bottom: 9pt; }
  .header-left h1 { font-size: 15pt; }
  .fever-box { margin-bottom: 9pt; }
  .input-card { padding: 10pt 12pt; margin-bottom: 9pt; gap: 12pt; }
  .weight-input { font-size: 14pt; width: 68pt; }
  .form-grid { grid-template-columns: repeat(4, 1fr); gap: 5pt; }
  .form-card { padding: 7pt 9pt; }
  .form-amount { font-size: 12pt; }
  .dose-table th, .dose-table td { padding: 6pt 9pt; }
  .dose-table { font-size: 8pt; }
  .td-amount { font-size: 11pt; }
  .safety-grid { gap: 6pt; margin-bottom: 9pt; }
  .safety-card { padding: 7pt 9pt; }
  .max-banner { padding: 8pt 11pt; margin-bottom: 9pt; }
  .drug-section { margin-bottom: 10pt; }
  .schedule-card { padding: 9pt 11pt; }
  .schedule-section { margin-bottom: 10pt; }
  .sched-panel { display: none !important; }
  .sched-panel.active-panel { display: block !important; }
  footer { font-size: 6.5pt; margin-top: 9pt; }
  .advil-warning { padding: 10pt 13pt; }
}
