/* ═══════════════════════════════════════════════
   Warmup SaaS — Global Stylesheet
   ═══════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────── */
:root {
  --primary:       #667eea;
  --primary-dark:  #5a6fd6;
  --secondary:     #764ba2;
  --gradient:      linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --surface-2:     #f8f9fa;
  --border:        #e2e8f0;
  --text:          #1a202c;
  --text-muted:    #718096;
  --success:       #48bb78;
  --warning:       #ed8936;
  --danger:        #f56565;
  --info:          #4299e1;
  --sidebar-w:     240px;
  --radius:        12px;
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --transition:    all 0.2s ease;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Auth pages (login / register / otp) ─────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: var(--gradient);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
}
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.auth-logo p  { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* ── Form ──────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.form-control.error { border-color: var(--danger); }

.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.input-group .toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 4px;
}

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.925rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}
.btn-primary:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.825rem; border-radius: 6px; }

/* ── Alerts ────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 18px;
  display: none;
}
.alert.show { display: block; }
.alert-danger  { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #276749; }
.alert-warning { background: #fffaf0; border: 1px solid #feebc8; color: #c05621; }
.alert-info    { background: #ebf8ff; border: 1px solid #bee3f8; color: #2b6cb0; }

/* ── Auth footer ───────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-footer a { font-weight: 600; color: var(--primary); }

/* ── OTP input ─────────────────────────────────── */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
}
.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: var(--transition);
}
.otp-inputs input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

/* ── Loader spinner ────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   Dashboard Layout
   ═══════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #1e1e2d;
  color: #a0aec0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-brand .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a5568;
  padding: 8px 20px 6px;
  font-weight: 600;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #a0aec0;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item a.active {
  color: #fff;
  background: rgba(102,126,234,0.15);
  border-left-color: var(--primary);
}
.nav-item a .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info .u-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .u-plan {
  font-size: 0.72rem;
  color: #4a5568;
  text-transform: capitalize;
}
.logout-btn {
  background: none;
  border: none;
  color: #4a5568;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--danger); }

/* ── Main content ──────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-content { padding: 28px; flex: 1; }

/* ── Stats cards ───────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(102,126,234,0.12); color: var(--primary); }
.stat-icon.green  { background: rgba(72,187,120,0.12);  color: var(--success); }
.stat-icon.orange { background: rgba(237,137,54,0.12);  color: var(--warning); }
.stat-icon.blue   { background: rgba(66,153,225,0.12);  color: var(--info);    }
.stat-body {}
.stat-body .stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-body .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Card ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 0.975rem; font-weight: 700; color: var(--text); }
.card-body { padding: 20px 22px; }

/* ── Table ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ── Badge ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #c6f6d5; color: #276749; }
.badge-danger  { background: #fed7d7; color: #c53030; }
.badge-warning { background: #feebc8; color: #c05621; }
.badge-info    { background: #bee3f8; color: #2b6cb0; }
.badge-gray    { background: #e2e8f0; color: #4a5568; }

/* ── Toggle switch ─────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e0;
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Modal ─────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: translateY(-16px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Empty state ───────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ── Plan badge ────────────────────────────────── */
.plan-standard { color: var(--info);    background: #ebf8ff; }
.plan-pro      { color: var(--secondary); background: #faf5ff; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
  .page-content { padding: 16px; }
}

/* ── Utility ───────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-100 { width: 100%; }
.fw-600 { font-weight: 600; }
.small { font-size: 0.8rem; }
