/* ═══════════════════════════════════════════════════════════════════════
   base.css — Shared CSS foundation for all VRFTools pages

   Canonical definitions extracted from style.css (LEV Kit / Config Tools)
   and site.css (public site pages).  Loaded BEFORE both stylesheets so
   per‑section overrides still win via normal cascade.

   HC-03 step 1 (additive slice) — no existing CSS rules have been removed.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────────────────────
   2026 redesign palette (single source of truth). The duplicate :root blocks
   in style.css and site.css are kept in sync with these values — they load
   AFTER base.css and would otherwise win the cascade with stale values. */
:root {
  --red:        #c0392b;   /* primary accent — links, active states, hover borders */
  --red-light:  #fdf2f2;   /* tinted red background (hover fill, info banners)      */
  --red-border: #f0cac8;   /* subtle red border (banners / icon wells)             */
  --dark:       #1a1a1a;   /* near-black — header bg, body text, filled buttons     */
  --gray:       #555;      /* secondary text, descriptions                          */
  --light-gray: #f5f5f5;   /* legacy surface tint (retained for older components)   */
  --page-bg:    #f0f0f0;   /* page background                                       */
  --border:     #e2e2e2;   /* card borders, dividers                                */
  --white:      #fff;      /* card backgrounds, inputs                              */
  --muted:      #999;      /* placeholder text, metadata, footnotes                 */
  --green:      #27ae60;   /* success state (loaded-file badge)                     */
  --green-light:#f0faf4;   /* tinted green background                               */
  --warn-bg:    #fff8e1;
  --warn-border:#f9a825;

  /* Typography */
  --font-sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

/* ═══════════════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Card ───────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.045);
}
.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 9px 24px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s, border-color 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--red); color: var(--white); }
/* Neutral secondary action (design "btn-secondary"). btn-outline kept as alias. */
.btn-secondary,
.btn-outline {
  background: var(--page-bg);
  color: var(--dark);
  border: 1px solid var(--border);
  font-weight: 500;
}
.btn-secondary:hover,
.btn-outline:hover { border-color: #aaa; opacity: 1; }
/* Secondary download action — subtle gray that matches the group-card background. */
.btn-gray {
  background: var(--light-gray);
  color: var(--dark);
  border: 1px solid var(--border);
}
.btn-gray:hover { background: #e8e8e8; border-color: #bbb; opacity: 1; }

/* ── Drop zone ──────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 36px 32px 28px;
  text-align: center;
  cursor: pointer;
  background: #f9f9f7;
  transition: background 0.15s, border-color 0.15s;
  color: var(--muted);
}
.drop-zone:hover,
.drop-zone.dragging {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--dark);
}
.drop-zone.uploading {
  background: #f5f5f5;
  border-color: #bbb;
  cursor: wait;
}
/* Neutral-hover variant — config hub + tutorial want a quiet grey hover
   rather than the red one MTDZ/LEV use. */
.drop-zone.dz-neutral:hover,
.drop-zone.dz-neutral.dragging {
  background: #f2f1ee;
  border-color: #aaa;
  color: var(--dark);
}
/* Legacy inner layout (still used by other drop zones, e.g. LEV Kit) */
.drop-zone .icon { font-size: 2.5rem; margin-bottom: 12px; }
.drop-zone p    { font-size: 0.95rem; }
.drop-zone small { font-size: 0.78rem; margin-top: 6px; display: block; }
/* 2026 inner layout (icon / title / sub / browse button / note) */
.drop-zone .dz-icon { font-size: 1.9rem; margin-bottom: 10px; line-height: 1; }
.drop-zone .dz-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--dark); margin-bottom: 4px;
}
.drop-zone .dz-sub {
  font-size: 0.75rem; font-family: var(--font-mono); color: var(--muted);
  margin-bottom: 14px;
}
.drop-zone .dz-browse {
  display: inline-block;
  padding: 7px 20px;
  background: var(--white);
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--dark);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.drop-zone .dz-browse:hover { border-color: #aaa; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.drop-zone .dz-note { margin-top: 10px; font-size: 0.75rem; color: var(--muted); }
.drop-zone:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--red);
}

/* ── Breadcrumb (2026 redesign) ─────────────────────────────────────── */
.breadcrumb {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 10px 28px 0;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  flex-shrink: 0;
}
.breadcrumb a { color: var(--red); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Page title / subtitle ──────────────────────────────────────────── */
.page-title {
  font-size: 1.375rem;        /* 22px */
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 0.875rem;        /* 14px */
  line-height: 1.5;
}

/* ── Active-file bar (dark, distinct from cards) ─────────────────────────
   Replaces the old green "file loaded" badge on the hub pages. */
.file-bar {
  background: var(--dark);
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.file-bar-icon {
  width: 34px; height: 34px;
  background: rgba(192,57,43,0.15);
  border: 1px solid rgba(192,57,43,0.3);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--red);
  font-size: 1rem;
}
.file-bar-body { flex: 1; min-width: 0; }
.file-bar-label {
  font-size: 10px; color: #777;
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 3px;
}
.file-bar-name {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-bar-clear {
  background: none; border: 1px solid #3a3a3a;
  border-radius: 6px; padding: 5px 13px;
  font-size: 12px; color: #999;
  cursor: pointer; font-family: inherit; flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.file-bar-clear:hover { border-color: #777; color: #fff; }

/* ── Error / success messages ───────────────────────────────────────── */
.error-msg {
  background: #fdf0ef;
  border: 1px solid #e88;
  border-radius: 6px;
  padding: 12px 16px;
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 12px;
  display: none;
}
.error-msg.visible { display: block; }

.success-msg {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  padding: 16px;
  color: #166534;
  font-size: 0.9rem;
  display: none;
}
.success-msg.visible { display: block; }

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert {
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.88rem;
  margin-top: 12px;
}
.alert-error { background: #fdecea; border: 1px solid #f5c6cb; color: #c0392b; }
.alert-warn  { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #5a4000; }
.alert-info  { background: #e8f4fd; border: 1px solid #bee3f8; color: #1a5276; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--page-bg);
  color: var(--gray);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}
.badge-green { background: #e8f5e9; color: var(--green); }

/* Beta marker — amber pill, used wherever an in-development tool is surfaced. */
.beta-badge {
  display: inline-block;
  background: #fff4e5;
  color: #b25e00;
  border: 1px solid #ffc98a;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

.badge-pill {
  display: inline-block;
  background: #fff3f3;
  color: var(--red);
  border: 1px solid #ffb3b3;
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  align-self: flex-start;
}

/* ── Info popup overlay (deduplicated — shared by all pages) ────────── */
.info-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: popupFadeIn 0.15s ease;
}
.info-popup {
  background: var(--white);
  border-radius: 12px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.info-popup h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--dark);
}
.info-popup .problem-label { font-weight: 600; color: var(--dark); }
.info-popup .solution-label { font-weight: 600; color: var(--red); }
.info-popup p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 10px;
}
.info-popup .close-popup {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  background: var(--dark);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

@keyframes popupFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Download countdown + Ko-Fi note (shared.js startDownloadCountdown) ── */
.dl-countdown {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--light-gray);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dl-countdown-timer {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
}
.dl-countdown-ring {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}
.dl-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}
.dl-ring-progress {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear;
}
.dl-countdown-num {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dark);
}
.dl-countdown-text { font-size: 0.9rem; color: var(--dark); }
.dl-countdown-status { margin-bottom: 3px; }
.dl-now-link { color: var(--red); font-weight: 600; }
.dl-kofi { font-size: 0.82rem; color: var(--muted); }
/* Indeterminate "spinny wheel" used by startDownloadSpinner (report generation
   — no fixed countdown because the download starts when generation finishes). */
.dl-countdown-timer--spin {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dl-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: dl-spin 0.7s linear infinite;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }
