/* ============================================================
   SEMSEY TECHNOLOGIES — UPDATED THEME SYSTEM + MOBILE ADAPTIVE
   ============================================================ */

/* ---------- Base Variables (fallbacks) ---------- */
:root {
  --bg: #050816;
  --bg-alt: #0b1020;
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #4f46e5;
  --accent2: #22c55e;
  --card: #0b1020;
  --border: #1f2933;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
  --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.6);
  --nav-height: 60px;
  --transition-fast: 0.18s ease-out;
  --bg-pattern: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
}

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

html, body {
  height: 100%;
}

body {
  background: var(--bg-pattern);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   THEMES — Each theme now has its own background + palette
   ============================================================ */

/* Neon Dark Cyber (default) */
body.theme-neon {
  --bg: #050816;
  --bg-alt: #0b1020;
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #4f46e5;
  --accent2: #22c55e;
  --card: #0b1020;
  --border: #1f2933;
  --bg-pattern: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
}

/* Midnight Minimal */
body.theme-minimal {
  --bg: #050505;
  --bg-alt: #0f0f0f;
  --text: #e5e5e5;
  --muted: #9f9f9f;
  --accent: #888888;
  --accent2: #aaaaaa;
  --card: #141414;
  --border: #262626;
  --bg-pattern: linear-gradient(to bottom, #0a0a0a, #050505);
}

/* Light Minimal (FIXED) */
body.theme-light {
  --bg: #ffffff;
  --bg-alt: #f3f4f6;
  --text: #111827;
  --muted: #4b5563;
  --accent: #4f46e5;
  --accent2: #22c55e;
  --card: #ffffff;
  --border: #e5e7eb;
  --bg-pattern: #ffffff;
}

/* Solarized */
body.theme-solarized {
  --bg: #002b36;
  --bg-alt: #073642;
  --text: #eee8d5;
  --muted: #93a1a1;
  --accent: #b58900;
  --accent2: #268bd2;
  --card: #073642;
  --border: #586e75;
  --bg-pattern: #002b36;
}

/* Monochrome */
body.theme-mono {
  --bg: #111111;
  --bg-alt: #1a1a1a;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #888888;
  --accent2: #b3b3b3;
  --card: #1f1f1f;
  --border: #333333;
  --bg-pattern: linear-gradient(to bottom, #1a1a1a, #111111);
}

/* Terminal Green */
body.theme-terminal {
  --bg: #000000;
  --bg-alt: #001900;
  --text: #00ff66;
  --muted: #00b34a;
  --accent: #00ff66;
  --accent2: #00ff66;
  --card: #001900;
  --border: #004d1a;
  --bg-pattern: #000000;
}

/* Deep Blue Systems */
body.theme-blue {
  --bg: #0a1a2f;
  --bg-alt: #11263d;
  --text: #dce7f7;
  --muted: #9fb3d9;
  --accent: #4ea1ff;
  --accent2: #7cc7ff;
  --card: #11263d;
  --border: #1f3b5c;
  --bg-pattern: linear-gradient(to bottom, #0a1a2f, #071526);
}

/*

/* ============================================================
   LIGHT MINIMAL — NAV OVERRIDE
   ============================================================ */

body.theme-light .nav {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  backdrop-filter: none;
}

body.theme-light .nav-brand {
  color: #111827;
}

body.theme-light .nav-links a {
  color: #4b5563;
}

body.theme-light .nav-links a:hover,
body.theme-light .nav-links a.active {
  color: #111827;
}

body.theme-light .nav-links a::after {
  background: linear-gradient(90deg, #4f46e5, #22c55e);
}

body.theme-light .nav-appearance-btn {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
  box-shadow: none;
} ============================================================
   NAVIGATION — Now fully mobile‑adaptive
   ============================================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(3, 7, 18, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(14px);
  z-index: 50;
}

.nav-brand {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 13px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color var(--transition-fast);
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width var(--transition-fast);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Appearance button */
.nav-appearance-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.7);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 24px) 20px 40px;
  flex: 1;
}

/* ============================================================
   CONTENT BLOCKS
   ============================================================ */

.hero h1 {
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero p {
  font-size: 14px;
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 10px;
}

.block {
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-subtle);
}

.block h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.block p,
.block ul {
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   CARDS
   ============================================================ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.card {
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow-subtle);
}

.card h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.card p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Tags */
.tag {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
}

.tag.stable { color: #22c55e; border-color: #22c55e; }
.tag.experimental { color: #eab308; border-color: #eab308; }
.tag.broken { color: #f97316; border-color: #f97316; }
.tag.progress { color: #38bdf8; border-color: #38bdf8; }

/* ============================================================
   SUPPORT BOX
   ============================================================ */

.support-box {
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 14px;
  margin: 10px 0;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 20px;
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   APPEARANCE MODAL — Mobile‑friendly
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.modal h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.modal p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal label {
  font-size: 12px;
  margin-bottom: 4px;
}

.modal select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 12px;
  margin-bottom: 10px;
}

.preview-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.preview-swatch {
  flex: 1;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-buttons button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.modal-buttons button.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
}

/* ============================================================
   RESPONSIVE FIXES — Fully mobile adaptive
   ============================================================ */

@media (max-width: 640px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 16px;
    gap: 8px;
    height: auto;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
  }

  .nav-appearance-btn {
    width: 100%;
    justify-content: center;
  }

  .page {
    padding-top: 120px;
  }
}

@media (max-width: 480px) {
  .modal {
    max-width: 90%;
    padding: 14px;
  }

  .modal-buttons {
    flex-direction: column;
  }

  .modal-buttons button {
    width: 100%;
  }

  .preview-row {
    gap: 4px;
  }
}
/* ============================================================
   TRUE MOBILE NAVIGATION FIX
   ============================================================ */

@media (max-width: 640px) {

  /* Nav becomes stacked */
  .nav {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 10px;
    height: auto;
  }

  /* Top row: brand + appearance button */
  .nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Bottom row: scrollable nav links */
  .nav-links {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
  }

  .nav-links::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  /* Touch-friendly link chips */
  .nav-links a {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    font-size: 12px;
    flex-shrink: 0;
  }

  .nav-links a.active {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #fff;
    border-color: transparent;
  }

  /* Appearance button becomes full-width */
  .nav-appearance-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Page spacing */
  .page {
    padding-top: 140px;
  }
}