/* ==========================================================================
   ENTERPRISE DESIGN SYSTEM V1.0 - MOBILE-FIRST & ADAPTIVE RESPONSIVE CSS
   Inspiration: Microsoft Admin Center, Stripe Dashboard, Linear UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - Enterprise Slate & Corporate Indigo */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active: #4f46e5;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --brand-primary: #4f46e5;
  --brand-primary-hover: #4338ca;
  --brand-success: #10b981;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;
  --brand-info: #3b82f6;

  --border-color: #e2e8f0;
  
  /* Glassmorphic Effects */
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: 1px solid rgba(226, 232, 240, 0.8);
  --glass-blur: blur(16px);
  
  /* Component Elevation & Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  
  /* Border Radius System */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-speed: 0.25s;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Glassmorphism Card System */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
}

/* Enterprise Header */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

/* Enterprise SaaS Sidebar Styling */
.enterprise-sidebar {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  max-height: 100vh !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  background: linear-gradient(180deg, #0b0f19 0%, #151d30 100%);
  color: #ffffff;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  z-index: 1020;
}

.enterprise-sidebar ul.nav {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.enterprise-sidebar ul.nav::-webkit-scrollbar {
  width: 4px;
}

.enterprise-sidebar ul.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.enterprise-sidebar .nav-item {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.sidebar-brand-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px !important;
  margin-bottom: 0.5rem !important;
  transition: all 0.2s ease;
  white-space: nowrap;
  width: 100% !important;
  box-sizing: border-box !important;
}

.sidebar-brand-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.sidebar-section-title {
  list-style: none;
  display: block;
  font-size: 0.68rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  margin-top: 0.65rem !important;
  margin-bottom: 0.25rem !important;
  padding-right: 0.4rem;
  padding-left: 0.4rem;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.enterprise-sidebar .nav-link {
  color: #94a3b8;
  padding: 0.42rem 0.65rem !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem !important;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: background-color 0.2s ease, color 0.2s ease;
  margin-bottom: 0.15rem !important;
  border: 1px solid transparent;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.enterprise-sidebar .nav-link span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.enterprise-sidebar .nav-link i {
  flex-shrink: 0 !important;
}

.enterprise-sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.enterprise-sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.9) 0%, rgba(99, 102, 241, 0.8) 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}



/* Badges System */
.badge-enterprise {
  padding: 0.35em 0.75em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-status-active {
  background-color: rgba(16, 185, 129, 0.12);
  color: var(--brand-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-status-suspended {
  background-color: rgba(239, 68, 68, 0.12);
  color: var(--brand-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-status-onleave {
  background-color: rgba(245, 158, 11, 0.12);
  color: var(--brand-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Metric KPI Card */
.kpi-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.kpi-icon-indigo { background: rgba(79, 70, 229, 0.12); color: var(--brand-primary); }
.kpi-icon-emerald { background: rgba(16, 185, 129, 0.12); color: var(--brand-success); }
.kpi-icon-amber { background: rgba(245, 158, 11, 0.12); color: var(--brand-warning); }
.kpi-icon-blue { background: rgba(59, 130, 246, 0.12); color: var(--brand-info); }

/* Touch-Friendly Responsive Buttons */
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.btn-sm {
  min-height: 36px;
}

.btn-lg {
  min-height: 48px;
}

/* Table Responsive Scrolling Optimization */
.table-responsive {
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 4px;
}

/* Button Enterprise System */
.btn-enterprise-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
}

.btn-enterprise-primary:hover, .btn-enterprise-primary:focus {
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

/* Offcanvas Drawer Customization */
.mobile-sidebar-offcanvas {
  width: 290px !important;
  background: linear-gradient(180deg, #0b0f19 0%, #151d30 100%) !important;
}

.mobile-sidebar-offcanvas .nav-link {
  color: #94a3b8;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: all 0.2s ease;
  margin-bottom: 0.35rem;
}

.mobile-sidebar-offcanvas .nav-link:hover,
.mobile-sidebar-offcanvas .nav-link.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.9) 0%, rgba(99, 102, 241, 0.8) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

/* Flex Toolbar Responsive Wrappers */
.responsive-header-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .responsive-header-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.responsive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Large Laptop / Desktop (< 1200px) */
@media (max-width: 1199.98px) {
  .kpi-card {
    padding: 1.1rem;
  }
}

/* Tablet & Mobile Screens (< 992px) */
@media (max-width: 991.98px) {
  .sticky-header {
    padding: 0.6rem 1rem;
  }
  
  .glass-card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  h1, .h1 { font-size: 1.65rem; }
  h2, .h2 { font-size: 1.45rem; }
  h3, .h3 { font-size: 1.25rem; }
  h4, .h4 { font-size: 1.15rem; }
  h5, .h5 { font-size: 1.05rem; }

  .kpi-card {
    gap: 0.85rem;
  }

  .kpi-icon {
    width: 46px;
    height: 46px;
    font-size: 1.25rem;
  }

  .d-flex.gap-2, .d-flex.gap-3 {
    flex-wrap: wrap;
  }

  .responsive-toolbar .btn {
    flex: 1 1 auto;
    min-height: 42px;
  }
}

/* Medium Smartphone Screens (< 768px) */
@media (max-width: 767.98px) {
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: block;
    border: 1px solid var(--border-color);
  }

  .table-responsive table {
    min-width: 650px;
  }

  .responsive-toolbar {
    width: 100%;
  }

  .responsive-toolbar .btn, .responsive-toolbar form {
    width: 100%;
  }
}

/* Small Smartphone Screens (< 576px) */
@media (max-width: 575.98px) {
  body {
    font-size: 0.88rem;
  }

  .container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .glass-card {
    padding: 0.85rem;
  }

  .btn {
    min-height: 44px; /* Touch target minimum */
    font-size: 0.88rem;
  }

  .btn-mobile-full {
    width: 100%;
    margin-bottom: 0.35rem;
  }

  .table-responsive table {
    min-width: 580px;
  }

  .form-control-lg, .form-select-lg {
    font-size: 0.95rem;
  }

  /* Modal responsive behavior on mobile */
  .modal-dialog {
    margin: 0.5rem;
  }

  .option-row .input-group-text {
    padding: 0.5rem;
  }

  .kpi-card {
    padding: 0.85rem;
  }

  .kpi-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

/* ── Preset Cards for Exam Result Release Selection ────────────── */
.preset-card {
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 14px !important;
  user-select: none;
  background-color: #ffffff !important;
  position: relative;
}
.preset-card:hover {
  border-color: #6366f1 !important;
  background-color: rgba(99, 102, 241, 0.05) !important;
  transform: translateY(-2px);
}
.preset-card.selected {
  border-color: #4f46e5 !important;
  background-color: rgba(79, 70, 229, 0.09) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.25) !important;
  transform: scale(1.02);
}
.preset-card.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  left: 8px;
  background: #4f46e5;
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

