/* ══════════════════════════════════════════════════════════
   Dashboard Shared Styles
   Sonographer In The Making - Audit Dashboard Pages
   ══════════════════════════════════════════════════════════ */

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #151a1e;
  --card-bg: #1e2428;
  --text: #dde4e8;
  --text-mute: #a0aab2;
  --accent: #b8cee6;
  --accent-dk: #8fb3d4;
  --border: #2e3640;
  --soft-1: #222a30;
  --soft-2: #283038;
  --ease: cubic-bezier(0.21, 0.83, 0.26, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --glow: rgba(160, 200, 240, 0.15);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Klee One', cursive;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.6;
}

/* Hard minimum: 12px. Nothing on any page goes below this. */

a { color: var(--accent-dk); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Page Layout ── */
.page-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

.page-content { min-width: 0; }

/* ── Back Link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text-mute);
  margin-bottom: 32px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── Page Header ── */
h1 {
  font-family: 'Patrick Hand SC', cursive;
  font-size: 52px;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 8px;
}
h1 em { font-style: italic; color: var(--accent-dk); }

.report-meta {
  font-size: 15px;
  color: var(--text-mute);
  margin-bottom: 48px;
}

/* ── Section Headings ── */
h2 {
  font-family: 'Patrick Hand SC', cursive;
  font-size: 34px;
  color: var(--text);
  margin: 64px 0 24px;
}
h2:first-of-type { margin-top: 0; }
h2 em { font-style: normal; color: var(--accent-dk); }

h3 {
  font-family: 'Patrick Hand SC', cursive;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 16px;
}
h3 em { font-style: normal; color: var(--accent-dk); }

/* ── Side Navigation ── */
.side-nav {
  position: sticky;
  top: 40px;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.side-nav a {
  display: block;
  padding: 6px 0 6px 14px;
  font-size: 14px;
  color: var(--text-mute);
  border-left: 2px solid transparent;
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}
.side-nav a:hover { color: var(--text); }
.side-nav a.active {
  color: var(--accent-dk);
  border-left-color: var(--accent-dk);
}

/* ── Score Tags ── */
.sc-tag {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-block;
}
.t-red { background: rgba(220,80,80,0.15); color: #e86060; }
.t-orange { background: rgba(220,160,60,0.15); color: #dca03c; }
.t-yellow { background: rgba(200,190,60,0.15); color: #c8be3c; }
.t-green { background: rgba(80,180,120,0.15); color: #50b478; }
.t-blue { background: rgba(100,160,220,0.15); color: #64a0dc; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.card:hover {
  border-color: rgba(143,179,212,0.3);
  box-shadow: 0 4px 24px var(--glow);
}

/* ── Metric Cards ── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}
.metric-num {
  font-family: 'Patrick Hand SC', cursive;
  font-size: 36px;
  color: var(--accent);
  line-height: 1;
}
.metric-label {
  font-size: 15px;
  color: var(--text);
  margin-top: 4px;
}
.metric-detail {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Findings / Left-border Cards ── */
.findings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
  margin-bottom: 48px;
}
.finding {
  padding-left: 16px;
  border-left: 2px solid var(--border);
  transition: border-color 0.15s ease-out;
}
.finding:hover { border-left-color: var(--accent-dk); }
.finding strong {
  display: block;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}
.finding p {
  color: var(--text-mute);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* ── Charts ── */
.chart-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  margin-bottom: 24px;
}
.chart-wrap:hover {
  border-color: rgba(143,179,212,0.3);
  box-shadow: 0 4px 24px var(--glow);
}
.chart-note {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 14px;
  line-height: 1.5;
}
.chart-note strong { color: var(--text); }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 32px;
}
.data-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  font-weight: 400;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th.center { text-align: center; }
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(46,54,64,0.5);
  font-size: 14px;
}
.data-table td.center { text-align: center; }
.data-table tbody tr:hover { background: var(--soft-1); }
.data-table code {
  background: rgba(143,179,212,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Callout Box ── */
.callout-box {
  background: var(--soft-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dk);
  border-radius: 0 12px 12px 0;
  padding: 20px 24px;
  margin: 24px 0;
}
.callout-box strong {
  display: block;
  font-family: 'Patrick Hand SC', cursive;
  font-size: 18px;
  margin-bottom: 6px;
}
.callout-box code {
  background: rgba(143,179,212,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.callout-box p {
  font-size: 14px;
  color: var(--text-mute);
  line-height: 1.5;
  margin: 0;
}

/* ── Status Banner ── */
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 15px;
}
.status-banner.good { background: rgba(80,180,120,0.06); border: 1px solid rgba(80,180,120,0.15); color: #50b478; }
.status-banner.warn { background: rgba(220,160,60,0.06); border: 1px solid rgba(220,160,60,0.15); color: #dca03c; }
.status-banner.bad { background: rgba(220,80,80,0.06); border: 1px solid rgba(220,80,80,0.15); color: #e86060; }

/* ── Tabs ── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 12px 20px;
  font-family: 'Patrick Hand SC', cursive;
  font-size: 18px;
  color: var(--text-mute);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent-dk);
  border-bottom-color: var(--accent-dk);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Timeline / Accordion ── */
.timeline { position: relative; padding-left: 40px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, #50b478 0%, #e8a84c 33%, var(--accent-dk) 66%, #4ca8e8 100%);
  opacity: 0.3;
}

.tl-phase { position: relative; margin-bottom: 8px; }
.tl-phase:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -40px; top: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.tl-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tl-phase:hover .tl-dot { transform: scale(1.3); }

.tl-head {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 12px 0;
  user-select: none;
}
.tl-title {
  font-family: 'Patrick Hand SC', cursive;
  font-size: 24px;
  line-height: 1.2;
  transition: opacity 0.2s;
}
.tl-head:hover .tl-title { opacity: 0.8; }
.tl-effort {
  font-size: 12px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-mute);
}
.tl-gain {
  font-size: 13px;
  color: #50b478;
  margin-left: auto;
  white-space: nowrap;
}
.tl-chevron {
  width: 18px; height: 18px;
  stroke: var(--text-mute);
  stroke-width: 2;
  fill: none;
  transition: transform 0.35s var(--ease);
  flex-shrink: 0;
}
.tl-phase.open .tl-chevron { transform: rotate(180deg); }

.tl-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.45s var(--ease), opacity 0.35s var(--ease), padding 0.35s var(--ease);
  padding: 0 0 0 4px;
}
.tl-phase.open .tl-body {
  max-height: 800px;
  opacity: 1;
  padding: 4px 0 20px 4px;
}
.tl-item {
  padding: 8px 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  border-bottom: 1px solid rgba(46,54,64,0.3);
}
.tl-item:last-child { border-bottom: none; }
.tl-sub { color: var(--text-mute); font-size: 14px; }

/* ── Tooltips ── */
[data-tip] {
  position: relative;
  border-bottom: 1px dotted var(--text-mute);
  cursor: help;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--soft-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}
[data-tip]:hover::after { opacity: 1; }

/* ── Scroll Reveal ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal="stagger"] > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}
[data-reveal="stagger"].is-visible > *:nth-child(1) { transition-delay: 0.05s; }
[data-reveal="stagger"].is-visible > *:nth-child(2) { transition-delay: 0.1s; }
[data-reveal="stagger"].is-visible > *:nth-child(3) { transition-delay: 0.15s; }
[data-reveal="stagger"].is-visible > *:nth-child(4) { transition-delay: 0.2s; }
[data-reveal="stagger"].is-visible > *:nth-child(5) { transition-delay: 0.25s; }
[data-reveal="stagger"].is-visible > *:nth-child(6) { transition-delay: 0.3s; }
[data-reveal="stagger"].is-visible > *:nth-child(7) { transition-delay: 0.35s; }
[data-reveal="stagger"].is-visible > *:nth-child(8) { transition-delay: 0.4s; }
[data-reveal="stagger"].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ── Scorecard Bars ── */
.scorecard { display: flex; flex-direction: column; gap: 6px; margin-bottom: 32px; }
.sc-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(46,54,64,0.5); }
.sc-row:last-child { border-bottom: none; }
.sc-label { font-family: 'Patrick Hand SC', cursive; font-size: 18px; min-width: 120px; color: var(--text); }
.sc-bar-track { flex: 1; height: 6px; background: rgba(160,200,240,0.06); border-radius: 3px; overflow: hidden; }
.sc-bar { height: 100%; border-radius: 3px; transition: width 1.2s var(--ease); }
.sc-val { font-family: 'Patrick Hand SC', cursive; font-size: 20px; min-width: 32px; text-align: right; }

/* ── Footer ── */
.report-footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-mute);
  font-style: italic;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal="stagger"] > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .sc-bar { transition: none; }
  .tl-body { transition: none; }
  .tl-chevron { transition: none; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 24px 20px 60px;
  }
  .side-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    padding: 12px 0;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
    max-height: none;
  }
  .side-nav a {
    border-left: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
  }
  .side-nav a.active {
    background: rgba(143,179,212,0.1);
    border-left: none;
  }
  h1 { font-size: 36px; }
  h2 { font-size: 26px; }
  .findings { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  h1 { font-size: 28px; }
  .metric-cards { grid-template-columns: 1fr; }
}
