/* ==========================================================================
   SynthLens — AI Image Detection Web Interface
   Design System & Styling (Deep Modern Dark Theme)
   ========================================================================== */

:root {
  /* Color Palette — Sleek Modern Dark Mode */
  --bg-app: #080d18;
  --bg-sidebar: #0f172a;
  --bg-card: #131c31;
  --bg-card-subtle: #18223c;
  --border-color: #22304f;
  --border-focus: #60a5fa;

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  /* Brand Accents */
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.18);

  /* Verdict Colors — Dark Tuned */
  --real-bg-start: rgba(6, 78, 59, 0.45);
  --real-bg-end: rgba(6, 95, 70, 0.2);
  --real-border: #10b981;
  --real-badge: #059669;
  --real-text: #6ee7b7;
  --real-sub: #a7f3d0;

  --ai-bg-start: rgba(127, 29, 29, 0.45);
  --ai-bg-end: rgba(153, 27, 27, 0.2);
  --ai-border: #ef4444;
  --ai-badge: #dc2626;
  --ai-text: #fca5a5;
  --ai-sub: #fecaca;

  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: #f59e0b;
  --warning-text: #fde68a;

  /* Layout */
  --sidebar-width: 320px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadow Elevation */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Mobile Navbar (Hidden on Desktop) */
.mobile-navbar {
  display: none;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 18px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-main);
}

.sidebar-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-sub);
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   Streamlit-Style Dark Sidebar
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar-content {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-brand .brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo {
  font-size: 1.6rem;
}

.sidebar-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.sidebar-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-divider {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Status Widget */
.status-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-indicator-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #64748b;
  display: inline-block;
  transition: background-color 0.3s ease;
}

.status-dot.connected {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.status-dot.standalone {
  background-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

.status-dot.offline {
  background-color: #ef4444;
}

.status-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.btn-text-subtle {
  background: none;
  border: none;
  font-size: 0.76rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  padding: 2px 4px;
}

.btn-text-subtle:hover {
  text-decoration: underline;
}

/* Sidebar Section Headers */
.sidebar-heading {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.section-title-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-mini {
  background-color: #1e293b;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  border: 1px solid var(--border-color);
}

/* Metadata List */
.meta-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 5px 0;
  border-bottom: 1px dotted var(--border-color);
}

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

.meta-val {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
  font-size: 0.8rem;
}

.meta-val.highlight {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Benchmark Grid */
.benchmark-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.benchmark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.benchmark-metric {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}

.benchmark-metric .b-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #60a5fa;
  font-family: 'JetBrains Mono', monospace;
}

.benchmark-metric .b-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Mini Benchmark Table */
.mini-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  text-align: left;
}

.mini-table th {
  background: #18223c;
  color: var(--text-muted);
  padding: 6px 8px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.mini-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #1a2540;
  color: var(--text-sub);
}

.mini-table .table-total {
  background: #18223c;
  font-weight: 700;
  color: #ffffff;
}

/* Formats Section */
.format-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.format-tag {
  background: #1e293b;
  color: #93c5fd;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.format-limit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Author Credits */
.sidebar-footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.author-credits span {
  display: block;
}

.author-credits strong {
  color: #ffffff;
  font-size: 0.95rem;
}

.author-github-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #60a5fa;
  text-decoration: none;
  font-size: 0.8rem;
  margin-top: 4px;
  font-weight: 500;
}

.author-github-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
  background-color: var(--bg-app);
}

.content-container {
  max-width: 960px;
  margin: 0 auto;
}

/* Top Hero Header */
.app-header {
  margin-bottom: 28px;
}

.main-header {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.25;
}

.sub-header {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.content-divider {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: 30px 0;
}

/* ==========================================================================
   Tabs Component (Upload vs Sample)
   ========================================================================== */
.tab-interface {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 24px;
}

.tab-buttons {
  display: flex;
  background: #0d1527;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 14px 18px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: #60a5fa;
  background: var(--bg-card);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
  padding: 24px;
}

.tab-panel.active {
  display: block;
}

/* Drag & Drop Zone */
.dropzone {
  border: 2px dashed #2a3d66;
  border-radius: var(--radius-md);
  padding: 38px 24px;
  text-align: center;
  cursor: pointer;
  background: #0d1527;
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.file-input-hidden {
  display: none;
}

.dropzone-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #18243e;
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  transition: transform 0.2s ease;
  border: 1px solid var(--border-color);
}

.dropzone:hover .dropzone-icon-circle {
  transform: translateY(-2px);
  background: #1e3158;
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.highlight-browse {
  color: #60a5fa;
  text-decoration: underline;
}

.dropzone-hint {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Sample Images Cards */
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.sample-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sample-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: #0d1527;
  transition: all 0.2s ease;
}

.sample-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.sample-card.active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.sample-card-img-wrap {
  position: relative;
  height: 140px;
  background: #050811;
}

.sample-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sample-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  color: #ffffff;
  text-transform: uppercase;
}

.sample-badge.real {
  background-color: var(--real-badge);
}

.sample-badge.ai {
  background-color: var(--ai-badge);
}

.sample-card-meta {
  padding: 10px 12px;
}

.sample-card-meta strong {
  display: block;
  font-size: 0.88rem;
  color: #ffffff;
}

.sample-card-meta span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Image Staging & Controls Columns
   ========================================================================== */
.inspection-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.image-meta-pill, .badge-subtle {
  font-size: 0.72rem;
  font-weight: 600;
  background: #1a2540;
  color: #93c5fd;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border-color);
}

/* Preview Image Frame */
.image-preview-frame {
  width: 100%;
  height: 260px;
  background: #050811;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.image-preview-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-caption {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* Controls Column */
.controls-desc {
  font-size: 0.88rem;
  color: var(--text-sub);
  margin-bottom: 20px;
  line-height: 1.45;
}

.control-group {
  margin-bottom: 22px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.control-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.info-tooltip {
  cursor: help;
  font-size: 0.85rem;
  opacity: 0.8;
}

.slider-value-display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.05rem;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.18);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Range Slider Styling */
.slider-track-wrap input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 5px;
  background: #1e293b;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.slider-track-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
  transition: transform 0.15s ease;
}

.slider-track-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.tick-optimal {
  color: #60a5fa;
  font-weight: 700;
}

/* Action Button */
.btn-primary-action {
  width: 100%;
  padding: 13px 20px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  transition: all 0.2s ease;
  position: relative;
}

.btn-primary-action:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-primary-action:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.spinner-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.engine-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Prediction Results Section
   ========================================================================== */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
}

.timestamp-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Result Card Banner */
.pred-card {
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 22px;
  transition: all 0.3s ease;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Real Card Theme */
.pred-card.real-theme {
  background: linear-gradient(135deg, var(--real-bg-start) 0%, var(--real-bg-end) 100%);
  border: 2px solid var(--real-border);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
}

.pred-card.real-theme .badge-verdict {
  background-color: var(--real-badge);
}

.pred-card.real-theme .pred-probability-line {
  color: var(--real-text);
}

.pred-card.real-theme .pred-explanation {
  color: var(--real-sub);
}

/* AI Card Theme */
.pred-card.ai-theme {
  background: linear-gradient(135deg, var(--ai-bg-start) 0%, var(--ai-bg-end) 100%);
  border: 2px solid var(--ai-border);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
}

.pred-card.ai-theme .badge-verdict {
  background-color: var(--ai-badge);
}

.pred-card.ai-theme .pred-probability-line {
  color: var(--ai-text);
}

.pred-card.ai-theme .pred-explanation {
  color: var(--ai-sub);
}

.badge-verdict {
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1.25rem;
  display: inline-block;
  letter-spacing: 0.02em;
}

.pred-probability-line {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 12px;
}

.pred-explanation {
  margin-top: 5px;
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  display: block;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* AI Probability Spectrum Progress Bar */
.spectrum-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 28px;
}

.spectrum-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.spectrum-coords {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-weight: 600;
}

.spectrum-track {
  position: relative;
  height: 18px;
  background: #0f172a;
  border-radius: 9px;
  overflow: visible;
  border: 1px solid var(--border-color);
}

.spectrum-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 60%, #ef4444 100%);
  border-radius: 9px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.spectrum-threshold-marker {
  position: absolute;
  top: -8px;
  left: 80%; /* Active threshold */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transition: left 0.3s ease;
}

.marker-needle {
  width: 3px;
  height: 34px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.marker-tag {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #38bdf8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.spectrum-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 14px;
}

.marker-opt-text {
  font-weight: 700;
  color: #60a5fa;
}

/* ==========================================================================
   Forensic Feature Inspection Maps
   ========================================================================== */
.forensics-container {
  margin-bottom: 28px;
}

.forensics-title-wrap {
  margin-bottom: 16px;
}

.forensics-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.forensics-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
}

.forensic-maps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.forensic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.forensic-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.forensic-badge {
  background: #1e293b;
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  border: 1px solid var(--border-color);
}

.forensic-card-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.forensic-canvas-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #050811;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
}

.forensic-canvas-frame canvas {
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.forensic-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: auto;
}

/* Attention Fusion Card */
.attention-weights-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.attention-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.attention-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 16px;
  line-height: 1.4;
}

.attention-bars-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.attn-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.attn-name {
  font-weight: 600;
  color: #ffffff;
}

.attn-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #60a5fa;
}

.attn-bar-track {
  height: 10px;
  background: #0d1527;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.attn-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.attn-bar-fill.spatial {
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

.attn-bar-fill.color {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.attn-bar-fill.freq {
  background: #8b5cf6;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

/* ==========================================================================
   Methodology Accordion & Disclaimer
   ========================================================================== */
.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.accordion-header {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  background: var(--bg-card);
}

.accordion-header:hover {
  background: #18223c;
}

.accordion-content {
  padding: 0 20px 20px 20px;
  font-size: 0.88rem;
  color: var(--text-sub);
  line-height: 1.6;
}

.accordion-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 10px 0 6px;
}

.tech-steps-list {
  padding-left: 20px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tech-steps-list code {
  background: #0d1527;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #60a5fa;
  border: 1px solid var(--border-color);
}

.ascii-architecture-wrap {
  background: #050811;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.ascii-architecture {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: #38bdf8;
  line-height: 1.25;
}

/* Forensic Disclaimer Box */
.disclaimer-box {
  background-color: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
  padding: 14px 18px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--warning-text);
  margin-top: 25px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.disclaimer-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ==========================================================================
   API Config Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 17, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 22px;
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--text-sub);
  margin-bottom: 16px;
  line-height: 1.45;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  background: #0d1527;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: 'JetBrains Mono', monospace;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-status-box {
  background: #0d1527;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-sub);
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  background: #0d1527;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-subtle {
  padding: 8px 16px;
  background: #18223c;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.btn-subtle:hover {
  background: #1e2c4d;
  color: #ffffff;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 992px) {
  .inspection-columns {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .forensic-maps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .mobile-navbar {
    display: flex;
  }

  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    left: 0;
  }

  .main-content {
    padding: 20px 16px;
  }

  .sample-cards-grid {
    grid-template-columns: 1fr;
  }
}
