/* ============================================================
   Xelvite Design System — Tokens + Base Styles
   ============================================================ */

:root {
  /* Color tokens */
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #818cf8;
  --color-accent: #7c3aed;
  --color-bg: #f8f9ff;
  --color-bg-alt: #eef1ff;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-muted: #555;
  --color-text-light: #999;
  --color-border: #e2e8f0;
  --color-error: #dc2626;
  --color-success: #16a34a;

  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-hero: clamp(2.25rem, 5vw, 3.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(79, 70, 229, 0.15);
  --shadow-btn: 0 4px 20px rgba(79, 70, 229, 0.35);
  --shadow-btn-hover: 0 6px 28px rgba(79, 70, 229, 0.45);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
}

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

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-10); }
.container--narrow { max-width: 480px; margin: 0 auto; padding: 0 var(--space-10); }

/* ---- Nav ---- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-10);
  max-width: 1200px;
  margin: 0 auto;
}

.logo { font-size: var(--font-size-2xl); font-weight: 700; color: var(--color-primary); letter-spacing: -0.5px; }
.logo span { color: var(--color-text); }

.nav-link {
  font-weight: 600;
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}
.nav-link:hover { background: var(--color-primary); color: #fff; }

.nav-links { display: flex; gap: var(--space-4); align-items: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: var(--font-size-base);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  text-align: center;
  width: 100%;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-btn-hover); color: #fff; }

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn--secondary:hover { background: var(--color-primary); color: #fff; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- Forms ---- */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--transition-fast);
  outline: none;
}
.form-input:focus { border-color: var(--color-primary); }
.form-input--error { border-color: var(--color-error); }

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
  min-height: 1rem;
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base);
}
.card:hover { transform: translateY(-4px); }
.card--static:hover { transform: none; }

.card__icon { font-size: 2rem; margin-bottom: var(--space-4); }
.card__title { font-size: var(--font-size-lg); margin-bottom: var(--space-2); }
.card__text { font-size: var(--font-size-sm); color: var(--color-text-muted); line-height: 1.55; }

/* ---- Auth pages ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-8);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: var(--font-size-2xl);
  text-align: center;
  margin-bottom: var(--space-2);
}

.auth-card .subtext {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-8);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.auth-inline-link {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
}

/* ---- Auth drawer ---- */
.auth-shell {
  position: relative;
  min-height: 100vh;
}

.auth-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.44);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 40;
}

.auth-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.16);
  transform: translateX(100%);
  transition: transform 260ms ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.auth-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-8) var(--space-8) var(--space-4);
}

.auth-drawer__eyebrow {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text);
}

.auth-drawer__close {
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.auth-drawer__content {
  padding: 0 var(--space-8) var(--space-8);
  overflow-y: auto;
}

.auth-drawer__title {
  font-size: 2.15rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
}

.auth-social-stack {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.auth-social-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 0.95rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: 500;
}

.auth-social-button:hover {
  border-color: #cbd5e1;
  color: var(--color-text);
}

.auth-social-icon {
  display: inline-flex;
  width: 1.25rem;
  justify-content: center;
  font-weight: 700;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.auth-drawer .form-input {
  background: #eaf1ff;
  border-color: #d7e3fa;
}

.auth-drawer .btn--primary {
  background: #101826;
  box-shadow: none;
}

.auth-drawer .btn--primary:hover {
  box-shadow: none;
  background: #0f172a;
}

.auth-drawer-open .auth-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.auth-drawer-open .auth-drawer {
  transform: translateX(0);
}

.auth-drawer-open .auth-shell__content {
  filter: saturate(0.95) brightness(0.85);
}

@media (max-width: 720px) {
  .auth-drawer {
    width: 100vw;
  }

  .auth-drawer__title {
    font-size: 1.85rem;
  }

  .auth-drawer__header,
  .auth-drawer__content {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

/* ---- Alert ---- */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
  display: none;
}
.alert--error { background: #fef2f2; color: var(--color-error); border: 1px solid #fecaca; display: block; }
.alert--success { background: #f0fdf4; color: var(--color-success); border: 1px solid #bbf7d0; display: block; }

/* ---- Dashboard ---- */
.dashboard-header {
  padding: var(--space-16) 0 var(--space-8);
  text-align: center;
}

.dashboard-header h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-2); }
.dashboard-header p { color: var(--color-text-muted); }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-light);
  font-size: var(--font-size-xs);
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.hidden { display: none !important; }
