/* =========================================================
   Theme Tokens – Professional School Management System
   Modern, accessible, and beautiful design system
   ========================================================= */

:root {
  /* =====================================================
     Brand Colors – Primary Palette
     ===================================================== */
  --theme-primary: #2563eb;
  --theme-primary-hover: #1d4ed8;
  --theme-primary-active: #1e40af;
  --theme-primary-soft: rgba(37, 99, 235, 0.10);
  --theme-primary-softer: rgba(37, 99, 235, 0.05);
  
  --theme-secondary: #64748b;
  --theme-secondary-hover: #475569;
  --theme-secondary-soft: rgba(100, 116, 139, 0.10);
  
  /* =====================================================
     Semantic Colors – Status & Feedback
     ===================================================== */
  --theme-success: #059669;
  --theme-success-soft: rgba(5, 150, 105, 0.10);
  --theme-success-bg: #ecfdf5;
  
  --theme-warning: #d97706;
  --theme-warning-soft: rgba(217, 119, 6, 0.10);
  --theme-warning-bg: #fffbeb;
  
  --theme-danger: #dc2626;
  --theme-danger-soft: rgba(220, 38, 38, 0.10);
  --theme-danger-bg: #fef2f2;
  
  --theme-info: #0891b2;
  --theme-info-soft: rgba(8, 145, 178, 0.10);
  --theme-info-bg: #ecfeff;

  /* =====================================================
     Sidebar – Deep Navy with Elegant Depth
     ===================================================== */
  --theme-sidebar-bg: #0f172a;
  --theme-sidebar-border: #1e293b;
  --theme-sidebar-text: #e2e8f0;
  /* --theme-sidebar-text: #fff;   */
  --theme-sidebar-text-muted: #94a3b8;
  --theme-sidebar-hover: rgba(255, 255, 255, 0.08);
  --theme-sidebar-active: rgba(37, 99, 235, 0.25);
  --theme-sidebar-active-text: #fff;
  --theme-sidebar-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);

  /* =====================================================
     Surface Colors – Cards, Backgrounds
     ===================================================== */
  --theme-bg-page: #f1f5f9;
  --theme-bg-card: #ffffff;
  --theme-bg-elevated: #ffffff;
  --theme-bg-hover: #f8fafc;
  --theme-bg-active: #f1f5f9;
  
  /* =====================================================
     Border & Divider Colors
     ===================================================== */
  --theme-border: #e2e8f0;
  --theme-border-light: #f1f5f9;
  --theme-border-focus: #2563eb;
  --theme-divider: #e5e7eb;

  /* =====================================================
     Text Colors – Accessible Contrast
     ===================================================== */
  --theme-text-main: #0f172a;
  --theme-text-secondary: #334155;
  --theme-text-muted: #64748b;
  --theme-text-placeholder: #94a3b8;
  --theme-text-disabled: #cbd5e1;
  --theme-text-inverse: #ffffff;
  --theme-text-link: #2563eb;
  --theme-text-link-hover: #1d4ed8;

  /* =====================================================
     Shadows – Subtle Depth
     ===================================================== */
  --theme-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --theme-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --theme-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --theme-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --theme-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --theme-shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.15);
  --theme-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

  /* =====================================================
     Spacing Scale
     ===================================================== */
  --theme-space-xs: 0.25rem;
  --theme-space-sm: 0.5rem;
  --theme-space-md: 1rem;
  --theme-space-lg: 1.5rem;
  --theme-space-xl: 2rem;
  --theme-space-2xl: 3rem;

  /* =====================================================
     Border Radius
     ===================================================== */
  --theme-radius-sm: 0.25rem;
  --theme-radius-md: 0.375rem;
  --theme-radius-lg: 0.5rem;
  --theme-radius-xl: 0.75rem;
  --theme-radius-2xl: 1rem;
  --theme-radius-full: 9999px;

  /* =====================================================
     Transitions
     ===================================================== */
  --theme-transition-fast: 150ms ease;
  --theme-transition-base: 200ms ease;
  --theme-transition-slow: 300ms ease;
  --theme-transition-smooth: 200ms cubic-bezier(0.4, 0, 0.2, 1);

  /* =====================================================
     Z-Index Scale
     ===================================================== */
  --theme-z-dropdown: 1000;
  --theme-z-sticky: 1020;
  --theme-z-fixed: 1030;
  --theme-z-modal-backdrop: 1040;
  --theme-z-modal: 1050;
  --theme-z-popover: 1060;
  --theme-z-tooltip: 1070;
  --theme-z-toast: 1080;
}


/* =========================================================
   Bootstrap Variable Overrides
   ========================================================= */

:root {
  --bs-primary: var(--theme-primary);
  --bs-secondary: var(--theme-secondary);
  --bs-success: var(--theme-success);
  --bs-warning: var(--theme-warning);
  --bs-danger: var(--theme-danger);
  --bs-info: var(--theme-info);
  --bs-body-bg: var(--theme-bg-page);
  --bs-body-color: var(--theme-text-main);
  --bs-border-color: var(--theme-border);
  --bs-border-radius: var(--theme-radius-md);
  --bs-border-radius-sm: var(--theme-radius-sm);
  --bs-border-radius-lg: var(--theme-radius-lg);
}

/* =========================================================
   Button Enhancements
   ========================================================= */

.btn {
  font-weight: 500;
  border-radius: var(--theme-radius-md);
  transition: all var(--theme-transition-fast);
  box-shadow: none;
}

.btn:focus-visible {
  box-shadow: var(--theme-shadow-focus);
}

.btn-primary {
  --bs-btn-bg: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-bg: var(--theme-primary-hover);
  --bs-btn-hover-border-color: var(--theme-primary-hover);
  --bs-btn-active-bg: var(--theme-primary-active);
  --bs-btn-active-border-color: var(--theme-primary-active);
}

.btn-outline-primary {
  --bs-btn-color: var(--theme-primary);
  --bs-btn-border-color: var(--theme-primary);
  --bs-btn-hover-bg: var(--theme-primary);
  --bs-btn-hover-border-color: var(--theme-primary);
  --bs-btn-active-bg: var(--theme-primary-hover);
}

.btn-success {
  --bs-btn-bg: var(--theme-success);
  --bs-btn-border-color: var(--theme-success);
}

.btn-outline-success {
  --bs-btn-color: var(--theme-success);
  --bs-btn-border-color: var(--theme-success);
  --bs-btn-hover-bg: var(--theme-success);
}

.btn-soft-primary {
  background-color: var(--theme-primary-soft);
  color: var(--theme-primary);
  border: none;
}

.btn-soft-primary:hover {
  background-color: var(--theme-primary);
  color: var(--theme-text-inverse);
}

.btn-soft-success {
  background-color: var(--theme-success-soft);
  color: var(--theme-success);
  border: none;
}

.btn-soft-success:hover {
  background-color: var(--theme-success);
  color: var(--theme-text-inverse);
}

.btn-soft-danger {
  background-color: var(--theme-danger-soft);
  color: var(--theme-danger);
  border: none;
}

.btn-soft-danger:hover {
  background-color: var(--theme-danger);
  color: var(--theme-text-inverse);
}

/* Button icon alignment */
.btn > i,
.btn > svg {
  vertical-align: -0.125em;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--theme-radius-sm);
}

/* =========================================================
   Sidebar Styling – Compact & Refined
   ========================================================= */

#sidebar,
.sidebar-wrapper {
  background: linear-gradient(180deg, #0c1222 0%, #162033 100%);
  border-right: none;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.1);
}

.sidebar-header .logo a {
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header .logo a::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--theme-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

.sidebar-link {
  /* color: rgba(255, 255, 255, 0.9); */
  color: #FFF;
  border-radius: var(--theme-radius-sm);
  margin: 1px 0.5rem;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-wrapper .menu .sidebar-link {
  color: #FAF9F6;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  color: var(--theme-sidebar-text);
}

.sidebar-item.active > .sidebar-link {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.08) 100%);
  color: #fff;
  font-weight: 500;
}

.sidebar-item.active > .sidebar-link::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--theme-primary);
  border-radius: 3px 0 0 3px;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.5);
}

.sidebar-title {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.625rem 0.875rem 0.25rem;
  margin-top: 0.25rem;
}

/* Subtle separator line above titles */
.sidebar-title::before {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  margin-bottom: 0.5rem;
  margin-left: -0.875rem;
  margin-right: -0.875rem;
}

.sidebar-menu > ul > li:first-child .sidebar-title::before {
  display: none;
}

/* Sidebar scrollbar */
.sidebar-wrapper::-webkit-scrollbar {
  width: 3px;
}

.sidebar-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--theme-radius-full);
}

.sidebar-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* =========================================================
   Content Surfaces – Cards & Containers
   ========================================================= */

.card {
  background-color: var(--theme-bg-card);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  box-shadow: var(--theme-shadow-card);
  transition: box-shadow var(--theme-transition-base);
}

.card:hover {
  box-shadow: var(--theme-shadow-sm);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--theme-border-light);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  background-color: var(--theme-bg-hover);
  border-top: 1px solid var(--theme-border-light);
  padding: 0.75rem 1.25rem;
}

/* =========================================================
   Page Header & Titles
   ========================================================= */

.page-heading {
  background-color: transparent;
  padding: 0;
  margin-bottom: var(--theme-space-lg);
}

.page-title {
  color: var(--theme-text-main);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.125rem;
}

.page-subtitle {
  color: var(--theme-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* =========================================================
   Navbar – Clean & Minimal
   ========================================================= */

.navbar,
.navbar-top {
  background-color: var(--theme-bg-page);
  border-bottom: none;
  box-shadow: none;
}

.navbar .nav-link {
  color: var(--theme-text-secondary);
  transition: color var(--theme-transition-fast);
}

.navbar .nav-link:hover {
  color: var(--theme-primary);
}

.navbar .badge-notification {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.625rem;
  padding: 0.2em 0.4em;
}

/* User menu */
.user-menu .user-name h6 {
  font-weight: 600;
  color: var(--theme-text-main);
}

.user-menu .user-name p {
  color: var(--theme-text-muted);
}

/* =========================================================
   Theme Variants (Data Attribute Based)
   ========================================================= */

/* Blue Theme (Default) */
body[data-theme="blue"] {
  --theme-primary: #2563eb;
  --theme-primary-hover: #1d4ed8;
  --theme-primary-active: #1e40af;
}

/* Green Theme */
body[data-theme="green"] {
  --theme-primary: #059669;
  --theme-primary-hover: #047857;
  --theme-primary-active: #065f46;
  --theme-sidebar-active: rgba(5, 150, 105, 0.25);
}

/* Purple Theme */
body[data-theme="purple"] {
  --theme-primary: #7c3aed;
  --theme-primary-hover: #6d28d9;
  --theme-primary-active: #5b21b6;
  --theme-sidebar-active: rgba(124, 58, 237, 0.25);
}

/* Teal Theme */
body[data-theme="teal"] {
  --theme-primary: #0d9488;
  --theme-primary-hover: #0f766e;
  --theme-primary-active: #115e59;
  --theme-sidebar-active: rgba(13, 148, 136, 0.25);
}

/* =========================================================
   Accessibility Enhancements
   ========================================================= */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--theme-border-focus);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --theme-border: #000;
    --theme-text-muted: #333;
  }
  
  .card {
    border-width: 2px;
  }
}
