/* CTOS dashboard design system — dark glass theme.
   Pairs with the Tailwind CDN config in layout.ejs (blurple + dark palette). */

:root {
  --blurple: #5865f2;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --bg-950: #07090e;
  --bg-900: #0b0e14;
  --bg-800: #11151d;
  --bg-700: #151a24;
  --bg-600: #1f2733;
  --border: rgba(255, 255, 255, 0.06);
  --text-dim: #9ca3af;
  --glow: 0 8px 30px rgba(88, 101, 242, 0.35);
}

* { scrollbar-width: thin; scrollbar-color: #2a3546 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3546; border-radius: 6px; border: 2px solid var(--bg-900); }
::-webkit-scrollbar-thumb:hover { background: #3b4757; }
::-webkit-scrollbar-corner { background: transparent; }

::selection { background: rgba(88, 101, 242, 0.45); color: #fff; }

/* ── Icon helper ─────────────────────────────────────────────────────────── */
.icon { display: block; flex-shrink: 0; }

/* ── App shell background: subtle ambient gradient ───────────────────────── */
body {
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(139, 92, 246, 0.09), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(88, 101, 242, 0.08), transparent 60%),
    var(--bg-900);
}

/* ── Glass cards ─────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(23, 28, 39, 0.55), rgba(14, 17, 24, 0.75));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: 1rem 1rem 0 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  pointer-events: none;
}
.card-hover { transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease; }
.card-hover:hover {
  border-color: rgba(88, 101, 242, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

/* Entrance animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s ease both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }
.fade-up-5 { animation-delay: 0.25s; }

/* ── Gradients & glow ────────────────────────────────────────────────────── */
.text-grad {
  background: linear-gradient(100deg, #818cf8, #a78bfa 45%, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bg-grad {
  background: linear-gradient(120deg, rgba(88, 101, 242, 0.16), rgba(139, 92, 246, 0.12) 45%, rgba(236, 72, 153, 0.12));
  border: 1px solid var(--border);
}
.glow-blurple { box-shadow: 0 0 0 1px rgba(88,101,242,.4), 0 8px 34px rgba(88,101,242,.3); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  transition: width 0.2s ease;
  border-right: 1px solid var(--border);
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sb-text, .sidebar.collapsed .nav-label,
.sidebar.collapsed .sb-user-name, .sidebar.collapsed .sb-user-id { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 0.625rem; }
.sidebar.collapsed .logo { justify-content: center; padding: 1rem 0; }

.logo { display: flex; align-items: center; gap: 0.65rem; padding: 1rem 1.1rem; }
.logo-badge {
  width: 36px; height: 36px; border-radius: 0.65rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blurple), var(--violet));
  font-weight: 900; color: #fff; font-size: 0.85rem;
  box-shadow: 0 4px 18px rgba(88, 101, 242, 0.5);
}
.logo-text { font-weight: 900; letter-spacing: -0.02em; font-size: 1.05rem; }

.nav-groups { flex: 1; padding: 0.35rem 0.7rem 0.5rem; }
.nav-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6b7280; padding: 1rem 0.6rem 0.35rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.65rem; margin-bottom: 2px;
  border-radius: 0.65rem; font-size: 0.875rem; font-weight: 500;
  color: #9ca3af; transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: #e5e7eb; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.22), rgba(88, 101, 242, 0.08));
  color: #fff;
}
.nav-link.active svg { color: #a5b4fc; }
.nav-sep { height: 1px; background: var(--border); margin: 0.5rem 0.4rem; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 14, 0.7);
  backdrop-filter: blur(16px);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 0.6rem;
  color: #9ca3af; border: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.input {
  background: rgba(17, 21, 29, 0.8);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  color: #f3f4f6;
  font-size: 0.875rem;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: #5865f2; box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25); outline: none; }
.input::placeholder { color: #6b7280; }
select.input option { background: #151922; color: #f3f4f6; }

.label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 0.4rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.55rem 1.05rem;
  border-radius: 0.6rem;
  font-size: 0.875rem; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #5865f2, #7453f5); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 20px rgba(88, 101, 242, 0.45); }
.btn-danger { background: #ed4245; color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 18px rgba(237, 66, 69, 0.35); }
.btn-success { background: #3ba55c; color: #fff; }
.btn-success:hover { box-shadow: 0 4px 18px rgba(59, 165, 92, 0.35); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, 0.12); color: #d1d5db; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn-sm { padding: 0.28rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table.data-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
table.data-table th {
  text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: #9ca3af; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-weight: 700;
}
table.data-table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid rgba(31, 39, 51, 0.5); vertical-align: middle; }
table.data-table tr { transition: background 0.12s ease; }
table.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
table.data-table tr:last-child td { border-bottom: none; }

/* ── Flash toast ─────────────────────────────────────────────────────────── */
#flash {
  animation: flashIn 0.35s ease both;
  border-radius: 0.8rem;
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Stat pills / chips ──────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.18rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  border: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #5865f2, #8b5cf6);
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.5);
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar { border-radius: 999px; object-fit: cover; flex-shrink: 0; }

/* ── Hero (home) ─────────────────────────────────────────────────────────── */
.hero-grad {
  position: relative;
  background:
    radial-gradient(900px 400px at 20% -20%, rgba(88, 101, 242, 0.35), transparent 60%),
    radial-gradient(700px 380px at 90% 10%, rgba(236, 72, 153, 0.18), transparent 55%),
    radial-gradient(700px 420px at 50% 120%, rgba(139, 92, 246, 0.25), transparent 60%),
    var(--bg-950);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.float-slow { animation: float 6s ease-in-out infinite; }
.float-slower { animation: float 9s ease-in-out infinite; }
