/* ══════════════════════════════════════════════════════════════════
   ZELDRIS 2.0 — design layer
   Loaded AFTER zeldris.css — restyles every existing component class.
   ══════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── tokens ── */
:root {
  --bg: radial-gradient(1200px 800px at 80% -10%, rgba(99, 102, 241, 0.14), transparent 60%),
        radial-gradient(900px 700px at -10% 110%, rgba(139, 0, 0, 0.12), transparent 55%),
        linear-gradient(180deg, #0b0b10 0%, #0e0e15 40%, #0a0a0e 100%);
  --fg: #f4f4f5;
  --accent: #818cf8;
  --accent-2: #e11d48;
  --glass: rgba(24, 24, 30, 0.72);
  --glass-border: rgba(129, 140, 248, 0.14);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ── base ── */
body {
  background: var(--bg) fixed !important;
  color: var(--fg) !important;
  font-family: var(--font-ui) !important;
}
.mono, .font-mono, code, pre, input, td {
  font-family: var(--font-data) !important;
}

/* ambient glow layers behind everything */
body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: -2; pointer-events: none;
  background:
    radial-gradient(500px 320px at 12% 8%, rgba(225, 29, 72, 0.07), transparent 65%),
    radial-gradient(620px 420px at 88% 92%, rgba(99, 102, 241, 0.08), transparent 65%);
  animation: ambientDrift 24s ease-in-out infinite alternate;
}
@keyframes ambientDrift {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.9; }
  to   { transform: translate3d(-30px, 24px, 0) scale(1.06); opacity: 1; }
}
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: -1; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.035), transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(900px 620px at 50% 40%, #000 30%, transparent 100%);
}

/* ── glass panels ── */
.bg-ink-900, .bg-ink-800,
.bg-ink-900\/40, .bg-ink-800\/60, .bg-ink-950\/80 {
  background: var(--glass) !important;
  border: 1px solid rgba(129, 140, 248, 0.14) !important;
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.75),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}

/* ── buttons ── */
.btn {
  border-radius: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5 60%, #4338ca) !important;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35) !important;
}
.btn-primary:hover { box-shadow: 0 6px 26px rgba(99, 102, 241, 0.45) !important; }
.btn-ghost { background: rgba(129, 140, 248, 0.08) !important; border: 1px solid rgba(129, 140, 248, 0.22) !important; color: #a5b4fc !important; }
.btn-danger { background: linear-gradient(135deg, #e11d48, #be123c) !important; box-shadow: 0 4px 18px rgba(225, 29, 72, 0.3) !important; color: #fff !important; }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: #1c1917 !important; }

/* ── pills / status ── */
.pill {
  border-radius: 999px !important;
  font-weight: 600 !important;
  font-size: 10px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
}
.pill.ok { background: rgba(16, 185, 129, 0.12) !important; color: #6ee7b7 !important; border-color: rgba(16, 185, 129, 0.3) !important; box-shadow: 0 0 12px rgba(16, 185, 129, 0.15); }
.pill.bad, .pill.warn { background: rgba(244, 63, 94, 0.12) !important; color: #fda4af !important; border-color: rgba(244, 63, 94, 0.3) !important; box-shadow: 0 0 12px rgba(244, 63, 94, 0.15); }
.pill.info { background: rgba(129, 140, 248, 0.12) !important; color: #a5b4fc !important; border-color: rgba(129, 140, 248, 0.3) !important; }
.pill.muted { background: rgba(82, 82, 91, 0.2) !important; color: #a1a1aa !important; border-color: rgba(82, 82, 91, 0.3) !important; }

/* ── account rows ── */
.acct-row {
  background: rgba(24, 24, 30, 0.55) !important;
  border: 1px solid rgba(129, 140, 248, 0.1) !important;
  border-radius: 12px !important;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
}
.acct-row:hover {
  transform: translateY(-2px);
  border-color: rgba(129, 140, 248, 0.35) !important;
  box-shadow: 0 10px 32px -12px rgba(99, 102, 241, 0.35);
}
.acct-row.selected {
  border-color: rgba(129, 140, 248, 0.65) !important;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.14), rgba(24, 24, 30, 0.6)) !important;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35), 0 8px 40px -10px rgba(99, 102, 241, 0.45) !important;
}
.acct-row .email { letter-spacing: 0.01em; }

/* ── fa mailer: buckets + template cards ── */
.fam-cat {
  backdrop-filter: blur(10px) !important;
  transition: box-shadow 0.2s ease !important;
}
.fam-cat[open] { box-shadow: 0 14px 44px -14px rgba(0, 0, 0, 0.7); }
.tmpl-card {
  border-radius: 10px !important;
  background: rgba(12, 12, 14, 0.65) !important;
  border: 1px solid rgba(129, 140, 248, 0.14) !important;
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease !important;
  position: relative;
  overflow: hidden;
}
.tmpl-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.045) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.tmpl-card:hover { transform: translateY(-1px); border-color: rgba(129, 140, 248, 0.4) !important; }
.tmpl-card:hover::before { transform: translateX(120%); }
.tmpl-card.selected {
  border-color: rgba(129, 140, 248, 0.7) !important;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4), 0 10px 40px -8px rgba(99, 102, 241, 0.5),
              inset 0 0 24px rgba(99, 102, 241, 0.08) !important;
}

/* ── drawer + studio ── */
.drawer-panel {
  backdrop-filter: blur(18px) saturate(1.3) !important;
  background: linear-gradient(180deg, rgba(14, 14, 19, 0.92), rgba(10, 10, 14, 0.96)) !important;
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.6) !important;
}
#fam-studio-root > div {
  backdrop-filter: blur(20px) !important;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(129, 140, 248, 0.18) !important;
}
#fam-studio-frame { border-radius: 0 0 10px 10px; }

/* ── tool chips / results ── */
.tool-chip {
  border-radius: 9px !important;
  border: 1px solid rgba(129, 140, 248, 0.16) !important;
  background: rgba(24, 24, 30, 0.5) !important;
  transition: all 0.15s ease !important;
}
.tool-chip:hover { border-color: rgba(129, 140, 248, 0.45) !important; box-shadow: 0 4px 20px -6px rgba(99, 102, 241, 0.4); }
.tool-result {
  background: rgba(10, 10, 14, 0.75) !important;
  border: 1px solid rgba(129, 140, 248, 0.15) !important;
  border-radius: 12px !important;
  backdrop-filter: blur(10px);
}

/* ── toasts ── */
.toast-base {
  backdrop-filter: blur(16px) saturate(1.3) !important;
  border-radius: 12px !important;
  border: 1px solid rgba(129, 140, 248, 0.25) !important;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55) !important;
  font-family: var(--font-ui) !important;
}
.toast-ok { border-left: 3px solid #10b981 !important; }
.toast-bad, .toast-warn { border-left: 3px solid #f43f5e !important; }
.toast-info, .toast-muted { border-left: 3px solid #818cf8 !important; }

/* ── login ── */
#view-login { position: relative; overflow: hidden; }
#view-login::before, #view-login::after {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: orbFloat 14s ease-in-out infinite alternate;
  pointer-events: none;
}
#view-login::before { background: radial-gradient(circle, rgba(225, 29, 72, 0.35), transparent 70%); top: -12%; left: -8%; }
#view-login::after { background: radial-gradient(circle, rgba(99, 102, 241, 0.4), transparent 70%); bottom: -14%; right: -6%; animation-delay: -7s; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -26px) scale(1.12); }
}
#view-login form {
  background: linear-gradient(160deg, rgba(24, 24, 30, 0.85), rgba(12, 12, 16, 0.9)) !important;
  border: 1px solid rgba(129, 140, 248, 0.22) !important;
  border-radius: 18px !important;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06),
              0 0 80px rgba(99, 102, 241, 0.12) !important;
  backdrop-filter: blur(22px) saturate(1.3);
  position: relative; z-index: 1;
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#view-login .text-3xl {
  background: linear-gradient(120deg, #a5b4fc 20%, #e11d48 55%, #a5b4fc 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(99, 102, 241, 0.45));
  animation: brandPulse 5s ease-in-out infinite;
}
@keyframes brandPulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.35)); }
  50% { filter: drop-shadow(0 0 34px rgba(225, 29, 72, 0.4)); }
}
#login-user, #login-pw {
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}
#login-user:focus, #login-pw:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 0 24px rgba(99, 102, 241, 0.15) !important;
}

/* ── nav ── */
.nav-item {
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
  border-radius: 9px;
  position: relative;
}
.nav-item:hover { background: rgba(129, 140, 248, 0.08) !important; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.16), transparent 80%) !important;
  box-shadow: inset 3px 0 0 0 #818cf8 !important;
  color: #c7d2fe !important;
}

/* ── inputs ── */
input, textarea, select {
  border-radius: 8px !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}
input:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16) !important;
}

/* ── tables ── */
table th { font-weight: 600 !important; letter-spacing: 0.08em; }

/* ── scrollbars ── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(12, 12, 14, 0.6); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.35), rgba(129, 140, 248, 0.25));
  border-radius: 99px; border: 2px solid transparent;
}
::-webkit-scrollbar-thumb:hover { background: rgba(129, 140, 248, 0.55); }

/* ── skeleton shimmer for async loads ── */
.skeleton {
  background: linear-gradient(90deg, rgba(39, 39, 46, 0.4) 25%, rgba(63, 63, 74, 0.55) 50%, rgba(39, 39, 46, 0.4) 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.4s infinite !important;
  border-radius: 10px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ── badges ── */
.badge {
  border-radius: 999px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-link { background: rgba(225, 29, 72, 0.14) !important; color: #fda4af !important; border: 1px solid rgba(225, 29, 72, 0.3) !important; }
.badge-fields { background: rgba(129, 140, 248, 0.14) !important; color: #a5b4fc !important; border: 1px solid rgba(129, 140, 248, 0.3) !important; }

/* ── view transitions ── */
.view.active { animation: viewIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}