/* =============================================
   MATHEDEN - Shared Styles
   ============================================= */

:root {
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  
  --green-800: #2c3e2f;
  --green-900: #1f2e21;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  --bg-warm: #fffaf0;
  --bg-warm-light: #fef9e6;
  
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-2xl: 44px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 35px -12px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 30px 45px -15px rgba(0, 0, 0, 0.2);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(145deg, var(--bg-warm) 0%, var(--bg-warm-light) 100%);
  color: var(--gray-800);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
  position: relative;
  z-index: 2;
}

/* ─── Navbar ─────────────────────────────────── */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0 20px;
  border-bottom: 2px solid rgba(251, 191, 36, 0.4);
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 8px;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--orange-600), var(--orange-700));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: #3b4e5e;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover {
  color: var(--orange-600);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--orange-500);
  transition: width 0.2s;
  border-radius: 2px;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-email {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ─── Buttons ────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--orange-500);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background: var(--orange-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--orange-500);
  color: var(--orange-500);
  padding: 10px 26px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-outline:hover {
  background: var(--orange-50);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.9rem;
}

.btn-ghost:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}

.btn-large {
  padding: 16px 36px;
  font-size: 1.05rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Footer ─────────────────────────────────── */

footer {
  text-align: center;
  padding: 48px 0 32px;
  border-top: 2px solid var(--orange-100);
  margin-top: 60px;
  color: #5a4a2e;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--orange-600);
  margin-bottom: 8px;
}

.footer-text {
  color: var(--gray-500);
  font-size: 0.9rem;
}

/* ─── Modal ──────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-xl);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-400);
}

.modal-close:hover {
  color: var(--gray-700);
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.auth-tab.active {
  color: var(--orange-600);
  border-bottom-color: var(--orange-500);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
  color: var(--gray-800);
}

.auth-subtitle {
  color: #059669;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #ffffff;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
  margin-bottom: 4px;
  font-family: var(--font-sans);
}

.btn-google:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--gray-400);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: #5a3e1b;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--orange-200);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.auth-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 20px;
}

/* ─── Toast ──────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
  max-width: 380px;
}

.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Responsive ─────────────────────────────── */

@media (max-width: 768px) {
  .container { padding: 0 20px; }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 16px;
  }

  /* Auth modal: scrollable, fits small screens */
  .modal {
    max-height: 92vh;
    overflow-y: auto;
    margin: 0 12px;
    padding: 28px 22px;
    border-radius: var(--radius-lg);
  }

  /* Prevent iOS Safari zoom on inputs under 16px */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
  }
}