/* ============================================
   临床预测建模工具 v3.0 SCI增强版
   Professional SCI Journal Style
   Dark Theme (default) / Light Theme (.light)
   ============================================ */

/* ========== CSS Variables ========== */
:root {
  --bg: #0a0e1a;
  --card: #111827;
  --card2: #161b25;
  --bdr: rgba(255, 255, 255, 0.06);
  --ac: #00D9FF;
  --gr: #10B981;
  --tx: #e0e0e0;
  --sub: #8890a8;
  --wr: #F59E0B;
  --pp: #8B5CF6;
  --rd: #EF4444;

  --radius: 6px;
  --radius-lg: 10px;
  --radius-sm: 4px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
}

html.light {
  --bg: #f3f4f6;
  --card: #ffffff;
  --card2: #f9fafb;
  --bdr: rgba(0, 0, 0, 0.08);
  --tx: #1f2937;
  --sub: #6b7280;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ========== Global Reset ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  transition: background 0.3s, color 0.3s;
}

a {
  color: var(--ac);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

html.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.28);
}

/* ========== Layout ========== */
.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  background: var(--card);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px;
}

/* ========== Toolbar ========== */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
}

.toolbar .brand {
  font-size: 16px;
  font-weight: 800;
  color: var(--ac);
  letter-spacing: -0.3px;
  margin-right: auto;
  user-select: none;
}

.toolbar .brand span {
  font-weight: 400;
  font-size: 11px;
  color: var(--sub);
  margin-left: 6px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  background: var(--card2);
  color: var(--tx);
  outline: none;
  font-family: inherit;
}

.btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-ac {
  background: var(--ac);
  color: #0a0e1a;
  border-color: var(--ac);
}

.btn-ac:hover {
  box-shadow: 0 0 16px rgba(0, 217, 255, 0.3);
}

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

.btn-gr:hover {
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
}

.btn-out {
  background: transparent;
  border-color: var(--bdr);
  color: var(--tx);
}

.btn-out:hover {
  border-color: var(--ac);
  color: var(--ac);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: var(--rd);
  color: #fff;
  border-color: var(--rd);
}

.btn-danger:hover {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========== Panel ========== */
.panel {
  background: var(--card);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.panel:hover {
  border-color: rgba(0, 217, 255, 0.15);
}

.panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ac);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--ac);
  border-radius: 2px;
}

/* ========== Forms ========== */
.fg {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  user-select: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--tx);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: var(--sub);
  opacity: 0.6;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

input[type="range"] {
  padding: 0;
  height: 6px;
  cursor: pointer;
  accent-color: var(--ac);
}

input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ac);
  cursor: pointer;
}

/* ========== Grid Layouts ========== */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ========== Stat Cards ========== */
.scard {
  background: rgba(0, 217, 255, 0.06);
  border: 1px solid rgba(0, 217, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: all var(--transition);
}

.scard:hover {
  background: rgba(0, 217, 255, 0.1);
  border-color: rgba(0, 217, 255, 0.2);
}

.scard .v {
  font-size: 18px;
  font-weight: 700;
  color: var(--ac);
  line-height: 1.2;
}

.scard .l {
  font-size: 10px;
  font-weight: 500;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}

/* SCard variants */
.scard.gr {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.12);
}

.scard.gr .v {
  color: var(--gr);
}

.scard.gr:hover {
  background: rgba(16, 185, 129, 0.1);
}

.scard.wr {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.12);
}

.scard.wr .v {
  color: var(--wr);
}

.scard.wr:hover {
  background: rgba(245, 158, 11, 0.1);
}

.scard.rd {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.12);
}

.scard.rd .v {
  color: var(--rd);
}

.scard.rd:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ========== Chart Container ========== */
.chart-box {
  width: 100%;
  height: 340px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ========== SCI Three-Line Table ========== */
.three-line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}

.three-line-table thead {
  border-top: 1.5px solid var(--tx);
  border-bottom: 0.75px solid var(--tx);
}

.three-line-table tbody {
  border-bottom: 1.5px solid var(--tx);
}

.three-line-table th,
.three-line-table td {
  padding: 8px 10px;
  text-align: center;
  border: none;
}

.three-line-table th {
  font-weight: 700;
  font-size: 11px;
  color: var(--ac);
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.three-line-table td {
  color: var(--tx);
}

.three-line-table tbody tr:hover {
  background: rgba(0, 217, 255, 0.03);
}

/* ========== Navigation ========== */
.nav {
  list-style: none;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sub);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  user-select: none;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(0, 217, 255, 0.04);
  color: var(--tx);
}

.nav-item.active {
  color: var(--ac);
  background: rgba(0, 217, 255, 0.06);
  border-left-color: var(--ac);
  font-weight: 600;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Sidebar header */
.sidebar .brand {
  padding: 16px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ac);
  border-bottom: 1px solid var(--bdr);
  letter-spacing: -0.3px;
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  background: rgba(0, 217, 255, 0.08);
  color: var(--ac);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--bdr);
}

td {
  padding: 9px 12px;
  text-align: center;
  color: var(--tx);
  border-bottom: 1px solid var(--bdr);
}

tr:hover td {
  background: rgba(0, 217, 255, 0.025);
}

/* Compact table variant */
.table-sm th,
.table-sm td {
  padding: 6px 8px;
  font-size: 11px;
}

/* ========== Special Components ========== */

/* Privacy Banner */
.privacy-banner {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--rd);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.privacy-banner::before {
  content: '\26A0';
  font-size: 16px;
  flex-shrink: 0;
}

.privacy-banner .privacy-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.privacy-banner .privacy-text {
  color: var(--sub);
  font-size: 11px;
  line-height: 1.4;
}

/* Risk Calculator Box */
.risk-box {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.risk-box .risk-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gr);
  line-height: 1.2;
}

.risk-box .risk-label {
  font-size: 11px;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.risk-box .risk-detail {
  font-size: 11px;
  color: var(--tx);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(16, 185, 129, 0.15);
}

/* Nomogram Container */
.nomo-box {
  background: var(--card);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-x: auto;
  text-align: center;
}

.nomo-box canvas {
  max-width: 100%;
  height: auto;
}

/* Predictor Row */
.predictor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card2);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: border-color var(--transition);
}

.predictor-row:hover {
  border-color: rgba(0, 217, 255, 0.15);
}

.predictor-row .predictor-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--ac);
  min-width: 100px;
}

.predictor-row .predictor-value {
  font-size: 13px;
  color: var(--tx);
  font-variant-numeric: tabular-nums;
}

.predictor-row .predictor-unit {
  font-size: 10px;
  color: var(--sub);
}

/* Model Comparison */
.model-compare {
  overflow-x: auto;
}

.model-compare table {
  font-size: 11px;
}

.model-compare .best {
  color: var(--gr);
  font-weight: 700;
}

.model-compare .best::after {
  content: ' \2605';
  font-size: 10px;
}

/* SHAP Plot Container */
.shap-plot {
  width: 100%;
  min-height: 300px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

/* Feature Importance Container */
.feature-importance {
  width: 100%;
  min-height: 260px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  padding: 12px;
}

.feature-importance .fi-bar {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.feature-importance .fi-label {
  font-size: 11px;
  min-width: 100px;
  text-align: right;
  color: var(--sub);
}

.feature-importance .fi-track {
  flex: 1;
  height: 18px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
}

.feature-importance .fi-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ac), var(--pp));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.feature-importance .fi-score {
  font-size: 10px;
  font-weight: 600;
  color: var(--ac);
  min-width: 36px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--ac);
  color: #0a0e1a;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.gr {
  background: var(--gr);
  color: #fff;
}

.badge.rd {
  background: var(--rd);
  color: #fff;
}

.badge.wr {
  background: var(--wr);
  color: #0a0e1a;
}

.badge-pp {
  background: var(--pp);
  color: #fff;
}

/* Tab Container */
.tab-container {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bdr);
  margin-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  user-select: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.tab:hover {
  color: var(--tx);
}

.tab.active {
  color: var(--ac);
  border-bottom-color: var(--ac);
}

/* ========== Modal / Overlay ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--card);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.25s ease;
}

.modal h2 {
  font-size: 16px;
  color: var(--ac);
  margin-bottom: 16px;
}

.modal .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--card2);
  color: var(--sub);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
}

.modal .modal-close:hover {
  background: var(--rd);
  color: #fff;
}

.modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bdr);
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  box-shadow: var(--shadow);
  z-index: 2000;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-left: 3px solid var(--gr);
}

.toast.error {
  border-left: 3px solid var(--rd);
}

.toast.warning {
  border-left: 3px solid var(--wr);
}

.toast.info {
  border-left: 3px solid var(--ac);
}

/* ========== Empty State ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--sub);
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state .empty-text {
  font-size: 13px;
  font-weight: 500;
}

.empty-state .empty-hint {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.6;
}

/* ========== Download Button ========== */
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  background: var(--card2);
  color: var(--ac);
  border: 1px solid var(--bdr);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.dl-btn:hover {
  background: rgba(0, 217, 255, 0.08);
  border-color: var(--ac);
}

/* ========== Status Dot ========== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--gr);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-dot.offline {
  background: var(--sub);
}

.status-dot.warning {
  background: var(--wr);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.status-dot.error {
  background: var(--rd);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* ========== Progress Bar ========== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--card2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ac), var(--pp));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-bar.gr .progress-fill {
  background: linear-gradient(90deg, var(--gr), #34d399);
}

.progress-bar.wr .progress-fill {
  background: linear-gradient(90deg, var(--wr), #fbbf24);
}

/* ========== Text Utilities ========== */
.highlight {
  color: var(--ac);
  font-weight: 600;
}

.text-muted {
  color: var(--sub);
}

.text-success {
  color: var(--gr);
}

.text-danger {
  color: var(--rd);
}

.text-warning {
  color: var(--wr);
}

.text-purple {
  color: var(--pp);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.text-sm {
  font-size: 11px;
}

.text-xs {
  font-size: 10px;
}

.text-lg {
  font-size: 16px;
}

.text-xl {
  font-size: 20px;
}

.font-bold {
  font-weight: 700;
}

.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-variant-numeric: tabular-nums;
}

/* ========== Utility Layout ========== */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.gap-4 {
  gap: 4px;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-10 {
  gap: 10px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.mt-4 {
  margin-top: 4px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 4px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.w-full {
  width: 100%;
}

/* ========== Separator / Divider ========== */
.divider {
  width: 100%;
  height: 1px;
  background: var(--bdr);
  margin: 12px 0;
}

/* ========== Tooltip ========== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--tx);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bdr);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 500;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ========== Loading Spinner ========== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bdr);
  border-top-color: var(--ac);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

/* ========== Animations ========== */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .grid2,
  .grid3,
  .grid4 {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 12px;
  }

  .toolbar {
    padding: 8px 12px;
    gap: 6px;
  }

  .toolbar .brand {
    font-size: 14px;
  }

  .panel {
    padding: 12px;
  }

  .modal {
    width: 95%;
    padding: 16px;
    max-height: 90vh;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .predictor-row {
    flex-wrap: wrap;
  }
}

/* ========== Print Styles ========== */
@media print {
  .toolbar,
  .sidebar,
  .btn,
  .modal-overlay,
  .toast,
  .nav,
  .tab-container {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    display: block;
  }

  .main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .panel,
  .chart-box,
  .shap-plot,
  .feature-importance,
  .nomo-box,
  .risk-box {
    border: 1px solid #ccc !important;
    background: #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .three-line-table {
    font-size: 10pt;
  }

  .three-line-table thead {
    border-top: 1.5pt solid #000;
    border-bottom: 0.75pt solid #000;
  }

  .three-line-table tbody {
    border-bottom: 1.5pt solid #000;
  }

  .three-line-table th {
    color: #000 !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }
}