/* ============================================================
   HUBIFY — Design System v1.0
   Premium Dark-Themed Modular AI Platform
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* -------------------------------------------------------
   0. CSS Custom Properties (Design Tokens)
   ------------------------------------------------------- */
:root {
  /* — Backgrounds (Apple Light Theme) — */
  --bg-base:        #f4f6fb;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-elevated:    #ffffff;
  --bg-hover:       #f1f5f9;
  --bg-input:       #f8fafc;

  /* — Accent palette — Apple Electric Blue (single-hue system) — */
  --primary:        #1665ff;
  --primary-light:  #0b62e6;
  --primary-dark:   #0047b3;
  --secondary:      #1665ff;
  --pink:           #ec4899;
  --emerald:        #10b981;
  --amber:          #f59e0b;
  --danger:         #ef4444;

  /* — Gradients — kept within the blue hue for a calm, Apple-like surface — */
  --gradient-primary: linear-gradient(135deg, #1665ff, #3d7dff);
  --gradient-hero:    linear-gradient(135deg, #1665ff, #3d7dff);
  --gradient-glow:    linear-gradient(135deg, rgba(22,101,255,.07), rgba(22,101,255,.02));

  /* — Text — Crisp & high-contrast slate — */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* — Borders & glass — */
  --border-subtle:  rgba(0, 0, 0, 0.05);
  --border-glass:   rgba(0, 0, 0, 0.08);
  --glass-bg:       rgba(255, 255, 255, 0.85);
  --glass-blur:     20px;

  /* — Shadows — Multi-layered soft ambient Apple shadows (cool, low-opacity) — */
  --shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
  --shadow-md:   0 2px 8px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --shadow-lg:   0 4px 16px rgba(15, 23, 42, 0.06), 0 24px 48px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 8px 24px rgba(22, 101, 255, 0.14);

  /* — Radius — Apple rounded curves — */
  --radius-sm:  10px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* — Transitions — */
  --ease-out:   cubic-bezier(.16, 1, .3, 1);
  --transition: .25s var(--ease-out);

  /* — Layout — */
  --sidebar-width:  260px;
  --nav-height:     68px;
  --container-max:  1240px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* — Custom Scrollbar — */
::-webkit-scrollbar              { width: 8px; height: 8px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: #d4dae8; border-radius: var(--radius-full); border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover  { background: #b9c2d6; }

/* — Custom Selection — */
::selection      { background: rgba(22,101,255,.20); color: var(--text-primary); }
::-moz-selection { background: rgba(22,101,255,.20); color: var(--text-primary); }

/* — Links — */
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

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

/* -------------------------------------------------------
   2. Typography
   ------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p       { color: var(--text-secondary); max-width: 65ch; }
small   { font-size: .85rem; color: var(--text-muted); }
strong  { font-weight: 600; color: var(--text-primary); }

.text-gradient {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* -------------------------------------------------------
   3. Layout Helpers
   ------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section { padding: 5rem 0; }

/* -------------------------------------------------------
   4. Navbar / Navigation
   ------------------------------------------------------- */
.nav,
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-glass);
  z-index: 1000;
  transition: background var(--transition);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
}

.nav .logo,
.navbar .logo,
.navbar__logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.navbar__logo-icon {
  font-size: 1.2rem;
  color: var(--primary);
  -webkit-text-fill-color: initial;
}

.nav-links,
.navbar__links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a,
.navbar__link {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
  text-decoration: none;
}

.nav-links a::after,
.navbar__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform var(--transition);
}

.nav-links a:hover,
.navbar__link:hover { color: var(--text-primary); }

.nav-links a:hover::after,
.nav-links a.active::after,
.navbar__link:hover::after,
.navbar__link.active::after { transform: scaleX(1); }

.nav-links a.active,
.navbar__link.active { color: var(--text-primary); }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* -------------------------------------------------------
   5. Hero Section
   ------------------------------------------------------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 800px;
  position: relative;
  z-index: 2;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  border-radius: var(--radius-full);
  background: rgba(22,101,255,.10);
  border: 1px solid rgba(22,101,255,.22);
  color: var(--primary-light);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.hero__badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
}

.hero h1,
.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  animation: fadeInUp .8s var(--ease-out) both;
}

.hero p,
.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: 2.5rem;
  color: var(--text-secondary);
  animation: fadeInUp .8s .15s var(--ease-out) both;
}

.hero-actions,
.hero__cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeInUp .8s .3s var(--ease-out) both;
}

.hero::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22,101,255,.12), transparent 70%);
  top: -10%; left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  animation: float 8s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22,101,255,.06), transparent 70%);
  bottom: 10%; right: 5%;
  pointer-events: none;
  animation: float 10s ease-in-out infinite reverse;
}

.hero__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
}

.hero__orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(22,101,255,.16), transparent 70%);
  top: -10%; left: 30%;
  animation: float 8s ease-in-out infinite;
}

.hero__orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(22,101,255,.10), transparent 70%);
  bottom: 10%; right: 10%;
  animation: float 10s ease-in-out infinite reverse;
}

.hero__orb--3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(22,101,255,.07), transparent 70%);
  top: 40%; left: 10%;
}

/* -------------------------------------------------------
   6. Cards & Features
   ------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glass);
}

.card-glass,
.feature-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card-glass:hover,
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glass);
}

.feature-card__icon {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.feature-card__title {
  font-size: 1.2rem;
  margin-bottom: .5rem;
}

.feature-card__desc {
  font-size: .9rem;
  color: var(--text-secondary);
}

.features__grid,
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* -------------------------------------------------------
   7. Module Cards
   ------------------------------------------------------- */
.modules__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--module-accent, var(--gradient-primary));
  opacity: 0.8;
  transition: opacity var(--transition);
}

.module-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glass);
}

.module-card:hover::before { opacity: 1; }

.module-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-card .module-icon,
.module-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--gradient-glow);
  border: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.module-card__badge {
  font-size: .75rem;
  padding: .2rem .65rem;
  border-radius: var(--radius-full);
  background: rgba(245,158,11,.15);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,.25);
  font-weight: 500;
}

.module-card .module-title,
.module-card__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.module-card .module-desc,
.module-card__desc {
  font-size: .9rem;
  color: var(--text-secondary);
}

/* -------------------------------------------------------
   8. Buttons
   ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.6rem;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:active { transform: scale(.97); }

/* Primary */
.btn-primary,
.btn--primary {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 4px 14px rgba(22,101,255,.22);
}

.btn-primary:hover,
.btn--primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(15,23,42,.10), 0 8px 22px rgba(22,101,255,.28);
  transform: translateY(-1px);
  color: #fff !important;
}

/* Secondary */
.btn-secondary,
.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover,
.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(15,23,42,.14);
  transform: translateY(-1px);
}

/* Danger */
.btn-danger,
.btn--danger {
  background: var(--danger);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(239,68,68,.30);
}

.btn-danger:hover,
.btn--danger:hover {
  box-shadow: 0 6px 25px rgba(239,68,68,.45);
  transform: translateY(-2px);
  color: #fff !important;
}

/* Ghost */
.btn-ghost,
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover,
.btn--ghost:hover {
  color: var(--text-primary);
  background: rgba(15,23,42,.04);
  border-color: var(--border-glass);
}

.btn-lg,
.btn--large {
  padding: .9rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* Section Header & Dividers */
.section-padding { padding: 5rem 0; }
.section-divider { border: none; height: 1px; background: var(--border-subtle); margin: 0; }

.section__header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3.5rem;
}

.section__label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: block;
  margin-bottom: .5rem;
}

.section__title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: .75rem;
}

.section__subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 0;
  background: var(--bg-surface);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer__copy { font-size: .9rem; color: var(--text-muted); }
.footer__credit { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }
.footer__credit-icon { color: var(--primary); }

.footer__links {
  display: flex;
  gap: 1.5rem;
}

.footer__link {
  font-size: .9rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer__link:hover { color: var(--text-primary); }

/* Sizes */
.btn-sm { padding: .45rem 1rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .9rem  2rem; font-size: 1rem;  border-radius: var(--radius-lg); }

/* Pulse CTA */
.btn-pulse {
  animation: pulse 2.5s ease-in-out infinite;
}

/* -------------------------------------------------------
   9. Forms
   ------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: .75rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,101,255,.15);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: .8rem;
  color: var(--text-muted);
}

.form-error {
  font-size: .8rem;
  color: var(--danger);
}

/* -------------------------------------------------------
   10. Dashboard Grid
   ------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* -------------------------------------------------------
   11. Stats Card
   ------------------------------------------------------- */
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stats-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stats-card .stats-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stats-card .stats-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stats-card .stats-change {
  font-size: .8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.stats-card .stats-change.up   { color: var(--emerald); }
.stats-card .stats-change.down { color: var(--danger); }

/* -------------------------------------------------------
   12. Sidebar
   ------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar .sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar .sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.sidebar .sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.sidebar .sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar .sidebar-link.active {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 4px 14px rgba(22,101,255,.28);
}

.sidebar .sidebar-link .link-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* -------------------------------------------------------
   13. Tables
   ------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th {
  text-align: left;
  padding: .9rem 1.25rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* -------------------------------------------------------
   14. Badges
   ------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: .02em;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-active {
  background: rgba(16,185,129,.12);
  color: var(--emerald);
  border-color: rgba(16,185,129,.25);
}

.badge-inactive {
  background: rgba(239,68,68,.10);
  color: var(--danger);
  border-color: rgba(239,68,68,.20);
}

.badge-admin {
  background: rgba(22,101,255,.12);
  color: var(--primary-light);
  border-color: rgba(22,101,255,.25);
}

.badge-user {
  background: rgba(245,158,11,.10);
  color: var(--amber);
  border-color: rgba(245,158,11,.20);
}

/* -------------------------------------------------------
   15. Modal
   ------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
}

.modal-close {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(15,23,42,.05);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* -------------------------------------------------------
   16. Toast Notifications
   ------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  min-width: 300px;
  max-width: 420px;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .75rem;
  z-index: 3000;
  animation: slideInRight .4s var(--ease-out) both;
}

.toast-success { border-left: 3px solid var(--emerald); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--amber); }
.toast-info    { border-left: 3px solid var(--primary); }

.toast-icon    { font-size: 1.2rem; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--emerald); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-info    .toast-icon { color: var(--primary); }

/* -------------------------------------------------------
   17. Alerts
   ------------------------------------------------------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.alert-info {
  background: rgba(22,101,255,.08);
  border: 1px solid rgba(22,101,255,.20);
  color: var(--primary-light);
}

.alert-warning {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.20);
  color: var(--amber);
}

.alert-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.20);
  color: var(--danger);
}

.alert-success {
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.20);
  color: var(--emerald);
}

/* -------------------------------------------------------
   18. Loader & Skeleton
   ------------------------------------------------------- */
.loader {
  width: 36px; height: 36px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loader-sm { width: 20px; height: 20px; border-width: 2px; }
.loader-lg { width: 48px; height: 48px; border-width: 4px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text   { height: 14px; margin-bottom: .6rem; }
.skeleton-title  { height: 22px; width: 60%; margin-bottom: .8rem; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }
.skeleton-card   { height: 180px; border-radius: var(--radius-lg); }

/* -------------------------------------------------------
   19. Avatar
   ------------------------------------------------------- */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-glass);
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  color: var(--primary-light);
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.6rem; border-width: 3px; }

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -10px; border: 2px solid var(--bg-card); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* -------------------------------------------------------
   20. Dropdown
   ------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: .4rem;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .85rem;
  font-size: .875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: .35rem 0;
}

/* -------------------------------------------------------
   21. 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;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateY(-50%) translateX(20px);
  background: #fff;
}

/* -------------------------------------------------------
   22. Keyframe Animations
   ------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(22,101,255,.28); }
  50%      { box-shadow: 0 4px 30px rgba(22,101,255,.45); }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-20px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* -------------------------------------------------------
   23. Utility Classes
   ------------------------------------------------------- */
/* Display */
.hidden      { display: none !important; }
.flex        { display: flex; }
.inline-flex { display: inline-flex; }
.grid        { display: grid; }
.block       { display: block; }

/* Flex helpers */
.flex-col       { flex-direction: column; }
.flex-wrap      { flex-wrap: wrap; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-1  { gap: .25rem; }
.gap-2  { gap: .5rem; }
.gap-3  { gap: .75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }

/* Text alignment */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* Spacing — margin top/bottom */
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12{ margin-top: 3rem; }

.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12{ margin-bottom: 3rem; }

/* Padding */
.p-2  { padding: .5rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.p-8  { padding: 2rem; }
.px-4 { padding-inline: 1rem; }
.py-4 { padding-block: 1rem; }

/* Width */
.w-full { width: 100%; }

/* Overflow */
.overflow-hidden { overflow: hidden; }

/* Animations */
.animate-fade-in    { animation: fadeIn    .5s var(--ease-out) both; }
.animate-fade-in-up { animation: fadeInUp  .5s var(--ease-out) both; }
.animate-slide-in   { animation: slideInRight .5s var(--ease-out) both; }
.animate-scale-in   { animation: scaleIn   .4s var(--ease-out) both; }

/* Stagger delays for lists */
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .10s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .20s; }
.delay-5 { animation-delay: .25s; }
.delay-6 { animation-delay: .30s; }

/* Text colours */
.text-primary   { color: var(--primary-light) !important; }
.text-emerald   { color: var(--emerald) !important; }
.text-pink      { color: var(--pink) !important; }
.text-amber     { color: var(--amber) !important; }
.text-danger    { color: var(--danger) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* Truncate */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Visual-only divider */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 1.5rem 0;
}

/* -------------------------------------------------------
   24. Responsive
   ------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .nav-links { display: none; }

  .hero h1 { font-size: 2rem; }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: 95%;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .toast {
    left: 1rem;
    right: 1rem;
    min-width: auto;
  }

  .section { padding: 3rem 0; }
}

@media (max-width: 480px) {
  html { font-size: 15px; }

  .btn { padding: .6rem 1.2rem; font-size: .85rem; }
  .hero { padding: 5rem 1rem 3rem; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
}

/* -------------------------------------------------------
   25. Print
   ------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .nav, .navbar, .sidebar, .toast, .modal-overlay { display: none !important; }
  .card, .card-glass, .stats-card, .module-card {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
  }
}
