/* ============================================================
   Comly Network — Theme layer
   Default: LIGHT (white base). Options: light / dark / system.
   This file is loaded AFTER styles.css and only overrides tokens
   or rules containing hardcoded dark-theme values.
   ============================================================ */

/* ---------- Light theme tokens (default) ---------- */
html[data-theme="light"] {
  color-scheme: light;

  --bg: #f3f5fa;
  --bg-elev: #ffffff;
  --surface: rgba(15, 23, 42, 0.04);
  --surface-2: rgba(15, 23, 42, 0.065);
  --surface-3: rgba(15, 23, 42, 0.10);
  --border: rgba(15, 23, 42, 0.10);
  --border-2: rgba(15, 23, 42, 0.18);

  --text: #0b1220;
  --muted: #55617a;
  --muted-2: #7c879d;

  --accent: #0f766e;
  --accent-2: #6d28d9;
  --accent-3: #db2777;
  --ok: #047857;
  --warn: #b45309;
  --danger: #be123c;

  --grad: linear-gradient(96deg, #0f766e 0%, #6d28d9 58%, #db2777 115%);
  --grad-soft: linear-gradient(135deg, rgba(15, 118, 110, 0.10), rgba(109, 40, 217, 0.10));

  --shadow-card: 0 30px 70px -42px rgba(15, 23, 42, 0.28), 0 0 0 1px var(--border) inset;
  --glow-accent: 0 18px 44px -18px rgba(15, 118, 110, 0.45);

  --nav-bg: rgba(243, 245, 250, 0.88);
  --footer-bg: #eef1f7;
  --toast-bg: #0b1220;
  --inset-bg: #fbfcff;
  --inset-bg-soft: #f5f7fb;
  --grid-line: rgba(15, 23, 42, 0.035);
  --row-border: rgba(15, 23, 42, 0.07);
  --row-hover: rgba(15, 23, 42, 0.025);
  --card-a: #ffffff;
  --card-b: #fbfcfe;
  --glass-a: rgba(255, 255, 255, 0.94);
  --glass-b: rgba(249, 250, 253, 0.88);
  --btn-fg: #ffffff;
  --btn-grad: linear-gradient(135deg, #0f766e, #6d28d9);
  --sidebar-bg: #ffffff;
  --glow-1: rgba(13, 148, 136, 0.18);
  --glow-2: rgba(139, 92, 246, 0.16);
}

/* ---------- Background & atmosphere ---------- */
html[data-theme="light"] body { background: var(--bg); }
html[data-theme="light"] .shorten-card { background: linear-gradient(180deg, #ffffff, #f7f9fd); }
html[data-theme="light"] .bg-glow { opacity: 0.45; }
html[data-theme="light"] .stat, html[data-theme="light"] .price-card:not(.featured) { background: #fbfcfe; }
html[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
}
html[data-theme="light"] .bg-glow { opacity: 0.75; }
html[data-theme="light"] .bg-glow-1 { background: radial-gradient(circle, var(--glow-1), transparent 64%); }
html[data-theme="light"] .bg-glow-2 { background: radial-gradient(circle, var(--glow-2), transparent 64%); }

/* ---------- Navigation ---------- */
html[data-theme="light"] .site-nav { background: var(--nav-bg); }
html[data-theme="light"] .lang-toggle { background: #ffffff; }
html[data-theme="light"] .nav-burger { background: #ffffff; }
html[data-theme="light"] .nav-mobile a { border-bottom-color: var(--row-border); }
html[data-theme="light"] .nav-mobile { border-top-color: var(--border); }

/* ---------- Buttons ---------- */
html[data-theme="light"] .btn-primary {
  background: var(--btn-grad);
  color: var(--btn-fg);
  box-shadow: var(--glow-accent);
}
html[data-theme="light"] .btn-primary:hover:not(:disabled) {
  box-shadow: 0 22px 50px -16px rgba(15, 118, 110, 0.55);
}
html[data-theme="light"] .btn-ghost { background: #ffffff; border-color: var(--border); }
html[data-theme="light"] .btn-ghost:hover { background: var(--inset-bg-soft); border-color: var(--border-2); }
html[data-theme="light"] .spinner { border-color: rgba(255, 255, 255, 0.4); border-top-color: #ffffff; }

/* ---------- Shorten card + form ---------- */
html[data-theme="light"] .shorten-card {
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
}
html[data-theme="light"] .field-url { background: var(--inset-bg); }
html[data-theme="light"] .opt-field { background: var(--inset-bg-soft); }
html[data-theme="light"] .opt-field select option { background: #ffffff; color: #0b1220; }
html[data-theme="light"] .result-card {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.07), rgba(109, 40, 217, 0.06));
  border-color: rgba(15, 118, 110, 0.22);
}
html[data-theme="light"] .qr-box { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12); }

/* ---------- Cards ---------- */
html[data-theme="light"] .feature-card {
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
}
html[data-theme="light"] .feature-card:hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: linear-gradient(180deg, #f0fdfa, #ffffff);
}
html[data-theme="light"] .network-card {
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
}
html[data-theme="light"] .network-note { background: #f8fafc; }
html[data-theme="light"] .price-card { background: var(--bg-elev); }
html[data-theme="light"] .price-card.featured {
  background: linear-gradient(180deg, rgba(109, 40, 217, 0.055), #ffffff);
}
html[data-theme="light"] .faq-item[open] { background: rgba(15, 118, 110, 0.035); }
html[data-theme="light"] .cta-band {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.09), rgba(109, 40, 217, 0.09));
}
html[data-theme="light"] .toast {
  background: var(--toast-bg);
  color: #ffffff;
  border-color: rgba(15, 118, 110, 0.5);
}

/* ---------- Footer ---------- */
html[data-theme="light"] .site-footer { background: var(--footer-bg); }

/* ---------- Dashboard page (light) ---------- */
html[data-theme="light"] .dash-sidebar { background: var(--sidebar-bg); }
html[data-theme="light"] .dash-topbar { background: var(--nav-bg); }
html[data-theme="light"] .dash-search kbd { background: #f1f4fa; }
html[data-theme="light"] table.links th { border-bottom-color: var(--border); }
html[data-theme="light"] table.links td { border-bottom-color: var(--row-border); }
html[data-theme="light"] table.links tbody tr:hover { background: var(--row-hover); }
html[data-theme="light"] .kpi,
html[data-theme="light"] .panel,
html[data-theme="light"] .links-table-wrap { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
html[data-theme="light"] .avatar { color: #ffffff; }
html[data-theme="light"] .dash-nav-item.active { background: rgba(15, 118, 110, 0.09); border-color: rgba(15, 118, 110, 0.20); }
html[data-theme="light"] .chip.active { background: rgba(15, 118, 110, 0.08); }

/* ---------- Always-dark product screenshot (landing preview) ---------- */
.dash-mock {
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.15);
  --text: #eef1f6;
  --muted: #9aa4b8;
  --muted-2: #6d778d;
  color: var(--text);
  background: linear-gradient(180deg, #0b0d14, #07080d);
}
html[data-theme="light"] .dash-mock {
  box-shadow: 0 34px 80px -46px rgba(15, 23, 42, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

/* ============================================================
   Theme switcher (3-state segmented control)
   ============================================================ */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.theme-switch button {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.theme-switch button:hover { color: var(--text); background: var(--surface-2); }
.theme-switch button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .theme-switch button[aria-pressed="true"] { color: var(--accent); }
html[data-theme="light"] .theme-switch button[aria-pressed="true"] { color: var(--accent); }

@media (max-width: 900px) {
  .nav-actions .btn-primary { display: none; }
}
@media (max-width: 640px) {
  .dash-search { display: none; }
  .theme-switch { height: 36px; }
  .theme-switch button { width: 26px; height: 26px; }
}
