/* ═══════════════════════════════════════════════════════════════════════════
   components.css — Card, KPI, Table, Tag, Button, Tab Bar, Modal, Form
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 7.1 Card ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  transition: all 0.3s;
}
.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.card-gold-border { border-left: 3px solid var(--gold); }

/* ─── 7.2 KPI Card ──────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.kpi-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.kpi-icon  { font-size: 1.3rem; margin-bottom: 10px; }
.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-bottom: 4px;
}
.kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.kpi-bar {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 3px;
}

/* ─── 7.3 Data Table ────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(199,160,42,0.25);
  padding: 10px 14px;
  text-align: left;
}
.data-table td {
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.data-table tr:hover td { background: var(--bg-card-hover); }

/* ─── 7.4 Tag ───────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.tag-gold    { background: rgba(199,160,42,0.15); color: var(--gold); }
.tag-green   { background: rgba(56,161,105,0.15); color: var(--accent-green); }
.tag-red     { background: rgba(229,62,62,0.15);  color: var(--accent-red); }
.tag-purple  { background: var(--accent-purple-soft); color: var(--accent-purple); }
.tag-muted   { background: rgba(160,174,192,0.12); color: var(--text-muted); }

/* ─── 7.5 Button ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  letter-spacing: 0.5px;
}
.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(199,160,42,0.35);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

/* ─── 7.6 Tab Bar ───────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
}
.tab-item {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
}
.tab-item:hover { color: var(--text); }
.tab-item.active {
  background: var(--gold);
  color: #fff;
}

/* ─── 7.7 Form ──────────────────────────────────────────────────────────── */
.form-select, .form-input {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
}
.form-select:focus, .form-input:focus {
  border-color: var(--gold);
  outline: none;
}

/* ─── 7.8 Range Slider ──────────────────────────────────────────────────── */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--bg-card);
  box-shadow: 0 2px 8px rgba(199,160,42,0.4);
  cursor: pointer;
}

/* ─── 7.9 Confidence/Progress Bar ───────────────────────────────────────── */
.confidence-bar  {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.confidence-fill {
  height: 100%;
  background: linear-gradient(to right, var(--gold-dark), var(--gold-light));
  transition: width 0.6s ease;
}

/* ─── 7.10 Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalSlideUp 0.3s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
}
.modal-close {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 28px 32px;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.modal-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 12px 0;
}
.modal-body h1, .modal-body h2, .modal-body h3 {
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 8px;
}
.modal-body h1 { font-size: 1.3rem; }
.modal-body h2 { font-size: 1.1rem; }
.modal-body h3 { font-size: 0.95rem; }

/* ─── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 0.9rem;
}
