/* ==========================================================================
   VisionX 2.0 — "Obsidian Intel" Design System
   ========================================================================== */

/* ---- Design Tokens ---- */
:root {
  /* Surfaces */
  --bg-void:       #04040a;
  --bg-base:       #08081a;
  --bg-surface:    #0c0c22;
  --bg-elevated:   #10102a;
  --bg-card:       rgba(14, 14, 34, 0.65);
  --bg-card-hover: rgba(18, 18, 44, 0.8);
  --bg-glass:      rgba(255, 255, 255, 0.03);
  --bg-glass-2:    rgba(255, 255, 255, 0.06);
  --bg-glass-3:    rgba(255, 255, 255, 0.09);

  /* Accents */
  --violet:       #8b5cf6;
  --violet-dim:   rgba(139, 92, 246, 0.12);
  --violet-glow:  rgba(139, 92, 246, 0.25);
  --cyan:         #06b6d4;
  --cyan-dim:     rgba(6, 182, 212, 0.12);
  --cyan-glow:    rgba(6, 182, 212, 0.25);
  --emerald:      #10b981;
  --emerald-dim:  rgba(16, 185, 129, 0.12);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245, 158, 11, 0.12);
  --rose:         #f43f5e;
  --rose-dim:     rgba(244, 63, 94, 0.12);

  --gradient-main: linear-gradient(135deg, var(--violet), var(--cyan));
  --gradient-rev:  linear-gradient(135deg, var(--cyan), var(--violet));

  /* Text */
  --text-1: #f0f0f8;
  --text-2: #a0a0c0;
  --text-3: #606080;
  --text-accent: #a78bfa;

  /* Borders */
  --border-1: rgba(139, 92, 246, 0.1);
  --border-2: rgba(139, 92, 246, 0.2);
  --border-3: rgba(139, 92, 246, 0.35);

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.12);
  --shadow-glow-c: 0 0 30px rgba(6, 182, 212, 0.12);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 100px;

  /* Timing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.15s var(--ease);
  --t-normal: 0.25s var(--ease);
  --t-slow: 0.4s var(--ease);

  /* Fonts */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

  /* Layout */
  --sidebar-w: 280px;
  --topbar-h: 52px;
  --statusbar-h: 28px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-void);
  color: var(--text-1);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); }

/* ---- Background Canvas ---- */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---- App Shell (Sidebar + Main) ---- */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  border-right: 1px solid var(--border-1);
  transition: transform var(--t-normal), opacity var(--t-normal);
  z-index: 10;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  min-width: 0;
  width: 0;
  overflow: hidden;
  opacity: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-accent {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-version {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: var(--violet-dim);
  color: var(--violet);
  vertical-align: super;
  -webkit-text-fill-color: var(--violet);
}

.sidebar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--t-fast);
}
.sidebar-close-btn:hover { background: var(--bg-glass-2); color: var(--text-1); }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

/* Sidebar sections */
.sidebar-section { padding: 0 14px; margin-bottom: 20px; }

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

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.sidebar-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  background: var(--violet-dim);
  border: 1px solid var(--border-2);
  color: var(--violet);
  cursor: pointer;
  transition: var(--t-fast);
}
.sidebar-add-btn:hover { background: var(--violet-glow); border-color: var(--violet); }

/* File queue */
.file-queue {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.file-queue-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--text-3);
  font-size: 0.78rem;
}

.file-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--t-fast);
  position: relative;
}
.file-queue-item:hover { background: var(--bg-glass-2); }
.file-queue-item.active { background: var(--violet-dim); border: 1px solid var(--border-2); }

.fq-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass-2);
  color: var(--violet);
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
}

.fq-info { flex: 1; min-width: 0; }
.fq-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.fq-meta {
  font-size: 0.65rem;
  color: var(--text-3);
}

.fq-status {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.fq-status-done { color: var(--emerald); }
.fq-status-scanning { color: var(--cyan); animation: pulse 1.5s ease-in-out infinite; }
.fq-status-queued { color: var(--text-3); }

.fq-remove {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: var(--r-xs);
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--t-fast);
}
.file-queue-item:hover .fq-remove { display: flex; }
.fq-remove:hover { background: var(--rose-dim); color: var(--rose); }

/* Settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.setting-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.setting-control {
  flex: 1;
  max-width: 140px;
  padding: 6px 10px;
  border-radius: var(--r-xs);
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 0.76rem;
  outline: none;
  transition: var(--t-fast);
  appearance: none;
}
.setting-control:focus { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(139,92,246,0.15); }

select.setting-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23606080' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}
select.setting-control option { background: #0c0c22; color: var(--text-1); }

.key-input-wrap {
  display: flex;
  gap: 4px;
  flex: 1;
  max-width: 140px;
}
.key-input-wrap .setting-control { max-width: unset; flex: 1; font-size: 0.72rem; }
.key-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  color: var(--text-3);
  cursor: pointer;
  transition: var(--t-fast);
  flex-shrink: 0;
}
.key-toggle-btn:hover { color: var(--text-1); border-color: var(--border-2); }

.setting-divider {
  height: 1px;
  background: var(--border-1);
  margin: 10px 0;
}

/* Toggle switch */
.toggle-row { padding: 8px 0; }

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--bg-glass-3);
  border: 1px solid var(--border-1);
  cursor: pointer;
  transition: var(--t-normal);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-3);
  left: 2px;
  top: 2px;
  transition: var(--t-normal);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--violet-dim);
  border-color: var(--violet);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: var(--violet);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-1);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--emerald);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--emerald-dim);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  background: var(--bg-void);
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border-1);
  background: rgba(8, 8, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-center { flex: 1; max-width: 420px; margin: 0 auto; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--t-fast);
}
.icon-btn:hover { background: var(--bg-glass-2); color: var(--text-1); }

.topbar-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Command palette trigger in topbar */
.cmd-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-1);
  color: var(--text-3);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--t-fast);
}
.cmd-trigger:hover { border-color: var(--border-2); color: var(--text-2); background: var(--bg-glass-2); }
.cmd-trigger kbd {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
}

/* Scan button */
.scan-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: var(--r-sm);
  background: var(--gradient-main);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t-normal);
  position: relative;
  overflow: hidden;
}
.scan-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent);
  opacity: 0;
  transition: var(--t-normal);
}
.scan-btn:hover:not(:disabled)::before { opacity: 1; }
.scan-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35), var(--shadow-glow);
}
.scan-btn:active:not(:disabled) { transform: scale(0.97); }
.scan-btn:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(0.3); }

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ---- Upload State ---- */
.upload-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  animation: fadeUp 0.6s var(--ease) both;
  overflow-y: auto;
}

.upload-hero { text-align: center; margin-bottom: 40px; }

.hero-badge-v2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: var(--violet-dim);
  border: 1px solid var(--border-2);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-accent);
  margin-bottom: 20px;
}

.hero-title-v2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.gradient-text-v2 {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub-v2 {
  font-size: 0.95rem;
  color: var(--text-2);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Upload zone */
.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 40px;
  border-radius: var(--r-lg);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 2px dashed var(--border-2);
  cursor: pointer;
  transition: var(--t-normal);
  outline: none;
  width: 100%;
  max-width: 520px;
}
.upload-zone:hover, .upload-zone:focus-visible {
  border-color: var(--violet);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow), inset 0 0 60px rgba(139,92,246,0.03);
}
.upload-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.06);
  box-shadow: var(--shadow-glow-c), inset 0 0 60px rgba(6,182,212,0.04);
  transform: scale(1.02);
}

/* Upload icon animation */
.upload-icon-anim {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  animation: ringPulse 3s ease-in-out infinite;
}
.upload-ring-2 { animation-delay: -1.5s; }

.upload-arrow { transition: var(--t-normal); }
.upload-zone:hover .upload-arrow { transform: translateY(-4px); }

.upload-text {
  font-size: 0.92rem;
  color: var(--text-2);
  font-weight: 500;
}
.upload-browse {
  color: var(--text-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.upload-hint {
  font-size: 0.74rem;
  color: var(--text-3);
}

/* Feature cards */
.feature-cards-v2 {
  display: flex;
  gap: 16px;
  margin-top: 36px;
}

.feature-card-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 28px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-1);
  transition: var(--t-normal);
}
.feature-card-v2:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.fc-icon { color: var(--violet); margin-bottom: 4px; }
.fc-value {
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.fc-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   SPLIT PANE
   ============================================================ */
.split-pane {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.pane-preview { flex: 0 0 50%; }
.pane-results { flex: 1; min-width: 280px; }

/* Pane headers */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-1);
  background: rgba(8, 8, 26, 0.6);
  min-height: 38px;
}

.pane-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pane-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-xs);
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--t-fast);
}
.pane-nav-btn:hover { border-color: var(--violet); color: var(--text-1); }

.page-info {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Pane body */
.pane-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 10, 0.6);
  padding: 16px;
}

.preview-body canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}

/* Scan laser overlay */
.scan-laser {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.laser-line {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 3px;
  background: var(--gradient-main);
  border-radius: 3px;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.6), 0 0 40px rgba(6, 182, 212, 0.3);
  animation: laserSweep 2s ease-in-out infinite;
}

@keyframes laserSweep {
  0%   { top: 16px; opacity: 1; }
  50%  { top: calc(100% - 19px); opacity: 0.8; }
  100% { top: 16px; opacity: 1; }
}

/* ---- Pane Divider ---- */
.pane-divider {
  width: 5px;
  min-width: 5px;
  background: var(--bg-base);
  border-left: 1px solid var(--border-1);
  border-right: 1px solid var(--border-1);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
  position: relative;
}
.pane-divider:hover, .pane-divider.dragging {
  background: var(--violet-dim);
}

.divider-grip {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.divider-grip span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
}
.pane-divider:hover .divider-grip span { background: var(--violet); }

/* ---- Results badges ---- */
.results-badges {
  display: flex;
  gap: 6px;
}

.r-badge {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.r-badge-conf { color: var(--emerald); border-color: rgba(16,185,129,0.2); }

/* ---- Results Toolbar ---- */
.results-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-1);
  background: rgba(8, 8, 26, 0.4);
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-xs);
  background: var(--bg-glass);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--t-fast);
  white-space: nowrap;
}
.tool-btn:hover { border-color: var(--border-2); color: var(--text-1); background: var(--bg-glass-2); }
.tool-btn:active { transform: scale(0.96); }

.tool-btn-accent { color: var(--text-accent); border-color: var(--border-2); background: var(--violet-dim); }
.tool-btn-accent:hover { background: var(--violet-glow); color: #fff; border-color: var(--violet); }

.tool-btn-ai { color: var(--cyan); border-color: rgba(6,182,212,0.2); }
.tool-btn-ai:hover { background: var(--cyan-dim); border-color: var(--cyan); color: #fff; }

.tool-btn-warn { color: var(--amber); border-color: rgba(245,158,11,0.2); }
.tool-btn-warn:hover { background: var(--amber-dim); border-color: var(--amber); color: #fff; }

.tool-btn-danger { color: var(--text-3); }
.tool-btn-danger:hover { background: var(--rose-dim); border-color: rgba(244,63,94,0.3); color: var(--rose); }

.tool-btn.copied {
  background: var(--emerald-dim) !important;
  border-color: rgba(16,185,129,0.3) !important;
  color: var(--emerald) !important;
}

.tool-divider {
  width: 1px;
  height: 20px;
  background: var(--border-1);
  margin: 0 2px;
}

.toolbar-spacer { flex: 1; }

/* ---- Text Output ---- */
.results-body { position: relative; }

.text-output {
  min-height: 100%;
  padding: 18px;
  background: rgba(4, 4, 10, 0.5);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.9;
  white-space: pre-wrap;
  word-wrap: break-word;
  outline: none;
  caret-color: var(--cyan);
}
.text-output:focus { box-shadow: inset 0 0 0 2px rgba(139,92,246,0.1); }

.results-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 0.82rem;
  pointer-events: none;
}

/* ---- AI / PII Panel ---- */
.ai-panel {
  border-top: 1px solid var(--border-1);
  max-height: 40%;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s var(--ease) both;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(8, 8, 26, 0.6);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border-1);
}

.ai-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--t-fast);
}
.ai-panel-close:hover { background: var(--bg-glass-2); color: var(--text-1); }

.ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-1);
  background: rgba(4, 4, 10, 0.4);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* PII highlight in text */
.pii-highlight {
  background: var(--rose-dim);
  border-bottom: 2px solid var(--rose);
  border-radius: 2px;
  padding: 0 2px;
  cursor: help;
  position: relative;
}

.pii-highlight-redacted {
  background: var(--text-3);
  color: var(--text-3);
  border-radius: 2px;
  padding: 0 4px;
  user-select: none;
}

/* ============================================================
   PROGRESS OVERLAY
   ============================================================ */
.progress-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 10, 0.85);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s var(--ease) both;
}

.progress-card-v2 {
  text-align: center;
  padding: 40px 48px;
  border-radius: var(--r-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  max-width: 400px;
  width: 90%;
}

/* Scan animation rings */
.scan-anim {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.scan-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--violet);
}
.scan-ring-1 { animation: spinRing 1.2s linear infinite; }
.scan-ring-2 { inset: 8px; border-top-color: var(--cyan); animation: spinRing 1.8s linear infinite reverse; }
.scan-ring-3 { inset: 16px; border-top-color: var(--text-accent); animation: spinRing 2.4s linear infinite; }

.scan-center-icon {
  position: absolute;
  inset: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.progress-title-v2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.progress-sub-v2 {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 20px;
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(139, 92, 246, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--gradient-main);
  transition: width 0.3s var(--ease);
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  border-radius: var(--r-pill);
  animation: shimmer 1.5s ease-in-out infinite;
}

.progress-meta-v2 {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--statusbar-h);
  min-height: var(--statusbar-h);
  padding: 0 14px;
  background: var(--bg-base);
  border-top: 1px solid var(--border-1);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-3);
}

.statusbar-left, .statusbar-right { display: flex; align-items: center; gap: 8px; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}
.status-dot.scanning {
  background: var(--cyan);
  animation: pulse 1s ease-in-out infinite;
}
.status-dot.error { background: var(--rose); }

.status-sep { color: var(--border-1); }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 4, 10, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  animation: fadeIn 0.15s var(--ease) both;
}

.cmd-palette {
  width: 90%;
  max-width: 540px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  animation: scaleUp 0.2s var(--ease-spring) both;
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-3);
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
}
.cmd-input::placeholder { color: var(--text-3); }

.cmd-esc {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-glass-2);
  border: 1px solid var(--border-1);
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
}

.cmd-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--t-fast);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
}
.cmd-item:hover, .cmd-item.active {
  background: var(--violet-dim);
  color: var(--text-1);
}

.cmd-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  background: var(--bg-glass-2);
  color: var(--violet);
  flex-shrink: 0;
}

.cmd-item-label { flex: 1; }

.cmd-item-shortcut {
  font-size: 0.65rem;
  color: var(--text-3);
  font-weight: 600;
}

.cmd-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.82rem;
}

/* ============================================================
   TOAST SYSTEM
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: rgba(16, 16, 40, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-1);
  animation: toastIn 0.35s var(--ease-spring) both;
  max-width: 360px;
}

.toast.toast-out { animation: toastOut 0.25s var(--ease) forwards; }

.toast-icon { font-size: 1rem; }
.toast-success { border-color: rgba(16, 185, 129, 0.3); }
.toast-success .toast-icon { color: var(--emerald); }
.toast-error { border-color: rgba(244, 63, 94, 0.3); }
.toast-error .toast-icon { color: var(--rose); }
.toast-info { border-color: rgba(139, 92, 246, 0.3); }
.toast-info .toast-icon { color: var(--violet); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

@keyframes ringPulse {
  0%   { transform: scale(0.8); opacity: 0.5; }
  50%  { transform: scale(1.1); opacity: 0.2; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

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

@keyframes toastIn {
  from { transform: translateX(80px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(80px); opacity: 0; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { transform: translateX(-100%); }

  .split-pane { flex-direction: column; }
  .pane-preview { flex: 0 0 40%; min-height: 200px; }
  .pane-results { flex: 1; }
  .pane-divider {
    width: 100%;
    min-width: unset;
    height: 5px;
    min-height: 5px;
    cursor: row-resize;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-1);
    border-bottom: 1px solid var(--border-1);
  }
  .divider-grip { flex-direction: row; }

  .topbar-center { display: none; }
}

@media (max-width: 640px) {
  .feature-cards-v2 { flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }
  .feature-card-v2 { flex-direction: row; padding: 14px 20px; gap: 12px; }
  .feature-card-v2 .fc-icon { margin-bottom: 0; }

  .hero-title-v2 { font-size: 1.6rem; }
  .hero-sub-v2 { font-size: 0.85rem; }

  .upload-zone { padding: 32px 20px; }

  .tool-btn span { display: none; }
  .tool-btn { padding: 5px 7px; }
  .tool-divider { display: none; }

  .toast-container { right: 12px; left: 12px; bottom: 32px; }
  .toast { max-width: 100%; }
}

@media (max-width: 400px) {
  .hero-title-v2 { font-size: 1.4rem; }
  .scan-btn span { display: none; }
}
