/* ══════════════════════════════════════════
   LAYOUT
   Base reset, body, header, toolbar,
   main grid, panels, footer.
══════════════════════════════════════════ */

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

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Smooth theme transitions ── */
body, header, .toolbar, .panel, .panel-header, .editor-wrap,
.editor-body, .line-numbers, textarea#editor, .results-panel-body, .score-card,
.issue-item, .issue-hint, .modal, footer {
  transition: background-color .25s ease, border-color .25s ease, color .2s ease;
}

/* ════════════════════════════════════════
   HEADER
════════════════════════════════════════ */
header {
  height: var(--header-h);
  background: linear-gradient(135deg, #0E2A5C 0%, #1B4490 55%, #0A2050 100%);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Subtle grid pattern overlay */
header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(245,197,24,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,197,24,.07) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

/* Glow orb */
header::after {
  content: '';
  position: absolute;
  top: -40px; right: 80px;
  width: 200px; height: 140px;
  background: radial-gradient(circle, rgba(245,197,24,.2) 0%, transparent 70%);
  pointer-events: none;
}

[data-theme="dark"] header {
  background: linear-gradient(135deg, #081530 0%, #0E2050 60%, #060F25 100%);
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #fff;
  position: relative;
  z-index: 1;
}
.logo-icon {
  width: 40px;
  height: 40px;
  background: transparent;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(245,197,24,.45));
}
.logo-icon svg { display: block; }
.logo-text {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}
.logo-text span { color: var(--brand); }
.logo-badge {
  background: rgba(245,197,24,.18);
  border: 1px solid rgba(245,197,24,.4);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: .8px;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.header-tagline {
  font-size: 12.5px;
  color: rgba(255,255,255,.45);
  font-weight: 400;
}
.header-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-md);
  padding: 5px 12px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}
.header-stat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #F5C518;
  box-shadow: 0 0 8px #F5C518;
}

/* ════════════════════════════════════════
   TOOLBAR
════════════════════════════════════════ */
.toolbar {
  height: var(--toolbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}
.toolbar-spacer { flex: 1; }
.toolbar-stat {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--font-code);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

/* ════════════════════════════════════════
   MAIN LAYOUT
════════════════════════════════════════ */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ════════════════════════════════════════
   PANELS
════════════════════════════════════════ */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}
.panel + .panel { border-left: 1px solid var(--border); }

.panel-header {
  padding: 0 16px;
  height: 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.panel-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
}
.panel-pill {
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1px 8px;
  color: var(--text-muted);
}
.panel-pill.active { background: var(--brand-glow); border-color: rgba(245,197,24,.3); color: var(--brand-mid); }

/* ════════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 24px;
  height: 36px;
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}
footer .footer-brand {
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -.2px;
}
footer .footer-brand span { color: var(--brand-mid); }
.footer-sep { color: var(--border-strong); }
footer a { color: var(--brand-dark); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 50vh 1fr; }
  .panel + .panel { border-left: none; border-top: 1px solid var(--border); }
  .header-tagline, .header-stat { display: none; }
  .toolbar { padding: 0 12px; }
}
