/* ============================================================
   Information Mastery Tool — Stylesheet v2
   Author: Dr. Adarsh Gupta, DO
   ============================================================ */

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

:root {
  --navy:    #0f2044;
  --navy2:   #1a3060;
  --gold:    #c9963a;
  --gold2:   #e6b45a;
  --teal:    #0d7c6e;
  --teal2:   #0fa898;
  --slate:   #f0f4fb;
  --muted:   #6b7a99;
  --border:  #e2e8f0;
  --danger:  #b94040;
  --success: #1a7a4a;
  --warning: #c9963a;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --tap: 48px; /* minimum tap target height */
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: #eef2f9;
  min-height: 100vh;
  color: var(--navy);
  line-height: 1.6;
  /* room for sticky disclaimer */
  padding-top: 38px;
}

/* ── Sticky disclaimer ───────────────────────────────────── */
.disclaimer-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--navy);
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  text-align: center;
  padding: 7px 16px;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.disclaimer-bar a { color: var(--gold2); text-decoration: none; }
.disclaimer-bar a:hover { text-decoration: underline; }
.disc-icon { margin-right: 5px; }

/* ── Page layout ─────────────────────────────────────────── */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

footer {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
footer a { color: var(--teal); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── App card ────────────────────────────────────────────── */
.app {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(15,32,68,0.10);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
  background: var(--navy);
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(201,150,58,0.10);
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem 1.1rem;
  position: relative;
  gap: 12px;
}
.header h1 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.header-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.48);
  margin-top: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Reset button — always visible in header */
.reset-btn {
  flex-shrink: 0;
  min-height: var(--tap);
  min-width: 72px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: rgba(255,255,255,0.70);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.reset-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Progress bar ────────────────────────────────────────── */
.progress { display: flex; height: 3px; }
.progress-seg {
  flex: 1;
  background: rgba(255,255,255,0.12);
  transition: background 0.4s;
}
.progress-seg.done   { background: var(--gold); }
.progress-seg.active { background: var(--gold2); }

/* ── Body ────────────────────────────────────────────────── */
.body {
  padding: 1.5rem 1.4rem 1.4rem;
  animation: fadeUp 0.25s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Step header ─────────────────────────────────────────── */
.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.step-title {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.25rem;
  line-height: 1.25;
}
.step-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1.1rem;
  line-height: 1.65;
}

/* ── Step 1: Category tabs ───────────────────────────────── */
.cat-grid {
  display: grid;
  gap: 6px;
}

/* Each category row = tab + inline resource panel */
.cat-item { display: flex; flex-direction: column; }

.cat-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
}
.cat-tab:hover { border-color: var(--teal2); background: rgba(13,168,152,0.03); }
.cat-tab.active {
  border-color: var(--teal);
  background: rgba(13,124,110,0.06);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.cat-tab.active .cat-chevron { transform: rotate(90deg); color: var(--teal); }

.cat-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--slate);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.cat-tab.active .cat-icon { background: rgba(13,124,110,0.12); }

.cat-text { flex: 1; min-width: 0; }
.cat-label { font-size: 14px; font-weight: 500; color: var(--navy); line-height: 1.2; }
.cat-hint  { font-size: 11px; color: var(--muted); margin-top: 1px; }

.cat-chevron {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s, color 0.15s;
  flex-shrink: 0;
}

/* ── Inline resource panel ───────────────────────────────── */
.resource-panel {
  border: 1px solid var(--teal);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #f7fdfc;
  overflow: hidden;
  animation: slideDown 0.22s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.resource-panel-header {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid rgba(13,124,110,0.12);
}

.resource-list { padding: 8px 10px 10px; display: grid; gap: 5px; }

.resource-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(13,124,110,0.14);
  transition: background 0.15s, border-color 0.15s;
}
.resource-link:hover { background: rgba(13,124,110,0.07); border-color: var(--teal2); }

.res-icon {
  width: 28px; height: 28px;
  border-radius: 5px;
  background: rgba(13,124,110,0.10);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.res-text { flex: 1; min-width: 0; }
.res-name { font-size: 13px; font-weight: 500; color: var(--navy); line-height: 1.2; }
.res-desc { font-size: 11px; color: var(--muted); margin-top: 1px; line-height: 1.3; }
.res-arrow { font-size: 12px; color: var(--teal); flex-shrink: 0; }

.panel-note {
  margin: 0 10px 10px;
  padding: 7px 10px;
  background: rgba(201,150,58,0.08);
  border-left: 2px solid var(--gold);
  border-radius: 0 5px 5px 0;
  font-size: 11px;
  color: var(--navy);
  line-height: 1.5;
}

/* Clinical question special styling */
.cat-tab.clinical-tab { border-color: rgba(13,124,110,0.3); }
.cat-tab.clinical-tab .cat-icon { background: rgba(13,124,110,0.12); }
.clinical-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(13,124,110,0.12);
  color: var(--teal);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Continue button row (Step 1) ────────────────────────── */
.step1-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.selected-indicator {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.selected-indicator strong { color: var(--navy); }

/* ── PICO form ───────────────────────────────────────────── */
.pico-form { display: grid; gap: 10px; }
.pico-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.pico-label {
  background: var(--navy);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 6px;
  text-align: center;
}
.pico-letter {
  font-family: var(--font-head);
  font-size: 24px; font-weight: 600;
  color: var(--gold); line-height: 1;
}
.pico-name {
  font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
}
.pico-input {
  display: flex; flex-direction: column;
  padding: 10px 14px; gap: 4px;
  min-height: var(--tap);
}
.pico-field {
  font-size: 11px; font-weight: 500;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
textarea, input[type="text"] {
  width: 100%; border: none; outline: none;
  font-family: var(--font-body);
  font-size: 14px; color: var(--navy);
  background: transparent; resize: none; line-height: 1.55;
}
textarea::placeholder { color: #b0bbd4; font-size: 13px; }

/* ── Question type grid ──────────────────────────────────── */
.qtype-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qtype-card {
  min-height: var(--tap);
  padding: 13px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.qtype-card:hover    { border-color: var(--gold); background: rgba(201,150,58,0.04); }
.qtype-card.selected { border-color: var(--gold); background: rgba(201,150,58,0.08); }
.qtype-name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.qtype-desc { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.qtype-study { display: flex; flex-wrap: wrap; gap: 3px; }
.qtype-study span {
  font-size: 10px; padding: 2px 6px;
  background: rgba(15,32,68,0.07);
  border-radius: 3px; color: var(--navy2);
}

.evidence-ladder {
  margin-top: 10px;
  background: var(--slate);
  border-radius: 8px;
  padding: 10px 14px;
}
.evidence-ladder-title {
  font-size: 11px; font-weight: 500; color: var(--navy);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px;
}
.evidence-ladder p { font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ── Appraisal ───────────────────────────────────────────── */
.appraise-list { display: grid; gap: 8px; }
.criterion {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.criterion-text { flex: 1; }
.criterion-label { font-size: 13px; font-weight: 500; color: var(--navy); }
.criterion-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.radio-group { display: flex; gap: 5px; flex-shrink: 0; }
.radio-btn {
  min-height: 36px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  background: transparent; color: var(--muted);
  font-family: var(--font-body);
  display: flex; align-items: center; justify-content: center;
}
.radio-btn:hover { border-color: var(--muted); }
.radio-btn.active-yes { color: var(--success); border-color: var(--success); background: rgba(26,122,74,0.08); }
.radio-btn.active-no  { color: var(--danger);  border-color: var(--danger);  background: rgba(185,64,64,0.08); }
.radio-btn.active-na  { color: var(--muted);   border-color: var(--muted);   background: rgba(107,122,153,0.08); }

/* ── Apply step ──────────────────────────────────────────── */
.apply-list { display: grid; gap: 8px; }
.apply-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; }
.apply-card-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--navy);
  margin-bottom: 8px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.apply-area {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--slate);
  font-size: 13px; font-family: var(--font-body); color: var(--navy);
  resize: vertical; min-height: 54px; line-height: 1.5;
}
.apply-area::placeholder { color: #b0bbd4; }
.apply-area:focus { outline: none; border-color: var(--teal2); }

/* ── Shared utilities ────────────────────────────────────── */
.notice {
  font-size: 12px; color: var(--navy);
  padding: 9px 13px;
  background: rgba(201,150,58,0.07);
  border-left: 2.5px solid var(--gold);
  border-radius: 0 6px 6px 0;
  line-height: 1.55;
}
.notice.info { background: rgba(13,124,110,0.06); border-color: var(--teal); }

.quality-bar {
  padding: 9px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 12px; line-height: 1.55;
  margin-top: 10px;
}
.quality-bar.high { border-left: 2.5px solid var(--success); background: rgba(26,122,74,0.07);  color: var(--success); }
.quality-bar.ok   { border-left: 2.5px solid var(--warning); background: rgba(201,150,58,0.07); color: var(--warning); }
.quality-bar.low  { border-left: 2.5px solid var(--danger);  background: rgba(185,64,64,0.07);  color: var(--danger); }

.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-row { display: flex; gap: 8px; margin-top: 1.2rem; flex-wrap: wrap; }
.btn {
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
  font-family: var(--font-body);
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-primary   { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy2); }
.btn-secondary { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--muted); color: var(--navy); }
.btn:disabled  { opacity: 0.35; cursor: not-allowed; }

/* ── Summary / Result ────────────────────────────────────── */
.result-box {
  background: var(--navy);
  border-radius: 10px;
  padding: 1.3rem 1.4rem;
  color: #fff;
  margin-bottom: 10px;
}
.result-box h3 {
  font-family: var(--font-head);
  font-size: 17px; font-weight: 500;
  color: var(--gold2);
  margin-bottom: 0.85rem;
}
.result-row {
  display: flex; align-items: flex-start;
  gap: 8px; margin-bottom: 6px;
  font-size: 13px; line-height: 1.55;
}
.result-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold); margin-top: 7px; flex-shrink: 0;
}
.pubmed-section-label {
  font-size: 11px; color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 12px 0 5px;
}
.pubmed-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: 'Courier New', monospace;
  font-size: 11.5px; color: rgba(255,255,255,0.85);
  line-height: 1.65; word-break: break-word;
  user-select: all; cursor: text;
}
.result-actions {
  display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff; cursor: pointer;
  background: rgba(255,255,255,0.08);
  transition: background 0.18s;
  text-decoration: none;
  font-family: var(--font-body);
}
.action-btn:hover { background: rgba(255,255,255,0.16); }
.action-btn.gold {
  background: rgba(201,150,58,0.20);
  border-color: rgba(201,150,58,0.45);
  color: var(--gold2);
}
.action-btn.gold:hover { background: rgba(201,150,58,0.32); }
.action-btn.copied { background: rgba(26,122,74,0.30); border-color: rgba(26,122,74,0.5); color: #7eebb0; }

/* Export text area (hidden, for copy) */
.export-hidden {
  position: absolute; left: -9999px; top: -9999px;
  width: 1px; height: 1px; opacity: 0;
}

/* ── Step 2: Search panel ────────────────────────────────── */
.search-panel {
  border: 1px solid var(--teal);
  border-radius: 10px;
  overflow: hidden;
  animation: fadeUp 0.25s ease;
}

.search-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--teal);
  color: #fff;
  padding: 10px 15px;
  font-size: 13px;
  font-weight: 500;
}

.search-panel-icon { font-size: 15px; }

.search-panel-body { padding: 13px 15px 14px; }

.search-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  font-size: 10px;
}

.pubmed-box-inline {
  background: var(--slate);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 13px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--navy);
  line-height: 1.65;
  word-break: break-word;
  cursor: text;
  user-select: all;
  margin-bottom: 10px;
}

.search-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* action-btn light variant (used inside search panel on white bg) */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--navy);
  cursor: pointer;
  background: #fff;
  transition: background 0.18s, border-color 0.18s;
  text-decoration: none;
  font-family: var(--font-body);
}
.action-btn:hover { background: var(--slate); border-color: var(--muted); }
.action-btn.gold  {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.action-btn.gold:hover { background: var(--teal2); border-color: var(--teal2); }

/* When inside result-box (dark bg) — override */
.result-box .action-btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}
.result-box .action-btn:hover { background: rgba(255,255,255,0.16); }
.result-box .action-btn.gold {
  background: rgba(201,150,58,0.22);
  border-color: rgba(201,150,58,0.50);
  color: var(--gold2);
}
.result-box .action-btn.gold:hover { background: rgba(201,150,58,0.34); }
.action-btn.copied { background: rgba(26,122,74,0.12); border-color: var(--success); color: var(--success); }
.result-box .action-btn.copied { background: rgba(26,122,74,0.30); border-color: rgba(26,122,74,0.5); color: #7eebb0; }

/* ── Appraisal guidance block ────────────────────────────── */
.appraisal-guidance {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ag-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  background: var(--slate);
  border-bottom: 1px solid var(--border);
}

.ag-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.ag-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.3;
}

.ag-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

.ag-list { padding: 8px 10px 10px; display: grid; gap: 6px; }

.ag-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--border);
}

.ag-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.ag-content { flex: 1; }
.ag-question { font-size: 13px; font-weight: 500; color: var(--navy); line-height: 1.3; }
.ag-detail   { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
  body { padding-top: 44px; }
  .disclaimer-bar { font-size: 10px; padding: 6px 12px; }
  .page-wrap { padding: 0.8rem 0 2.5rem; }
  .app { border-radius: 0; box-shadow: none; }
  .body { padding: 1.2rem 1rem; }
  .header-inner { padding: 1rem 1rem 0.9rem; }
  .header h1 { font-size: 17px; }
  .step-title { font-size: 17px; }
  .qtype-grid { grid-template-columns: 1fr; }
  .criterion { flex-direction: column; align-items: flex-start; }
  .radio-group { margin-top: 6px; }
  .radio-btn { min-width: 52px; min-height: 40px; font-size: 13px; }
  .pico-row { grid-template-columns: 64px 1fr; }
  .pico-letter { font-size: 20px; }
  .result-actions { gap: 6px; }
  .action-btn { font-size: 11px; padding: 0 11px; }
  .btn { font-size: 13px; min-height: 44px; }
  .reset-btn { font-size: 11px; min-width: 60px; padding: 0 10px; }
}

@media (max-width: 380px) {
  .qtype-study span { font-size: 9px; }
  .header h1 { font-size: 15px; }
}
