/* ═══════════════════════════════════════════════════ */
/*  MySQL Advisor — Design System & Styles            */
/* ═══════════════════════════════════════════════════ */

:root {
  /* Dark Mode (Default) */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #1f2a42;
  --bg-input: #151c2e;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-focus: #6366f1;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --critical: #ef4444;
  --critical-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.2s cubic-bezier(.4, 0, .2, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --hero-gradient: linear-gradient(135deg, #a78bfa 0%, #6366f1 40%, #3b82f6 100%);
}

body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #4f46e5;
  --accent: #4f46e5;
  --accent-glow: rgba(79, 70, 229, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --critical-bg: rgba(239, 68, 68, 0.05);
  --warning-bg: rgba(245, 158, 11, 0.05);
  --info-bg: rgba(59, 130, 246, 0.05);
  --ok-bg: rgba(34, 197, 94, 0.05);
  --hero-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

/* ─── Hero ───────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -60%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.7;
  animation: pulse-glow 4s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  from {
    opacity: 0.5;
    transform: translateX(-50%) scale(0.95);
  }

  to {
    opacity: 0.8;
    transform: translateX(-50%) scale(1.05);
  }
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.hero .icon {
  -webkit-text-fill-color: initial;
}

.hero .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  position: relative;
  z-index: 1;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: var(--transition);
  z-index: 10;
}

.theme-toggle:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

body.light-mode .sun-icon {
  display: block;
}

body.light-mode .moon-icon {
  display: none;
}

/* ─── Container ──────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ─── Two-Column Main Grid ───────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

.lhs-panel {
  min-width: 0;
  /* allow shrink */
}

/* ─── Sidebar ────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── Tab Bar ────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 0;
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 0.6rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ─── Tab Panels ─────────────────────────────────── */
.tab-panels {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

/* ─── Inputs ─────────────────────────────────────── */
.input-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.5rem;
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 1rem;
  resize: vertical;
  transition: var(--transition);
  line-height: 1.5;
}

textarea::placeholder {
  color: var(--text-muted);
}

textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── File Upload ────────────────────────────────── */
.or-divider {
  text-align: center;
  margin: 1rem 0;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--border);
}

.or-divider::before {
  left: 0;
}

.or-divider::after {
  right: 0;
}

.or-divider span {
  background: var(--bg-card);
  padding: 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.file-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.file-upload:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.file-upload input[type="file"] {
  display: none;
}

.file-name {
  font-size: 0.8rem;
  color: var(--ok);
  margin-left: 0.5rem;
}

/* ─── CAPTCHA ────────────────────────────────────── */
.captcha-group {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.captcha-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.captcha-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

#captcha-img {
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  height: 40px;
}

#captcha {
  width: 100px;
  height: 40px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

/* ─── Buttons ────────────────────────────────────── */
.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-primary {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}

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

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

.btn-secondary {
  padding: 0.7rem 1.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: center;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ─── Results ────────────────────────────────────── */
.results {
  margin-top: 2rem;
  animation: slideUp 0.4s ease;
}

/* ─── Report Header Block ────────────────────────── */
.report-header-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.report-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.report-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.report-title {
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.report-for {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.report-for strong {
  color: var(--text-primary);
  font-family: var(--mono);
}

.report-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.report-info-section {
  min-width: 0;
}

.report-info-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.report-info-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.report-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.81rem;
}

.ril {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.riv {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.sev-num {
  font-size: 0.88rem;
  font-weight: 700;
}

.critical-num {
  color: var(--critical);
}

.warning-num {
  color: var(--warning);
}

.info-num {
  color: var(--info);
}

.ok-num {
  color: var(--ok);
}

.severity-critical {
  color: var(--critical);
}

.severity-warning {
  color: var(--warning);
}

.severity-info {
  color: var(--info);
}

.severity-ok {
  color: var(--ok);
}

@media (max-width: 700px) {
  .report-info-grid {
    grid-template-columns: 1fr;
  }
}


@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.export-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-export {
  padding: 0.45rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ─── Summary Grid ───────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.summary-card .count {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.summary-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

.summary-card.critical .count {
  color: var(--critical);
}

.summary-card.warning .count {
  color: var(--warning);
}

.summary-card.info .count {
  color: var(--info);
}

.summary-card.ok .count {
  color: var(--ok);
}

/* ─── Version Info ───────────────────────────────── */
.version-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.version-info .item {
  display: flex;
  gap: 0.5rem;
}

.version-info .item-label {
  color: var(--text-muted);
}

.version-info .item-value {
  font-weight: 600;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ─── Category Cards ─────────────────────────────── */
.category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.category-header {
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.category-header .count-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.category-body {
  padding: 0;
}

.category-body.collapsed {
  display: none;
}

.finding {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

.finding:last-child {
  border-bottom: none;
}

.finding:hover {
  background: rgba(255, 255, 255, 0.02);
}

.finding .badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.finding .var-name {
  font-family: var(--mono);
  color: #a78bfa;
  font-size: 0.85rem;
  margin: 0.3rem 0 0.15rem;
}

.finding .message {
  font-size: 0.9rem;
  margin: 0.15rem 0;
}

.finding .recommendation {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.3rem;
  padding-left: 1.2rem;
  position: relative;
}

.finding .recommendation::before {
  content: '💡';
  position: absolute;
  left: 0;
  top: 0;
}

/* ─── Recommendations Summary Table ────────────────── */
.summary-table-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.summary-table-section h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

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

.findings-table th {
  background: var(--bg-secondary);
  padding: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  position: sticky;
  top: 0;
  border-bottom: 2px solid var(--border);
  z-index: 10;
}

.findings-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-primary);
  line-height: 1.5;
}

.findings-table tr:last-child td {
  border-bottom: none;
}

.findings-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.findings-table .var-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #a78bfa;
  min-width: 180px;
  font-weight: 500;
}

.findings-table .val-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

.findings-table .recommendation-cell {
  color: var(--ok);
  font-weight: 500;
  min-width: 180px;
}

.findings-table .reason-cell {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 300px;
}

.findings-table .sev-cell {
  text-align: center;
  white-space: nowrap;
  width: 90px;
}

/* Unified findings table wrapper */
.findings-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

/* Column width hints */
.findings-table .th-sev {
  width: 90px;
}

.findings-table .th-var {
  width: 200px;
}

.findings-table .th-val {
  width: 130px;
}

.findings-table .th-rec {
  width: 210px;
}

.findings-table .th-cmt {
  min-width: 260px;
}

/* ── Category separator row ─────────────────────── */
.findings-category-row td {
  background: var(--bg-secondary);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  border-top: 2px solid var(--border);
}

.findings-category-row:first-child td {
  border-top: none;
}

.findings-category-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.findings-category-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  margin-left: 0.6rem;
}

/* ── Severity left-border tints ─────────────────── */
.sev-row-critical td:first-child {
  border-left: 3px solid var(--critical);
}

.sev-row-warning td:first-child {
  border-left: 3px solid var(--warning);
}

.sev-row-info td:first-child {
  border-left: 3px solid var(--info);
}

.sev-row-ok td:first-child {
  border-left: 3px solid var(--ok);
}

.findings-category-row:hover {
  background: transparent;
}

.findings-category-row td {
  cursor: default;
}

/* ─── Loading ────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ─── Errors ─────────────────────────────────────── */
.errors {
  background: var(--critical-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  color: var(--critical);
  font-size: 0.9rem;
}

.errors ul {
  margin: 0.5rem 0 0 1.5rem;
}

/* ─── Footer ─────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer .muted {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* ─── Hidden ─────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Supported technologies (sidebar) ───────────── */
.supported-tech {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.supported-tech-title {
  margin: 0 0 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted, var(--text-secondary));
}

.supported-tech-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.supported-tech-list li {
  margin: 0;
  padding-left: 0.85rem;
  position: relative;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.supported-tech-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ─── Collect Box ────────────────────────────────── */
.collect-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.collect-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  border-bottom: 1px solid var(--border);
}

.collect-box-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.collect-box-icon {
  font-size: 1rem;
}

.collect-scope {
  margin: 0;
  padding: 0.85rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: linear-gradient(
    90deg,
    rgba(99, 102, 241, 0.07) 0%,
    transparent 42%
  );
}

.collect-scope-block + .collect-scope-block {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.collect-scope-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.collect-scope-label--muted {
  color: var(--text-muted, var(--text-secondary));
  opacity: 0.9;
}

.collect-scope-desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.collect-tab-chip {
  display: inline-block;
  margin: 0 0.1rem;
  padding: 0.12rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-input, rgba(99, 102, 241, 0.1));
  border: 1px solid var(--border);
  border-radius: 4px;
  vertical-align: baseline;
}

.collect-scope-desc a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.collect-scope-desc a:hover {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ─── Info Icon + Popover ────────────────────────── */
.info-icon-wrap {
  position: relative;
}

.info-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  line-height: 1;
  padding: 0;
}

.info-icon:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.info-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.info-popover code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.info-popover strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.4rem;
}

.info-popover::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

/* ─── Collect Form ───────────────────────────────── */
.collect-form {
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.collect-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.field-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.collect-field input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  padding: 0.45rem 0.7rem;
  transition: var(--transition);
}

.collect-field input::placeholder {
  color: var(--text-muted);
}

.collect-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Collect Button ─────────────────────────────── */
.btn-collect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: calc(100% - 2rem);
  margin: 0 1rem 0;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-collect:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(59, 130, 246, 0.18));
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

.btn-collect:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.collect-btn-icon {
  font-size: 0.9rem;
}

/* ─── Collect Status ─────────────────────────────── */
.collect-status {
  margin: 0 1rem 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.45;
}

.collect-status.success {
  background: var(--ok-bg);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--ok);
}

.collect-status.error {
  background: var(--critical-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--critical);
}

/* ─── Data Ready Banner ──────────────────────────── */
.data-ready-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 1rem 1rem;
  padding: 0.65rem 0.9rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--ok);
  animation: fadeIn 0.3s ease;
}

.data-ready-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.data-ready-banner strong {
  color: var(--ok);
}

/* ─── CAPTCHA sidebar overrides ───────────────────── */
.sidebar .captcha-group {
  margin-top: 0;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .actions {
    flex-direction: row;
    justify-content: center;
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
  }

  .btn-primary {
    flex: 1;
    max-width: 260px;
  }

  .btn-collect {
    width: calc(100% - 2rem);
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .tab {
    font-size: 0.75rem;
    padding: 0.5rem 0.6rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .version-info {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}