/* ============================================================
   AllBoost — Premium SaaS theme
   Glassmorphism · Dark/Light · Smooth motion
   ============================================================ */

:root {
  --primary: #5B5FF8;
  --primary-rgb: 91, 95, 248;
  --secondary: #7C3AED;
  --accent: #00D4FF;
  --gradient: linear-gradient(135deg, #5B5FF8 0%, #7C3AED 100%);
  --gradient-accent: linear-gradient(135deg, #5B5FF8 0%, #00D4FF 100%);

  /* Light theme */
  --bg: #F8FAFC;
  --bg-soft: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --ring: rgba(91, 95, 248, 0.25);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --sidebar-w: 268px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --bg-soft: #0b1120;
  --surface: #1e293b;
  --surface-2: #172033;
  --glass: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --ring: rgba(91, 95, 248, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--secondary); }
h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -0.02em; color: var(--text); }

.text-muted { color: var(--text-muted) !important; }
.text-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.fw-800 { font-weight: 800; }
.container-xl { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }

/* ---- Decorative background blobs --------------------------------------- */
.bg-aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-aurora::before, .bg-aurora::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
}
.bg-aurora::before { width: 540px; height: 540px; background: var(--primary); top: -180px; left: -120px; }
.bg-aurora::after { width: 480px; height: 480px; background: var(--secondary); top: 10%; right: -160px; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  font-family: var(--font); font-weight: 600; border-radius: var(--radius-sm);
  padding: .62rem 1.15rem; border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s, border-color .2s;
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient); color: #fff; box-shadow: 0 8px 20px rgba(var(--primary-rgb), .35);
}
.btn-primary:hover { color:#fff; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(var(--primary-rgb), .45); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--primary); }
.btn-soft { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.btn-soft:hover { background: rgba(var(--primary-rgb), .18); color: var(--primary); }
.btn-danger { background: var(--danger); color:#fff; }
.btn-danger:hover { color:#fff; filter: brightness(1.05); }
.btn-success { background: var(--success); color:#fff; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .65; pointer-events: none; }
.btn.loading::after {
  content: ""; width: 1em; height: 1em; border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb), .4); }
.card-body { padding: 1.4rem; }
.glass {
  background: var(--glass); backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---- Stat cards -------------------------------------------------------- */
.stat-card { padding: 1.4rem; position: relative; overflow: hidden; }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.4rem; color: #fff; background: var(--gradient); box-shadow: 0 8px 20px rgba(var(--primary-rgb), .3);
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; margin: .6rem 0 .1rem; letter-spacing: -.03em; }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; font-weight: 500; }
.stat-card .stat-trend { font-size: .78rem; font-weight: 600; }
.stat-trend.up { color: var(--success); } .stat-trend.down { color: var(--danger); }

/* ---- Badges ------------------------------------------------------------ */
.badge-soft { padding: .3rem .65rem; border-radius: 30px; font-size: .74rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.badge-soft::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge-soft-success { background: rgba(34,197,94,.14); color: #16a34a; }
.badge-soft-warning { background: rgba(245,158,11,.16); color: #d97706; }
.badge-soft-danger  { background: rgba(239,68,68,.14); color: #dc2626; }
.badge-soft-info    { background: rgba(14,165,233,.14); color: #0284c7; }
.badge-soft-secondary { background: rgba(100,116,139,.16); color: #64748b; }
.badge-soft-dark    { background: rgba(15,23,42,.12); color: #475569; }
[data-theme="dark"] .badge-soft-success { color: #4ade80; }
[data-theme="dark"] .badge-soft-warning { color: #fbbf24; }
[data-theme="dark"] .badge-soft-danger { color: #f87171; }
[data-theme="dark"] .badge-soft-info { color: #38bdf8; }
[data-theme="dark"] .badge-soft-dark { color: #cbd5e1; }

/* ---- Forms ------------------------------------------------------------- */
.form-control, .form-select, textarea.form-control {
  width: 100%; padding: .7rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--text-muted); opacity: .8; }
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
.form-label { font-size: .85rem; font-weight: 600; margin-bottom: .4rem; display: block; color: var(--text); }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.input-group { display: flex; }
.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table thead th {
  text-align: left; padding: .9rem 1rem; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); background: var(--surface-2); font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---- Sidebar / dashboard shell ---------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); position: fixed; inset: 0 auto 0 0; z-index: 40;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.25rem 1.4rem; font-weight: 800; font-size: 1.25rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .8rem 2rem; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 700; margin: 1.1rem .8rem .4rem; }
.nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: .92rem; margin-bottom: .15rem; transition: all .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px rgba(var(--primary-rgb), .35); }
.nav-link .bi { font-size: 1.1rem; }
.nav-badge { margin-left: auto; background: var(--danger); color:#fff; font-size:.68rem; font-weight:700; padding:.1rem .45rem; border-radius: 20px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1.5rem; background: var(--glass); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
}
.page-content { padding: 1.75rem 1.5rem; flex: 1; animation: fadeUp .4s ease; }

.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--gradient); color: #fff;
  display: grid; place-items: center; font-weight: 800; box-shadow: 0 6px 16px rgba(var(--primary-rgb), .4); flex-shrink: 0;
}

/* ---- Avatar / icon bubbles -------------------------------------------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.avatar-sm { width: 30px; height: 30px; }
.icon-bubble { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: rgba(var(--primary-rgb), .12); color: var(--primary); }

/* ---- Dropdown ---------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
  display: block; position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: .4rem; opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 50;
}
.dropdown.open .dropdown-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dropdown-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; color: var(--text); font-size: .9rem; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-divider { height: 1px; background: var(--border); margin: .35rem 0; }

/* ---- Toasts ------------------------------------------------------------ */
#toast-stack { position: fixed; top: 1.1rem; right: 1.1rem; z-index: 9999; display: flex; flex-direction: column; gap: .6rem; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: .7rem; padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.21,1.02,.73,1); border-left: 4px solid var(--primary);
}
.toast.hide { animation: toastOut .3s forwards; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast .toast-icon { font-size: 1.25rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast .toast-title { font-weight: 700; font-size: .9rem; }
.toast .toast-msg { font-size: .83rem; color: var(--text-muted); }
.toast .toast-close { margin-left: auto; cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 1.1rem; }

/* ---- Modal ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: relative; display: block; top: auto; left: auto; height: auto;
  width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transform: translateY(16px) scale(.97);
  transition: transform .25s cubic-bezier(.21,1.02,.73,1); max-height: 90vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.4rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.15rem; margin: 0; }
.modal-body { padding: 1.4rem; }
.modal-footer { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 1.4rem; color: var(--text-muted); cursor: pointer; line-height: 1; }

/* ---- Skeleton loaders -------------------------------------------------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), .08), transparent);
  animation: shimmer 1.4s infinite;
}
.skeleton-line { height: 14px; margin-bottom: .6rem; }
.skeleton-line.w-60 { width: 60%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-80 { width: 80%; }

/* ---- Utilities --------------------------------------------------------- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}.mb-4{margin-bottom:2rem}
.w-100{width:100%}.text-center{text-align:center}.text-end{text-align:right}
.page-title { font-size: 1.6rem; font-weight: 800; }
.page-subtitle { color: var(--text-muted); font-size: .95rem; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

.hamburger { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text); cursor: pointer; }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; font-size: 1.15rem; color: var(--text); transition: .2s; }
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Pagination -------------------------------------------------------- */
.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: 1.25rem; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 .6rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border); color: var(--text); font-size: .88rem; font-weight: 600;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--gradient); color: #fff; border-color: transparent; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---- Empty state ------------------------------------------------------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .bi { font-size: 3rem; opacity: .5; display: block; margin-bottom: .75rem; }

/* ---- Animations -------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 1.1rem; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; display: none; }
  .sidebar-overlay.open { display: block; }
}

/* ---- Collapsing 2-column layout (sidebar/content split) ---------------- */
.grid-split { display: grid; gap: 1.25rem; grid-template-columns: var(--split, 1.6fr 1fr); }
@media (max-width: 860px) { .grid-split { grid-template-columns: 1fr; } }

/* ---- Mobile bottom navigation (shared by app + dashboard layouts) ------ */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(15,23,42,.08);
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: .68rem; font-weight: 600; font-family: var(--font); padding: .4rem 0; text-decoration: none;
  }
  .bottom-nav-item i { font-size: 1.25rem; }
  .bottom-nav-item.active { color: var(--primary); }
  .has-bottom-nav { padding-bottom: 5rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Bootstrap compatibility overrides --------------------------------- */
/* Bootstrap (loaded from CDN) ships its own light-only text/background colors
   on body, .card, tables, etc. Map Bootstrap's CSS variables onto our theme
   tokens so everything follows dark/light mode instead of staying #212529
   (which becomes invisible text on dark backgrounds). */
:root {
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-card-color: var(--text);
  --bs-card-bg: var(--surface);
  --bs-heading-color: var(--text);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--secondary);
}
body { color: var(--text); }
.card, .card-body, .list-group, .list-group-item, .table { color: var(--text); }
.text-muted, .text-secondary { color: var(--text-muted) !important; }

/* Our custom components reuse some Bootstrap class names (.modal, .toast,
   .dropdown-menu). Bootstrap hides these by default; re-assert our design. */
#toast-stack .toast { display: flex; opacity: 1; }
.modal-backdrop .modal { display: block; }
.dropdown .dropdown-menu { display: block; }
.modal-backdrop { --bs-backdrop-zindex: 1000; }
