/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1a1d2e;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: #4361ee;
  --topbar-height: 64px;
  --transition: 0.2s ease;
}

/* ── Reset / Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
[x-cloak] { display: none !important; }

/* ── Auth Pages ──────────────────────────────────────────────────────────── */
.auth-page {
  background: linear-gradient(135deg, #1a1d2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
}
.auth-card {
  border-radius: 16px;
  animation: fadeInUp 0.4s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-layout {
  background: #f5f7fa;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  flex-shrink: 0;
}
.sidebar-admin { background: #0f1624; }

.sidebar .nav-link {
  color: rgba(255,255,255,0.65);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  transition: var(--transition);
}
.sidebar .nav-link:hover {
  color: #fff;
  background: var(--sidebar-hover);
}
.sidebar .nav-link.active {
  color: #fff;
  background: var(--sidebar-active);
  font-weight: 600;
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  min-width: 0;        /* prevents flex child overflow */
  overflow-x: hidden;
  width: 100%;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  background: #fff;
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 90;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 12px;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important; }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Quick Action Cards ──────────────────────────────────────────────────── */
.quick-action {
  border-radius: 12px;
  transition: var(--transition);
  color: inherit;
}
.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
  color: inherit;
}
.quick-action .card-body { border-radius: 12px; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table > :not(caption) > * > * { padding: 0.85rem 0.75rem; }
.table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6c757d; font-weight: 600; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-control, .form-select, .input-group-text {
  border-radius: 8px;
  font-size: 0.9rem;
}
.input-group .form-control { border-radius: 0 8px 8px 0 !important; }
.input-group .input-group-text:first-child { border-radius: 8px 0 0 8px !important; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--sidebar-active); border-color: var(--sidebar-active); }
.btn-primary:hover { background: #3451d1; border-color: #3451d1; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { font-weight: 500; border-radius: 6px; padding: 0.35em 0.65em; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar .nav-link span,
  .sidebar .fs-5,
  .sidebar .dropdown span { display: none; }
  .sidebar .nav-link { justify-content: center; padding: 0.7rem; }
  .sidebar .nav-link i { margin: 0 !important; font-size: 1.1rem; }
}

/* Collapsible chevron animation */
[data-bs-toggle="collapse"] .transition-icon {
  transition: transform 0.3s ease;
}
[data-bs-toggle="collapse"][aria-expanded="false"] .transition-icon {
  transform: rotate(-90deg);
}
[data-bs-toggle="collapse"][aria-expanded="true"] .transition-icon {
  transform: rotate(0deg);
}
