/* =========================================================================
   LeadFlow AI — Design Tokens
   Palette:  --bg-void #0A0A12 · --bg-panel #12121F · --violet #8B5CF6
             --blue #3B82F6 · --cyan #22D3EE · --mist rgba(255,255,255,.06)
   Type:     Display = Space Grotesk · Body = Inter · Data = JetBrains Mono
   Signature: the "radar scan" mark — concentric rings pulsing outward from
              the logo, standing in for LeadFlow's core act of detection.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --bg-void: #0a0a12;
  --bg-panel: #12121f;
  --bg-panel-2: #171726;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-border: rgba(255, 255, 255, 0.09);
  --text-primary: #eef0f8;
  --text-secondary: #9497ab;
  --text-muted: #6b6e83;

  --violet: #8b5cf6;
  --blue: #3b82f6;
  --cyan: #22d3ee;

  --gradient-brand: linear-gradient(115deg, var(--violet) 0%, var(--blue) 55%, var(--cyan) 100%);
  --gradient-glow: radial-gradient(circle, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0) 70%);

  --danger: #f87171;
  --success: #34d399;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-panel: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

/* ---------- Ambient background: aurora mesh ------------------------------ */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora-bg::before,
.aurora-bg::after {
  content: '';
  position: absolute;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.35;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora-bg::before {
  top: -20%;
  left: -10%;
  background: radial-gradient(circle, var(--violet), transparent 70%);
}
.aurora-bg::after {
  bottom: -25%;
  right: -10%;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
  animation-delay: -11s;
}
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6%, 4%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora-bg::before, .aurora-bg::after { animation: none; }
}

/* ---------- Auth pages ----------------------------------------------------*/
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  padding: 40px 36px 32px;
  animation: rise 0.5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Signature mark: radar scan behind the logo glyph */
.radar-mark {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.radar-mark .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.5);
  animation: ping 2.4s cubic-bezier(0,.5,.5,1) infinite;
}
.radar-mark .ring:nth-child(2) { animation-delay: 0.8s; }
.radar-mark .ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes ping {
  0%   { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.1); opacity: 0; }
}
.radar-mark .core {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: var(--gradient-brand);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.55);
}
@media (prefers-reduced-motion: reduce) {
  .radar-mark .ring { animation: none; opacity: 0.4; }
}

.auth-heading { text-align: center; margin-bottom: 28px; }
.auth-heading .brand { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.auth-heading h1 {
  font-size: 24px;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-heading p { color: var(--text-secondary); font-size: 14px; margin-top: 8px; }

/* ---------- Form elements ------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field .input-wrap { position: relative; }
.field input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--text-muted); }
.field input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.toggle-pw:hover { color: var(--text-secondary); }

/* ===== BUTTONS (matching index btn-primary) ===== */
/* ===== BUTTONS (matching index btn-primary) ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  font-size: clamp(0.9rem, 2vw, 0.95rem);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  min-height: 48px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-position 0.5s ease;
  background: linear-gradient(90deg, var(--violet), var(--blue), var(--violet));
  background-size: 200% auto;
  background-position: 0% center;
  color: #fff;
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover {
  transform: scale(1.05);
  background-position: 100% center;
  box-shadow: 0 8px 34px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary:active { transform: translateY(0); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.auth-footer { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.auth-footer a { color: var(--cyan); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

/* ---------- Alerts / flash messages --------------------------------------*/
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #fecaca; }
.alert-success { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.3); color: #a7f3d0; }

/* ---------- Dashboard shell ------------------------------------------------*/
.app-shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  padding: 22px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
}
.brand-row .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--gradient-brand);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.45);
}
.brand-row .name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; }
.brand-row .name span { color: var(--cyan); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(139,92,246,0.18), rgba(34,211,238,0.05));
  color: var(--text-primary);
  border: 1px solid rgba(139,92,246,0.25);
}

.main-content { flex: 1; padding: 28px 36px; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
}
.avatar-fallback {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #08080d;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(18px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); border-color: rgba(139,92,246,0.35); box-shadow: 0 16px 40px -20px rgba(0,0,0,0.6); }
.stat-card .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.stat-card .value { font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 600; }
.stat-card .value.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(18px);
  transition: border-color .18s ease;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .radar-mark { margin-bottom: 20px; }
.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto; }

.logout-link { color: var(--text-muted); font-size: 13px; }
.logout-link:hover { color: var(--danger); }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 5; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .main-content { padding: 20px; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 30px 22px; }
}
/* ===== LOGO (matching index page) ===== */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.auth-logo .logo-image {
  height: 50px;
  width: auto;
  object-fit: contain;
  display: inline-block;
}

.auth-logo .logo-text {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-1);
}

.auth-logo .logo-text span {
  color: var(--cyan);
}
/* ===== LOGO (matching index page) ===== */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.auth-logo .logo-image {
  height: 50px;
  width: auto;
  object-fit: contain;
  display: inline-block;
}

.auth-logo .logo-text {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-1);
}

.auth-logo .logo-text span {
  color: var(--cyan);
}
