/* Basic reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: #0f172a; background: #f8fafc; display: block; }
/* Dark theme: ensure readable text color */
[data-theme="dark"] body { color: #e5e7eb; background: var(--bg); }
/* Use theme variable for background */
body { background: var(--bg); }

:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-600: #1d4ed8;
  --danger: #b91c1c;
}

/* Dark theme variables */
[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #0f172a;
  --muted: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-600: #2563eb;
  --danger: #ef4444;
}

.topbar, .bottombar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
/* Center the middle nav absolutely so it stays centered regardless of left/right controls */
.topbar { position: relative; }
.topbar .nav.center { position: absolute; left: 50%; transform: translateX(-50%); }
/* Make bottom bar minimal/transparent so no white box appears */
.bottombar {
  border-top: none;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
}
.topbar h1 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.topbar .tagline { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
/* Right-side spacing helper in header if needed */
.topbar .spacer { flex: 1; }
/* Brand (logo + title) */
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; font-weight: 700; }
.brand img { width: 28px; height: 28px; display: block; border-radius: 6px; }
.brand .title { font-size: 1.05rem; }

/* Small logo next to Home button */
.home-link { display: inline-flex; align-items: center; gap: .45rem; }
.home-link .home-logo { width: 18px; height: 18px; display: inline-block; border-radius: 4px; vertical-align: middle; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.nav { display: flex; gap: .6rem; flex-wrap: wrap; }
.nav.center { margin: 0 auto; }
.nav a { color: #0f172a; text-decoration: none; border: 1px solid var(--border); padding: .55rem .9rem; border-radius: 10px; background: #fff; font-weight: 600; }
.nav a:hover { background: #f1f5f9; }
.nav a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .nav a { color: #e5e7eb; background: #111827; border-color: var(--border); }
[data-theme="dark"] .nav a:hover { background: #0f172a; }
button { border: 1px solid var(--border); background: #fff; padding: .45rem .7rem; border-radius: 8px; cursor: pointer; color: #0f172a; }
button:hover { background: #f1f5f9; }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover { background: var(--accent-600); }
[data-theme="dark"] button { background: #111827; color: #e5e7eb; border-color: var(--border); }
[data-theme="dark"] button:hover { background: #0f172a; }
/* Larger buttons for primary actions */
.actions.actions-lg button, .nav a.btn-lg { padding: .7rem 1.2rem; font-size: 1rem; border-radius: 12px; }
/* Small icon-only button */
.icon-btn { padding: .35rem .5rem; font-size: 1.1rem; line-height: 1; border-radius: 10px; }

.layout { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; padding: 12px; min-height: 0; }
.pane { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 66vh; max-height: 78vh; }
.pane-header { padding: .6rem .8rem; font-weight: 600; border-bottom: 1px solid var(--border); background: #f8fafc; }
[data-theme="dark"] .pane-header { background: #0f172a; }
textarea { width: 100%; flex: 1 1 auto; border: none; resize: none; padding: .8rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: .9rem; line-height: 1.4; background: #fff; overflow: auto; }
textarea:focus { outline: none; }
[data-theme="dark"] textarea { background: #111827; color: #e5e7eb; }
#validation-summary { padding: .6rem .8rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; min-height: 44px; }
/* Hide the summary area if empty to reduce extra white space */
#validation-summary:empty { display: none; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .pane { min-height: 220px; }
}

/* Status styles */
.validation-ok { color: #166534; }
.validation-error { color: var(--danger); }

/* Landing */
.landing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px; align-content: start; }
.card { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 24px; background: var(--panel); color: inherit; text-decoration: none; min-height: 140px; }
.card:hover { border-color: #cbd5e1; background: #f8fafc; }
[data-theme="dark"] .card { border-color: var(--border); }
[data-theme="dark"] .card:hover { background: #0f172a; }
.card h2 { margin: 0 0 .25rem 0; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }
[data-theme="dark"] .card h2 { color: #e5e7eb; }
[data-theme="dark"] .card p { color: #94a3b8; }

/* Tiny examples on landing cards */
.mini-example {
  margin-top: .5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .6rem;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .8rem;
  line-height: 1.3;
  white-space: pre-wrap;
}

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

/* Make landing page content occupy less vertical space (approx half) */
body:has(.landing) .landing { max-width: 1100px; margin: 0 auto; }
body:has(.landing) .card { min-height: 110px; }

/* Center footer actions */
.bottombar { justify-content: center; }

/* Subtle bottom note on home page - pin to bottom */
.landing-note {
  position: fixed;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  padding: 4px 8px;
  z-index: 10;
  pointer-events: none;
}
