/* ============================================================
   ApexBooks — Shared Design System
   Loaded by every page so the whole project looks and behaves
   like ONE consistent product instead of several stitched pages.
   ============================================================ */

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

:root {
  /* Brand palette (kept identical across every page) */
  --cream: #f8f9fa;
  --ink: #0f172a;
  --ink-muted: #475569;
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --success: #10b981;
  --success-bg: #f0fdf4;
  --success-text: #166534;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --warning-bg: #fef3c7;
  --warning-text: #b45309;

  /* Layout tokens */
  --nav-h: 70px;
  --sidebar-w: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --page-max: 1320px;
  --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.05);
  --shadow-lift: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Playfair Display', Georgia, serif;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 0.65rem 1.4rem; border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: all .18s ease; text-decoration: none; border: none;
  white-space: nowrap;
}
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--ink); background: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-lg { padding: 0.85rem 2.25rem; font-size: 1rem; font-weight: 700; width: auto; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert { padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 1.5rem; font-weight: 500; line-height: 1.5; }
.alert ul { padding-left: 1.25rem; margin-top: .25rem; }
.alert-danger { background: var(--error-bg); color: var(--error-text); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fde68a; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.15rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--ink); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.03em; }
.form-control {
  width: 100%; padding: 0.7rem 1rem; font-family: inherit; font-size: 0.95rem;
  background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--ink); outline: none; transition: all 0.18s;
}
.form-control:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }
.form-control[readonly] { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---------- Utility ---------- */
.container { max-width: var(--page-max); margin: 0 auto; padding: 0 2rem; }
.center { text-align: center; }
.text-muted { color: var(--ink-muted); }
.badge-pill { display: inline-flex; align-items: center; padding: 0.3rem 0.9rem; border-radius: 50px; font-weight: 700; font-size: 0.8rem; }

/* Scroll-reveal helper used on the storefront */
.animate { opacity: 0; transform: translateY(18px); transition: all 0.6s ease-out; }
.animate.visible { opacity: 1; transform: translateY(0); }

/* ---------- Off-canvas sidebar toggle (dashboards) ---------- */
.sidebar-toggle {
  display: none;
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm);
  width: 42px; height: 42px; align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-toggle svg { width: 22px; height: 22px; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  z-index: 199;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 1024px) {
  .container { padding: 0 1.25rem; }
}
