/* ═══════════════════════════════════════════════════════════════════
   www-shared.css — Shared theme, base styles, nav, buttons, footer
   Used by: www-home.html, www-agent-don.html, future agent pages
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
body.auth-pending > *:not(#auth-loading):not(script) { display: none; }
.auth-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); font-size: 1.1rem; color: var(--text-muted);
}
.spinner {
  width: 24px; height: 24px; border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--accent, #7c3aed); border-radius: 50%;
  animation: spin .8s linear infinite; margin-right: 12px;
}
html.dark .spinner { border-color: rgba(255,255,255,0.1); border-top-color: var(--accent, #818CF8); }
@keyframes spin { to { transform: rotate(360deg); } }

h1, h2, h3, h4 { font-family: 'Inter', sans-serif; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Agent Colors (constant) ──────────────────────────────────── */
:root {
  --don: #3B82F6;
  --ray: #10B981;
  --sol: #F59E0B;
  --max: #EF4444;
  --ivy: #8B5CF6;
  --bud: #06B6D4;
  --joy: #EC4899;
  --maestro: #6366F1;
}

/* ── Light Mode Core (default) ────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: rgba(255,255,255,1);
  --border-card: rgba(0,0,0,0.08);
  --text: #1e293b;
  --text-heading: #0d3868;
  --text-muted: #64748b;

  /* Nav */
  --nav-bg: rgba(255,255,255,0.9);
  --nav-border: rgba(0,0,0,0.06);
  --nav-text: #64748b;
  --nav-text-hover: #0d3868;

  /* Dropdown */
  --dropdown-bg: rgba(255,255,255,0.98);
  --dropdown-border: rgba(0,0,0,0.08);
  --dropdown-hover: rgba(0,0,0,0.04);
  --dropdown-shadow: 0 12px 40px rgba(0,0,0,.12);

  /* Cards */
  --card-shadow: 0 4px 24px rgba(0,0,0,0.06);
  --card-hover-lift: 0 8px 32px rgba(0,0,0,0.1);
  --glass-blur: blur(8px);
  --glow-opacity: 0.12;

  /* Problem gradient (shared across pages) */
  --gradient-problem: linear-gradient(135deg, #dc2626, #f59e0b);

  /* UI chrome */
  --footer-border: rgba(0,0,0,0.06);
  --signout-bg: rgba(0,0,0,0.04);
  --signout-border: rgba(0,0,0,0.08);
  --signout-hover: rgba(0,0,0,0.08);
  --btn-outline-border: rgba(0,0,0,0.15);
  --btn-outline-hover-bg: rgba(0,0,0,0.04);
  --btn-outline-hover-border: rgba(0,0,0,0.25);
  --btn-white-bg: #0d3868;
  --btn-white-color: #fff;
  --section-alt-glow: rgba(124,58,237,0.03);
  --cta-glow: rgba(124,58,237,0.06);
}

/* ── Dark Mode Core ───────────────────────────────────────────── */
html.dark {
  --bg: #0B0F1A;
  --bg-alt: #0B0F1A;
  --bg-card: rgba(255,255,255,0.04);
  --border-card: rgba(255,255,255,0.08);
  --text: #F1F5F9;
  --text-heading: #ffffff;
  --text-muted: #94A3B8;

  --nav-bg: rgba(11,15,26,0.85);
  --nav-border: rgba(255,255,255,0.06);
  --nav-text: #94A3B8;
  --nav-text-hover: #fff;

  --dropdown-bg: rgba(15,20,35,0.95);
  --dropdown-border: rgba(255,255,255,0.1);
  --dropdown-hover: rgba(255,255,255,0.06);
  --dropdown-shadow: 0 12px 40px rgba(0,0,0,.4);

  --card-shadow: none;
  --card-hover-lift: none;
  --glass-blur: blur(12px);
  --glow-opacity: 0.25;

  --gradient-problem: linear-gradient(135deg, #EF4444, #F59E0B);

  --footer-border: rgba(255,255,255,0.06);
  --signout-bg: rgba(255,255,255,0.06);
  --signout-border: rgba(255,255,255,0.1);
  --signout-hover: rgba(255,255,255,0.1);
  --btn-outline-border: rgba(255,255,255,0.15);
  --btn-outline-hover-bg: rgba(255,255,255,0.05);
  --btn-outline-hover-border: rgba(255,255,255,0.3);
  --btn-white-bg: #fff;
  --btn-white-color: #0B0F1A;
  --section-alt-glow: rgba(99,102,241,0.05);
  --cta-glow: rgba(99,102,241,0.15);
}

/* ── Utility Classes ──────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 96px 0; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.fade-in { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

.gradient-text {
  background: var(--gradient-heading);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: 10px; font-weight: 600; font-size: .95rem;
  border: none; cursor: pointer; transition: all .3s;
}
.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px var(--btn-glow, rgba(124,58,237,0.3)), 0 4px 16px var(--btn-glow, rgba(124,58,237,0.2));
}
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--btn-outline-border);
}
.btn-outline:hover {
  border-color: var(--btn-outline-hover-border);
  background: var(--btn-outline-hover-bg);
  transform: translateY(-1px);
}
.btn-white {
  background: var(--btn-white-bg); color: var(--btn-white-color); font-weight: 700;
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.badge {
  display: inline-block; padding: 6px 14px; border-radius: 20px;
  font-size: .8rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
}

/* ── Nav ──────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
  transition: background .3s;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.nav-logo {
  font-weight: 800; font-size: 1.15rem;
  color: var(--text-heading); display: flex; align-items: center; gap: 8px;
}
.nav-logo img { width: 28px; height: 28px; border-radius: 50%; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a { font-size: .9rem; font-weight: 500; color: var(--nav-text); transition: color .2s; }
.nav-links a:hover { color: var(--nav-text-hover); }
.nav-links a.active { color: var(--nav-text-hover); font-weight: 600; }
.nav-links .dropdown { position: relative; }
.nav-links .dropdown-trigger {
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  color: var(--nav-text); font-size: .9rem; font-weight: 500;
}
.nav-links .dropdown-trigger:hover { color: var(--nav-text-hover); }
.nav-links .dropdown-trigger::after { content: '\25BE'; font-size: .7rem; }
.nav-links .dropdown-menu {
  position: absolute; top: 100%; left: -16px; margin-top: 12px;
  background: var(--dropdown-bg); border: 1px solid var(--dropdown-border);
  border-radius: 12px; backdrop-filter: blur(16px);
  box-shadow: var(--dropdown-shadow); padding: 8px; min-width: 280px;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all .2s;
}
.nav-links .dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 8px; transition: background .15s;
}
.dropdown-item:hover { background: var(--dropdown-hover); }
.dropdown-item.current { background: rgba(59,130,246,0.1); }
.dropdown-item .agent-avatar-mini {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.dropdown-item .agent-label { font-weight: 600; font-size: .88rem; color: var(--text-heading); }
.dropdown-item .agent-desc { font-size: .78rem; color: var(--text-muted); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: 16px; }
.nav-mobile { display: none; background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--text-heading); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile { display: block; }
  .nav-right .nav-cta { display: none; }
}

/* ── Section Alt Background ───────────────────────────────────── */
.section-alt { position: relative; }
.section-alt::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--section-alt-glow) 0%, transparent 60%);
  pointer-events: none;
}

/* ── CTA Section ──────────────────────────────────────────────── */
.cta-section {
  position: relative; overflow: hidden; text-align: center;
}
.cta-section::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, var(--cta-glow) 0%, transparent 60%);
  pointer-events: none;
}
.cta-section h2 { font-size: 2.4rem; margin-bottom: 16px; color: var(--text-heading); position: relative; z-index: 1; }
.cta-section p { color: var(--text-muted); font-size: 1.1rem; max-width: 560px; margin: 0 auto 32px; position: relative; z-index: 1; }
.cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  padding: 48px 0; border-top: 1px solid var(--footer-border);
  display: flex; justify-content: space-between; align-items: center;
}
.footer-left { font-size: .85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: .85rem; color: var(--text-muted); transition: color .2s; }
.footer-links a:hover { color: var(--text-heading); }
@media (max-width: 600px) {
  .footer { flex-direction: column; gap: 16px; text-align: center; }
}

/* ── Sign Out & Theme Toggle ──────────────────────────────────── */
.signout-btn {
  position: fixed; top: 10px; right: 16px; z-index: 200;
  background: var(--signout-bg); border: 1px solid var(--signout-border);
  padding: 6px 14px; border-radius: 6px; font-size: .78rem; cursor: pointer;
  color: var(--text-muted); transition: all .2s;
}
.signout-btn:hover { background: var(--signout-hover); color: var(--text-heading); }

.theme-toggle {
  background: var(--signout-bg); border: 1px solid var(--signout-border);
  padding: 6px 12px; border-radius: 6px; font-size: .78rem; cursor: pointer;
  color: var(--text-muted); transition: all .2s;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.theme-toggle:hover { background: var(--signout-hover); color: var(--text-heading); }
