/* ═══════════════════════════════════════════════════════════
   SITE RIPPER v2 — Stylesheet
   Design: Cyberpunk terminal aesthetic, dark by default
   ═══════════════════════════════════════════════════════════ */

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

/* ── Promo Banner ─────────────────────────────────────────── */
.promo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 9px 16px;
  text-align: center;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 13.5px;
  color: #1a1a2e;
  line-height: 1.4;
  cursor: default;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.promo-banner:hover {
  background: #f9fafb;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}

.promo-link {
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.promo-link:hover {
  color: #000;
  border-bottom-color: #1a1a2e;
}

/* Push everything below the banner */
body {
  padding-top: 38px;
}

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* codev.cloud Inspired: Luxury Dark Palette */
  --bg: #0a0a0a;
  --bg-elevated: #0d0d0d;
  --surface: #121212;
  --surface-2: #1a1a1a;
  --surface-3: #222222;
  --border: #2a2a2a;
  --border-dim: #181818;

  --text: #f5f5f5;
  --text-dim: #b0b0b0;
  --text-faint: #444444;

  --accent: #d4af37;
  /* Gold / Amber accent */
  --accent-dim: #b8860b;
  --accent-glow: rgba(212, 175, 55, 0.15);
  --accent-glow2: rgba(212, 175, 55, 0.08);
  --cyan: #c0c0c0;
  /* Silver for secondary accents */
  --cyan-glow: rgba(192, 192, 192, 0.15);

  --red: #ff4b7d;
  --red-glow: rgba(255, 75, 125, 0.15);
  --yellow: #d4af37;
  --orange: #e67e22;

  --log-page: #d4af37;
  --log-asset: #b0b0b0;
  --log-error: #ff4b7d;
  --log-warn: #e67e22;
  --log-info: #888888;

  /* Typography - codev.cloud style */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', 'Space Grotesk', system-ui, sans-serif;
  --font-serif: 'Playfair Display', serif;

  /* Layout */
  --header-h: 64px;
  --left-w: 360px;
  --radius: 4px;
  /* Sharper radius */
  --radius-sm: 2px;
  --radius-lg: 8px;

  /* Transitions */
  --t-fast: 0.2s cubic-bezier(0.2, 0, 0, 1);
  --t-med: 0.4s cubic-bezier(0.2, 0, 0, 1);
  --t-slow: 0.6s cubic-bezier(0.2, 0, 0, 1);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.7);
}

/* ── Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f8f9fc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e8ebf5;
  --border: #dce1ed;
  --border-dim: #eef1f8;

  --text: #1c1c2e;
  --text-dim: #64648c;
  --text-faint: #c0c0d8;

  --accent: #008877;
  --accent-dim: #006655;
  --accent-glow: rgba(0, 136, 119, 0.1);
  --accent-glow2: rgba(0, 136, 119, 0.05);
  --cyan: #0077aa;
  --cyan-glow: rgba(0, 119, 170, 0.1);

  --red: #d6335a;
  --red-glow: rgba(214, 51, 90, 0.1);
  --yellow: #b27700;

  --log-page: #008877;
  --log-asset: #4070dd;
  --log-error: #d6335a;
  --log-warn: #a26600;
  --log-info: #64648c;
}

/* ── Global ───────────────────────────────────────────────── */
html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Noise overlay (subtle texture) ──────────────────────── */
.noise-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
}

[data-theme="light"] .noise-overlay {
  opacity: 0.5;
}

/* ── Grid background ──────────────────────────────────────── */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--accent-glow2) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-glow2) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0%, var(--bg) 100%);
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(17, 17, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

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

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  box-shadow: 0 0 16px var(--accent-glow);
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.logo-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Icon Button ──────────────────────────────────────────── */
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 13px;
}

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

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Main Layout ──────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--left-w) 1fr;
}

/* ── Left Panel ───────────────────────────────────────────── */
.panel-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dim) transparent;
  padding: 24px;
  padding-bottom: 32px;
}

.panel-left::-webkit-scrollbar {
  width: 5px;
}

.panel-left::-webkit-scrollbar-track {
  background: transparent;
}

.panel-left::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 10px;
}

.panel-left::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ── Control Sections ─────────────────────────────────────── */
.control-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-dim);
}

.control-section:first-child {
  padding-top: 8px;
}

.control-section:last-child {
  border-bottom: none;
}

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

.control-label {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}

.control-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* ── URL Input / Drop Zone ────────────────────────────────── */
.url-section {
  padding-bottom: 14px;
}

.drop-zone {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  display: block;
  transition: all var(--t-fast);
}

.url-input::placeholder {
  color: var(--text-faint);
}

.url-input:focus~.drop-hint {
  opacity: 0;
}

.drop-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border-dim);
  transition: opacity var(--t-fast);
}

.drop-zone:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Range Inputs ─────────────────────────────────────────── */
.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  position: relative;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px var(--accent-glow);
}

.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.range-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* ── Type Chips ───────────────────────────────────────────── */
.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--t-fast);
  user-select: none;
  letter-spacing: 0.3px;
}

.type-chip input[type="checkbox"] {
  display: none;
}

.type-chip:has(input:checked),
.type-chip.active {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.type-chip:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

/* ── Toggle Switch ────────────────────────────────────────── */
.options-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--surface-3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  position: relative;
  transition: all var(--t-fast);
  cursor: pointer;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform var(--t-fast), background var(--t-fast);
}

.toggle-switch input:checked+.toggle-track {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
}

.toggle-switch input:checked+.toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ── Advanced Section ─────────────────────────────────────── */
.advanced-section {
  border-bottom: 1px solid var(--border-dim);
  padding: 8px 0;
}

.advanced-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.advanced-toggle::-webkit-details-marker {
  display: none;
}

.chevron {
  transition: transform var(--t-fast);
}

.advanced-section[open] .chevron {
  transform: rotate(180deg);
}

.advanced-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group-sm {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.label-sm {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.number-input,
.select-input {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border-color var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

.number-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Action Buttons ───────────────────────────────────────── */
.action-section {
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border-dim);
}

.btn-rip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: var(--accent);
  color: #000;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn-rip:hover {
  background: #f1c40f;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  transform: translateY(-1px);
}

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

.btn-rip:disabled {
  opacity: 0.2;
  filter: grayscale(1);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(0, 255, 204, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 204, 0);
  }
}

.btn-rip.pulsing {
  animation: pulse-glow 2s infinite;
}

.action-row {
  display: flex;
  gap: 8px;
}

.btn-pause,
.btn-stop {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1.5px solid;
}

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

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

.btn-pause.active {
  background: rgba(255, 204, 0, 0.1);
  border-color: var(--yellow);
  color: var(--yellow);
}

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

.btn-stop:hover {
  background: var(--red-glow);
  border-color: var(--red);
  color: var(--red);
}

/* Link button */
.link-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast);
}

.link-btn:hover {
  color: var(--accent);
}

/* ── History ──────────────────────────────────────────────── */
.history-section {
  padding-top: 14px;
  flex: 1;
}

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

.section-label {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.empty-state {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  padding: 8px 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  min-width: 0;
}

.history-item:hover {
  background: var(--surface-3);
  border-color: var(--border);
}

.history-item-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ── Right Panel ──────────────────────────────────────────── */
.panel-right {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  min-width: 0;
  overflow: hidden;
}

/* ── Progress Section ─────────────────────────────────────── */
.progress-section {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px var(--accent-glow);
  position: relative;
}

/* Shimmer on the fill */
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Indeterminate state */
.progress-bar.indeterminate .progress-fill {
  width: 30% !important;
  animation: slide-progress 1.4s ease-in-out infinite;
}

.progress-bar.indeterminate .progress-fill::after {
  display: none;
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

.progress-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-height: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-item::before {
  content: '·';
  color: var(--text-faint);
}

.meta-item:first-child::before {
  display: none;
}

/* ── Tab Bar ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: -1px;
  position: relative;
  letter-spacing: 0.2px;
}

.tab-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

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

.tab-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tab-badge {
  color: var(--accent);
  font-size: 8px;
  animation: pulse-badge 2s ease-in-out infinite;
}

.tab-badge.hidden {
  display: none;
}

.tab-spacer {
  flex: 1;
}

.tab-action {
  width: 28px;
  height: 28px;
  opacity: 0.4;
}

.tab-action:hover {
  opacity: 1;
}

/* ── Tab Panels ───────────────────────────────────────────── */
.tab-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease-out;
}

.tab-panel.hidden {
  display: none;
}

/* ── Console ──────────────────────────────────────────────── */
.console-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.console-body::-webkit-scrollbar {
  width: 5px;
}

.console-body::-webkit-scrollbar-track {
  background: transparent;
}

.console-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.log-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 2px 0;
  animation: logSlideIn 0.18s ease-out;
  word-break: break-all;
}

/* Fixed-width label: PAGE, ASSET, ERROR, etc. */
.log-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  min-width: 42px;
  opacity: 0.85;
}

.log-line.log-page {
  color: var(--log-page);
}

.log-line.log-asset {
  color: var(--log-asset);
}

.log-line.log-error {
  color: var(--log-error);
}

.log-line.log-warn {
  color: var(--log-warn);
}

.log-line.log-dim {
  color: var(--log-info);
}

.log-line.log-info {
  color: var(--text-dim);
}

.log-line.log-success {
  color: var(--accent);
}

/* Dim the badge on info/dim lines so it doesn't compete */
.log-line.log-dim .log-badge,
.log-line.log-info .log-badge {
  opacity: 0.3;
}

.log-size {
  flex-shrink: 0;
  font-size: 10px;
  opacity: 0.45;
  margin-left: auto;
  padding-left: 12px;
  white-space: nowrap;
}

/* ── Dashboard Panel ──────────────────────────────────────── */
.dashboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-body::-webkit-scrollbar {
  width: 5px;
}

.dashboard-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.dash-empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  padding: 24px 0;
  text-align: center;
}

/* Dashboard grid of cards */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.dash-card-wide {
  grid-column: 1 / -1;
}

.dash-card-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Chart container */
.chart-wrap {
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stat rows in dashboard */
.dash-stat-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.dash-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-stat-name {
  flex: 1;
  color: var(--text-dim);
}

.dash-stat-count {
  color: var(--text);
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

.dash-stat-size {
  color: var(--text-faint);
  min-width: 60px;
  text-align: right;
  font-size: 10px;
}

/* Error list in dashboard */
.dash-error-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.dash-error-item {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red);
  padding: 4px 8px;
  background: var(--red-glow);
  border-radius: var(--radius-sm);
  word-break: break-all;
  display: flex;
  gap: 6px;
}

.dash-error-msg {
  color: var(--text-dim);
  font-size: 10px;
}

.dash-no-errors {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}

/* Download action area in dashboard */
.dash-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.btn-download-zip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-download-zip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(0, 255, 170, 0.3);
}

.btn-new-rip {
  padding: 13px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.btn-new-rip:hover {
  background: var(--surface-3);
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* ── Stats Footer ─────────────────────────────────────────── */
.stats-footer {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0;
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 9px 16px;
  border-right: 1px solid var(--border-dim);
  min-width: 0;
  flex: 1;
}

.stat-item:last-child {
  border-right: none;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 1px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.stat-item.stat-error .stat-val {
  color: var(--red);
}

.stat-item.stat-speed .stat-val {
  color: var(--cyan);
}

/* ── Keyboard Help Modal ──────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  animation: modalIn 0.3s var(--t-slow);
}

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

.modal-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  padding: 16px 20px;
  align-items: center;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  white-space: nowrap;
}

.shortcuts-grid span {
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s var(--t-slow);
  pointer-events: auto;
  max-width: 300px;
}

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

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

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

.toast.toast-warn {
  border-left: 3px solid var(--yellow);
}

.toast.toast-out {
  animation: toastOut 0.3s ease-in forwards;
}

/* ── Confetti ─────────────────────────────────────────────── */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  display: none;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logSlideIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes slide-progress {
  0% {
    transform: translateX(-150%);
  }

  100% {
    transform: translateX(450%);
  }
}

@keyframes pulse-badge {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.pulsing {
  animation: pulse 1.8s ease-in-out infinite;
}

/* ── Theme transition ─────────────────────────────────────── */
html {
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

*,
*::before,
*::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* But don't slow down animations */
.progress-fill,
.log-line,
.toast,
.modal,
.confetti-canvas {
  transition: none;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 800px) {
  .app-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 60vh;
  }

  .panel-right {
    min-height: 50vh;
  }

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

  .stat-item {
    flex: none;
    min-width: 25%;
  }

  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  :root {
    --left-w: 100%;
    --header-h: 48px;
  }

  .logo-version {
    display: none;
  }

  .type-chips {
    gap: 4px;
  }

  .type-chip {
    font-size: 10px;
    padding: 4px 8px;
  }
}

/* ── Scrollbar global (Firefox) ───────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Focus styles ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* ── Premium Polish ────────────────────────────────────────── */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-section {
  animation: slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  /* Started at 0 for animation */
}

.control-section:nth-child(1) {
  animation-delay: 0.05s;
}

.control-section:nth-child(2) {
  animation-delay: 0.1s;
}

.control-section:nth-child(3) {
  animation-delay: 0.15s;
}

.control-section:nth-child(4) {
  animation-delay: 0.2s;
}

.control-section:nth-child(5) {
  animation-delay: 0.25s;
}

/* Custom Scrollbar for Right Panel (Webkit) */
.panel-right::-webkit-scrollbar {
  width: 6px;
}

.panel-right::-webkit-scrollbar-track {
  background: transparent;
}

.panel-right::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.panel-right::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Glassmorphism utility */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}