/* ============================================================
   SAVINA ONE PACS MedCalc – styles.css
   ============================================================ */

/* === Design by Lưu Phan Thanh === */
:root {
  --bg: #f3f9fb;
  --bg-soft: linear-gradient(180deg, #e9f7f7 0%, #f7fbfc 100%);
  --surface: #ffffff;
  --surface-2: #f7fbfc;
  --surface-3: #edf6f8;
  --border: #d7e6ea;
  --border-strong: #b8d4d9;
  --text: #17343b;
  --muted: #6b8790;
  --primary: #0d8b8b;
  --primary-2: #0b6d73;
  --primary-soft: #dff4f2;
  --blue: #15678a;
  --blue-soft: #e4f1f8;
  --success: #1f9c73;
  --success-soft: #e5f8ef;
  --danger: #b94f4f;
  --danger-soft: #fdeeee;
  --shadow-sm: 0 4px 14px rgba(18, 53, 64, 0.06);
  --shadow-md: 0 18px 40px rgba(18, 53, 64, 0.10);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --container: 1160px;
  --transition: 180ms ease;
}

html[data-theme="dark"] {
  --bg: #0c171b;
  --bg-soft: linear-gradient(180deg, #102127 0%, #0c171b 100%);
  --surface: #122127;
  --surface-2: #16272f;
  --surface-3: #1b3139;
  --border: #26424c;
  --border-strong: #355c67;
  --text: #e6f2f5;
  --muted: #9db9c1;
  --primary: #57c4c4;
  --primary-2: #82d8d8;
  --primary-soft: rgba(87, 196, 196, 0.12);
  --blue: #67b2d8;
  --blue-soft: rgba(103, 178, 216, 0.12);
  --success: #6edeaa;
  --success-soft: rgba(110, 222, 170, 0.12);
  --danger: #ff8f8f;
  --danger-soft: rgba(255, 143, 143, 0.12);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 40px rgba(0, 0, 0, 0.30);
}

/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input {
  font: inherit;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* === Layout === */
.container {
  width: min(var(--container), calc(100% - 28px));
  margin: 0 auto;
}

.page-shell {
  padding: 22px 0 42px;
}

/* === Hero (đã gộp, dùng grid thay flex) === */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 24px;
  margin-bottom: 20px;
  border-radius: var(--radius-xl);
  color: #f7ffff;
  background: linear-gradient(135deg, #0d8b8b 0%, #17a0a3 55%, #63c2c4 100%);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero--blue {
  background: linear-gradient(135deg, #0f6f87 0%, #196b93 55%, #64a9ca 100%);
}

.hero::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 72%);
  pointer-events: none;
}

.hero__left,
.hero__right {
  position: relative;
  z-index: 1;
}

/* 2×2 grid: hàng trên 3 link, hàng dưới toggle */
.hero__right {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  align-items: start;
  justify-content: end;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(247,255,255,0.9);
}

/* === Hero buttons (đã gộp thành 1 khai báo) === */
.hero__link,
.theme-toggle {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.14);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
  text-decoration: none;
}

.hero__link:hover,
.theme-toggle:hover {
  background: rgba(255,255,255,0.24);
}

.hero__link .material-symbols-outlined,
.theme-toggle .material-symbols-outlined {
  font-size: 16px;
}

/* === Eyebrow === */
.eyebrow {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* === Brand === */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand__logo {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.16);
  color: #ffffff;
}

.brand__logo svg {
  width: 34px;
  height: 34px;
}

/* Logo PNG (footer và header dùng ảnh thật) */
.brand__logo--img {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 2px;
}

.brand__text {
  display: grid;
  gap: 2px;
}

.brand__text strong {
  font-size: 16px;
}

.brand__text small {
  font-size: 12px;
  color: rgba(255,255,255,0.84);
}

.brand--footer {
  margin-bottom: 10px;
  color: var(--text);
}

.brand--footer .brand__logo {
  background: var(--primary-soft);
  border-color: rgba(13,139,139,0.18);
  color: var(--primary-2);
}

.brand--footer .brand__text small {
  color: var(--muted);
}

/* === Main grid === */
.main-grid {
  display: grid;
  gap: 20px;
}

/* === Card section === */
.card-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-soft);
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--text);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* === Buttons === */
.btn {
  min-height: 46px;
  border-radius: 12px;
  padding: 11px 16px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-2);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* === Modality grid (đã gộp fix màu vào đây) === */
.modality-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.modality-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  min-height: 94px;
}

.modality-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

.modality-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface);
}

.modality-card.active {
  background: linear-gradient(180deg, var(--surface) 0%, var(--primary-soft) 100%);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow: 0 10px 20px rgba(13,139,139,0.12);
}

.modality-card.active::before {
  background: var(--primary);
}

.modality-code {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  align-items: center;
  height: 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.modality-card.active .modality-code {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.modality-name {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.modality-card.active .modality-name {
  color: var(--primary-2);
}

.modality-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* === Config grid === */
.config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.config-col {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.field + .field {
  margin-top: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 12px 56px 12px 14px;
  outline: none;
  transition: var(--transition);
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13,139,139,0.12);
}

.unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* === Info / Error boxes === */
.info-box,
.error-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.info-box {
  background: var(--primary-soft);
  color: var(--primary-2);
  border: 1px solid rgba(13,139,139,0.18);
}

.error-box {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(185,79,79,0.18);
}

.error-box.show {
  display: block;
}

/* === Results === */
.result-grid,
.summary-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card,
.summary-card,
.chart-card,
.feature-card,
.list-card,
.stat-box {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.metric-card {
  padding: 16px;
}

.metric-card h3,
.chart-card h3,
.list-card h3,
.footer-col h4 {
  margin: 0 0 14px;
  font-size: 16px;
}

.metric-list {
  display: grid;
  gap: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.metric-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metric-row span {
  color: var(--muted);
  font-size: 13px;
}

.metric-row strong {
  color: var(--primary-2);
  font-size: 18px;
}

.summary-card {
  padding: 18px;
}

.summary-card--success {
  background: linear-gradient(135deg, var(--success-soft) 0%, var(--surface) 100%);
}

.summary-card--primary {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 100%);
}

.summary-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
}

.summary-card--success strong {
  color: var(--success);
}

.summary-card--primary strong {
  color: var(--primary-2);
}

/* === Projection / Chart === */
.projection-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.chart-card {
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.chart-box {
  min-height: 320px;
  padding-top: 8px;
}

.projection-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.projection-item {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.projection-item:first-child {
  background: linear-gradient(180deg, var(--surface) 0%, var(--primary-soft) 100%);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.projection-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.projection-item strong {
  color: var(--primary-2);
  font-size: 16px;
}

/* === Info layout (2 cột nội dung + stats) === */
.info-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 18px;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
}

/* === Feature cards === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.feature-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  padding: 14px;
  display: flex;
  gap: 12px;
}

.feature-card .material-symbols-outlined {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-2);
}

.feature-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* === Stats stack === */
.stats-stack {
  display: grid;
  gap: 14px;
}

.stat-box {
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-box strong {
  display: block;
  font-size: 38px;
  line-height: 1;
  color: var(--primary-2);
  margin-bottom: 8px;
}

.stat-box span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* === Two col === */
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.list-card {
  padding: 18px;
}

.list-card--warn {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--danger-soft) 100%);
}
.list-card--warn h3 {
  color: var(--danger);
}
.clean-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

/* === Footer === */
.site-footer {
  margin-top: 20px;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.9fr;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.footer-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.footer-list li,
.footer-list a {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  transition: color var(--transition);
}

.footer-links a:hover,
.footer-list a:hover {
  color: var(--primary-2);
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.socials a {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--primary-2);
  transition: var(--transition);
}

.socials a:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.footer-bottom {
  padding-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* === Compression table === */
.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.comp-table th {
  padding: 12px 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  text-align: left;
  font-weight: 700;
  color: var(--primary-2);
}

.comp-table td {
  padding: 11px 14px;
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.comp-table tr:nth-child(even) td {
  background: var(--surface-2);
}

.comp-table tr:hover td {
  background: var(--primary-soft);
}

/* === Responsive === */
@media (max-width: 1100px) {
  .modality-grid,
  .config-grid,
  .feature-grid--3,
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projection-layout,
  .info-layout,
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .page-shell {
    padding-top: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .hero__right {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .hero__link,
  .theme-toggle,
  .section-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .card-section,
  .site-footer {
    padding: 18px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-actions {
    width: 100%;
  }

  .modality-grid,
  .config-grid,
  .result-grid,
  .summary-grid,
  .projection-list,
  .feature-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .chart-box {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  .comp-table { font-size: 12px; }
  .comp-table th,
  .comp-table td { padding: 8px 10px; }
}

@media (max-width: 400px) {
  .hero__right {
    grid-template-columns: 1fr;
  }
}
/* === Danh sách lỗi thường gặp === */
.mistake-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.mistake-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.mistake-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.mistake-x {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
  font-weight: 900;
  margin-top: 2px;
  line-height: 1;
  user-select: none;
}

.mistake-list strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
  color: var(--text);
}

.mistake-list p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 100%;
}

/* stats-stack sticky khi scroll dài */
.stats-stack {
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 20px;
}