:root {
  --sidebar-width: 280px;
  --sidebar-bg: #1e293b;
  --sidebar-border: #334155;
  --nav-text: #e2e8f0;
  --nav-hover-bg: #334155;
  --nav-parent-blue: #4a90e2;
  --nav-parent-blue-hover: #5a9eec;
  --nav-submenu-blue: #3a7bc8;
  --nav-submenu-blue-hover: #2f6db5;
  --nav-icon: #cbd5e1;
  --content-bg: #f5f6f8;
  --brand-color: #ffffff;
  --topbar-bg: #1e293b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  color: #202124;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — dark navy with blue active/submenu shades */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--brand-color);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand:hover {
  color: var(--brand-color);
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: #475569 transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.nav-item-link,
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item-link:hover,
.nav-group-toggle:hover {
  background: var(--nav-hover-bg);
  color: #ffffff;
}

.nav-item-link:hover i,
.nav-group-toggle:hover i.nav-icon,
.nav-group-toggle:hover .nav-chevron {
  color: #ffffff;
}

/* Active single link (e.g. Dashboard) — lighter blue */
.nav-item-link.active {
  background: var(--nav-parent-blue);
  color: #ffffff;
  font-weight: 600;
}

.nav-item-link.active i {
  color: #ffffff;
}

.nav-item-link i,
.nav-group-toggle i.nav-icon {
  font-size: 1.05rem;
  color: var(--nav-icon);
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-chevron {
  font-size: 0.7rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Expanded parent — lighter bright blue */
.nav-group-toggle[aria-expanded="true"] {
  background: var(--nav-parent-blue);
  color: #ffffff;
  font-weight: 600;
}

.nav-group-toggle[aria-expanded="true"] i.nav-icon,
.nav-group-toggle[aria-expanded="true"] .nav-chevron {
  color: #ffffff;
}

.nav-group-toggle[aria-expanded="true"]:hover {
  background: var(--nav-parent-blue-hover);
  color: #ffffff;
}

.nav-group-toggle[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-group {
  margin-bottom: 0;
}

/* Submenu panel — slightly darker blue than parent.
   Include .collapsing so the blue is present during Bootstrap's height animation
   (Bootstrap temporarily replaces .collapse with .collapsing). */
.nav-group .collapse,
.nav-group .collapsing {
  background-color: var(--nav-submenu-blue);
}

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0 0.35rem;
  background-color: var(--nav-submenu-blue);
}

.nav-submenu .nav-sublink {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem 0.55rem 1.15rem;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 0;
  transition: background 0.15s ease;
  position: relative;
}

.nav-submenu .nav-sublink i {
  font-size: 0.95rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.nav-submenu .nav-sublink span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-submenu .nav-sublink:hover {
  background: var(--nav-submenu-blue-hover);
  color: #ffffff;
}

.nav-submenu .nav-sublink.active {
  background: var(--nav-submenu-blue-hover);
  color: #ffffff;
  font-weight: 600;
}

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  color: #e2e8f0;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
}

.page-body {
  padding: 1.25rem 1.5rem 2rem;
}

.topbar-search {
  max-width: 420px;
  flex: 1;
}

.topbar-search .form-control {
  background: #334155;
  border: 1px solid transparent;
  font-size: 0.875rem;
  color: #e2e8f0;
}

.topbar-search .form-control::placeholder {
  color: #94a3b8;
}

.topbar-search .form-control:focus {
  background: #475569;
  border-color: #64748b;
  box-shadow: none;
  color: #ffffff;
}

.topbar-search .input-group-text {
  background: #334155;
  color: #94a3b8;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
}

.topbar-icon-btn:hover {
  background: #334155;
  color: #ffffff;
}

.topbar-icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ea4335;
  border: 2px solid var(--topbar-bg);
}

.topbar .btn-light {
  background: #334155;
  border-color: #475569 !important;
  color: #e2e8f0;
}

.topbar .btn-light:hover,
.topbar .btn-light:focus,
.topbar .btn-light.show {
  background: #475569;
  color: #ffffff;
}

.topbar .text-secondary {
  color: #94a3b8 !important;
}

/* AdminLite3-style dashboard */
.dash-header {
  margin-bottom: 1.25rem;
}

.dash-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: #1f2937;
}

.dash-header p {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.kpi-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.65rem;
  border-top: 3px solid transparent;
  padding: 1.15rem 1.25rem;
  height: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kpi-card.kpi-blue { border-top-color: #3b82f6; }
.kpi-card.kpi-green { border-top-color: #22c55e; }
.kpi-card.kpi-purple { border-top-color: #a855f7; }
.kpi-card.kpi-orange { border-top-color: #f59e0b; }
.kpi-card.kpi-teal { border-top-color: #14b8a6; }
.kpi-card.kpi-rose { border-top-color: #f43f5e; }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.kpi-trend {
  font-size: 0.8rem;
  font-weight: 500;
}

.kpi-trend.up { color: #16a34a; }
.kpi-trend.down { color: #dc2626; }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.kpi-icon.blue { background: #dbeafe; color: #2563eb; }
.kpi-icon.green { background: #dcfce7; color: #16a34a; }
.kpi-icon.purple { background: #f3e8ff; color: #9333ea; }
.kpi-icon.orange { background: #ffedd5; color: #ea580c; }
.kpi-icon.teal { background: #ccfbf1; color: #0d9488; }
.kpi-icon.rose { background: #ffe4e6; color: #e11d48; }

/* AdminLTE-style solid color small boxes */
.small-box {
  position: relative;
  display: block;
  border-radius: 0.35rem;
  overflow: hidden;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.125), 0 1px 3px rgba(0, 0, 0, 0.2);
  height: 100%;
  color: #fff;
  text-decoration: none;
}

.small-box:hover {
  color: #fff;
  text-decoration: none;
}

.small-box > .inner {
  padding: 0.85rem 1rem 0.5rem;
  position: relative;
  z-index: 1;
}

.small-box .inner h3 {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  white-space: nowrap;
  padding: 0;
  line-height: 1.1;
}

.small-box .inner p {
  font-size: 1rem;
  margin: 0;
  font-weight: 500;
}

.small-box .icon {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 0;
  font-size: 70px;
  color: rgba(0, 0, 0, 0.15);
  transition: all 0.3s linear;
  line-height: 1;
}

.small-box:hover .icon {
  font-size: 75px;
}

.small-box > .small-box-footer {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0.45rem 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.12);
  text-decoration: none;
  font-size: 0.85rem;
}

.small-box > .small-box-footer:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
}

.small-box.bg-info { background-color: #17a2b8 !important; }
.small-box.bg-danger { background-color: #d81b60 !important; }
.small-box.bg-warning { background-color: #ff851b !important; }
.small-box.bg-success { background-color: #28a745 !important; }
.small-box.bg-primary { background-color: #007bff !important; }
.small-box.bg-purple { background-color: #6f42c1 !important; }
.small-box.bg-teal { background-color: #20c997 !important; }
.small-box.bg-orange { background-color: #fd7e14 !important; }

.dash-breadcrumb {
  color: #4a90e2;
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.dash-breadcrumb:hover {
  color: #3a7bc8;
}

.dash-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.65rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-card-header {
  padding: 0.95rem 1.15rem 0.35rem;
}

.dash-card-header h2 {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0;
  color: #1f2937;
}

.dash-card-header p {
  font-size: 0.78rem;
  color: #9ca3af;
  margin: 0.15rem 0 0;
}

.dash-card-body {
  padding: 0.75rem 1.15rem 1.15rem;
  flex: 1;
}

.chart-placeholder {
  min-height: 200px;
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px dashed #d1d5db;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  gap: 0.35rem;
}

.chart-placeholder.tall { min-height: 240px; }
.chart-placeholder.short { min-height: 160px; }

.chart-placeholder i {
  font-size: 1.75rem;
  opacity: 0.7;
}

.chart-placeholder span {
  font-size: 0.8rem;
}

/* Fake colorful mini charts */
.mini-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.45rem;
  height: 140px;
  padding: 0.5rem 0.25rem 0;
}

.mini-bars .bar {
  flex: 1;
  border-radius: 0.3rem 0.3rem 0.15rem 0.15rem;
  min-height: 18%;
}

.donut-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  justify-content: center;
  min-height: 160px;
}

.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(#3b82f6 0 58%, #ec4899 58% 100%);
  position: relative;
  flex-shrink: 0;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  background: #fff;
  border-radius: 50%;
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  color: #374151;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.grade-bars .grade-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}

.grade-bars .grade-label {
  width: 52px;
  color: #6b7280;
  flex-shrink: 0;
}

.grade-bars .progress {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
}

.grade-bars .grade-count {
  width: 24px;
  text-align: right;
  font-weight: 600;
  color: #374151;
}

.empty-state {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-align: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.empty-state i {
  font-size: 1.5rem;
}

.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.schedule-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.schedule-time {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.schedule-meta {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.15rem;
}

.schedule-sub {
  font-size: 0.78rem;
  color: #6b7280;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem 0.5rem;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 0.55rem;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  height: 100%;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.quick-action-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.quick-action-btn i {
  font-size: 1.25rem;
}

.quick-action-btn.green {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.quick-action-btn.green:hover {
  background: #dcfce7;
  color: #166534;
}

.quick-action-btn.amber {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.quick-action-btn.amber:hover {
  background: #fef3c7;
  color: #92400e;
}

.quick-action-btn.violet {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.quick-action-btn.violet:hover {
  background: #ede9fe;
  color: #5b21b6;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.notif-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.notif-text {
  font-size: 0.85rem;
  color: #374151;
  margin-bottom: 0.15rem;
}

.notif-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  height: 100%;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: #5f6368;
  margin-bottom: 0.35rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #202124;
  line-height: 1.2;
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.content-panel {
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.content-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.content-panel p.lead-text {
  color: #5f6368;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.mobile-toggle {
  display: none;
  border: 1px solid #475569;
  background: #334155;
  border-radius: 0.45rem;
  padding: 0.4rem 0.65rem;
  font-size: 1.25rem;
  color: #e2e8f0;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 991.98px) {
  .mobile-toggle {
    display: inline-flex;
    align-items: center;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1035;
  }
}
