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

:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --accent: #10B981;
  --accent-dark: #059669;
  --bg: #F9FAFB;
  --bg-card: #FFFFFF;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* ===== Typography ===== */
h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-section { padding: 80px 0; }

/* ===== Navbar ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.navbar-brand {
  font-size: 1.25rem; font-weight: 800; color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.navbar-brand span { color: var(--text); }
.navbar-links { display: flex; gap: 32px; align-items: center; }
.navbar-links a {
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: color var(--transition);
}
.navbar-links a:hover { color: var(--primary); }
.navbar-auth { display: flex; gap: 12px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border-light); border-color: var(--text-muted); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn-ghost { background: none; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { color: var(--primary); background: var(--border-light); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.875rem; font-family: var(--font);
  background: var(--bg-card); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 0.8125rem; margin-top: 4px; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-header { margin-bottom: 16px; }
.card-title { font-size: 1.125rem; font-weight: 600; }
.card-body { }

/* ===== Hero ===== */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDF4 50%, #FEF3C7 100%);
}
.hero h1 { margin-bottom: 20px; }
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: 1.125rem; color: var(--text-secondary); max-width: 640px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Features Grid ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.feature-card {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: #EEF2FF; border-radius: var(--radius-sm);
  font-size: 1.5rem; margin-bottom: 16px;
}
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.875rem; }

/* ===== Pricing ===== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: start;
}
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
}
.pricing-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-md);
}
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff;
  padding: 4px 16px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.pricing-name { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.pricing-price { font-size: 2.5rem; font-weight: 800; margin-bottom: 4px; }
.pricing-price span { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }
.pricing-setup { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 8px; }
.pricing-messages { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 24px; font-weight: 500; }
.pricing-features { list-style: none; text-align: left; margin-bottom: 28px; }
.pricing-features li {
  padding: 8px 0; font-size: 0.875rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-light);
}
.pricing-features li::before { content: "✓"; color: var(--accent); font-weight: 700; }

/* ===== Auth Forms ===== */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #EEF2FF 0%, #F9FAFB 100%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { text-align: center; margin-bottom: 8px; }
.auth-card .auth-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 28px; font-size: 0.875rem; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--text-secondary); }

/* ===== Dashboard ===== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 64px);
}
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}
.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-secondary); transition: all var(--transition);
}
.sidebar-nav a:hover { background: var(--border-light); color: var(--text); }
.sidebar-nav a.active { background: #EEF2FF; color: var(--primary); font-weight: 600; }
.dashboard-main { padding: 32px; }
.dashboard-header { margin-bottom: 32px; }
.dashboard-header h1 { font-size: 1.75rem; }
.dashboard-header p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }

/* ===== Stats Grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.stat-label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-change { font-size: 0.75rem; margin-top: 4px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
th { font-weight: 600; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Status Badges ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* ===== Usage Bar ===== */
.usage-bar-wrap { margin-bottom: 8px; }
.usage-bar {
  height: 8px; background: var(--border-light); border-radius: 999px; overflow: hidden;
}
.usage-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transition: width 0.5s ease;
}
.usage-bar-fill.warning { background: linear-gradient(90deg, var(--warning) 0%, var(--danger) 100%); }
.usage-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); }

/* ===== File Upload ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px; text-align: center;
  cursor: pointer; transition: all var(--transition);
}
.upload-zone:hover { border-color: var(--primary); background: #EEF2FF; }
.upload-zone.dragover { border-color: var(--primary); background: #EEF2FF; }
.upload-zone p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 8px; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; margin-bottom: 16px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }

/* ===== Footer ===== */
.footer {
  background: var(--text);
  color: #D1D5DB;
  padding: 48px 0 24px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer h4 { color: #fff; margin-bottom: 12px; font-size: 0.875rem; }
.footer p, .footer a { font-size: 0.8125rem; color: #9CA3AF; }
.footer a:hover { color: #fff; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 20px;
  font-size: 0.75rem; color: #6B7280;
  text-align: center;
}

/* ===== Loading ===== */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  color: #fff; font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--accent); }
.toast-error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  .hero { padding: 60px 0 40px; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .navbar-links { display: none; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
