/* ============================================================
   EduGlobal — Admin Panel Stylesheet
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --sidebar-bg: #1a1a2e;
  --topbar-h: 64px;
  --primary: #0d6efd;
  --primary-soft: rgba(13,110,253,.1);
  --success-soft: rgba(25,135,84,.1);
  --warning-soft: rgba(255,193,7,.1);
  --danger-soft: rgba(220,53,69,.1);
  --info-soft: rgba(13,202,240,.1);
  --secondary-soft: rgba(108,117,125,.1);
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body.admin-body { background: #f5f7fb; overflow-x: hidden; }

/* ── Wrapper ── */
.admin-wrapper { display: flex; height: 100%; min-height: 100vh; }

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.admin-sidebar {
  /* Fixed panel, full viewport height */
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  z-index: 1050;

  /* Flex column so nav can scroll */
  display: flex;
  flex-direction: column;

  /* Slide transition for mobile */
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

/* ── Brand (fixed top) ── */
.sidebar-brand {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-text { font-size: 1.1rem; }

/* ── User info (fixed below brand) ── */
.sidebar-user {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ── Nav (scrollable) ── */
.sidebar-nav {
  flex: 1 1 0;       /* grow + shrink, base 0 */
  min-height: 0;     /* CRITICAL: allows flex child to shrink below content size */
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem 0 1.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }

/* ── Nav items ── */
.nav-section-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: .8rem 1.5rem .2rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1.5rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(13,110,253,.2); color: #fff; border-right: 3px solid var(--primary); }
.nav-item.text-danger-soft { color: rgba(220,53,69,.8); }
.nav-item.text-danger-soft:hover { color: #dc3545; background: rgba(220,53,69,.1); }

/* ── Desktop collapsed ── */
.admin-sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

/* ════════════════════════════════════════════════════════════
   MAIN AREA
   ════════════════════════════════════════════════════════════ */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}
.admin-main.expanded { margin-left: 0; }

/* ── Topbar ── */
.admin-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: .85rem; font-weight: 700; }

/* ── Content ── */
.admin-content { padding: 1.5rem; flex: 1; }

/* ════════════════════════════════════════════════════════════
   MOBILE OVERLAY
   ════════════════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1049;
  cursor: pointer;
}
.sidebar-overlay.active { display: block; }

/* ════════════════════════════════════════════════════════════
   MOBILE (≤991px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0 !important;
  }
}

/* ════════════════════════════════════════════════════════════
   COMPONENTS
   ════════════════════════════════════════════════════════════ */

/* Stat cards */
.stat-card { transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08) !important; }
.stat-icon { flex-shrink: 0; }

/* Tables */
.table th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; }
.table td { font-size: .875rem; vertical-align: middle; }

/* Soft color utilities */
.bg-primary-soft   { background-color: var(--primary-soft)   !important; }
.bg-success-soft   { background-color: var(--success-soft)   !important; }
.bg-warning-soft   { background-color: var(--warning-soft)   !important; }
.bg-danger-soft    { background-color: var(--danger-soft)    !important; }
.bg-info-soft      { background-color: var(--info-soft)      !important; }
.bg-secondary-soft { background-color: var(--secondary-soft) !important; }

/* Auth page */
.auth-body { background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); min-height: 100vh; }
.auth-card { max-width: 420px; }

/* Hover lift */
.hover-lift { transition: transform .2s, box-shadow .2s; }
.hover-lift:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.1) !important; }

/* ════════════════════════════════════════════════════════════
   DARK MODE
   ════════════════════════════════════════════════════════════ */
[data-bs-theme="dark"] body.admin-body { background: #0f0f1a; }
[data-bs-theme="dark"] .admin-topbar { background: #1a1a2e; border-color: rgba(255,255,255,.1); }
[data-bs-theme="dark"] .card { background: #1e1e30; border-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; color: #ccc; }
[data-bs-theme="dark"] .table-light { --bs-table-bg: rgba(255,255,255,.05); }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select { background: #2a2a3e; border-color: rgba(255,255,255,.15); color: #fff; }
