#exam-calendar .fc-day-sun, #exam-calendar .fc-col-header-cell.fc-day-sun {
  color: #ef4444 !important;
}

/* assets/css/style.css - Consolidated Futuristic Dashboard Styles */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600&family=Open+Sans:wght@400;600&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  /* Modern High-Contrast Cyber Color Palette */
  --bg-dark: #0a101f;
  --bg-light: #ffffff;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.16);
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --secondary: #14b8a6;
  --secondary-dark: #0d9488;
  --accent: #8b5cf6;
  --accent-dark: #6d28d9;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1; /* slate-200: strong contrast against dark surfaces */
  --text-muted: #94a3b8;     /* slate-400: subtle metadata */
  --error: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --neon-blue: #00e5ff;
  --neon-green: #39ff14;
  --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Dedicated Glassmorphism Contrast Tokens */
  --glass-card-bg: rgba(15, 23, 42, 0.82);
  --glass-card-bg-gradient: linear-gradient(135deg, rgba(24, 34, 58, 0.88) 0%, rgba(13, 20, 36, 0.94) 100%);
  --glass-card-border: rgba(255, 255, 255, 0.13);
  --glass-input-bg: rgba(15, 23, 42, 0.92);
  --glass-input-border: rgba(255, 255, 255, 0.2);
}

/* Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { 
  scroll-behavior: smooth; 
  overflow-x: hidden;
  width: 100%;
}
/* Progress Modal Styles */
.download-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

.download-modal.active {
  display: flex;
}

.download-modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  padding: 2rem;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.progress-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  height: 20px;
  margin: 1.5rem 0;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}

.progress-text {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.progress-details {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.download-btn-container {
  margin-top: 1.5rem;
}

/* Global Responsive Adjustments */
@media (max-width: 768px) {
  :root {
    --card-padding: 1.25rem;
  }
  
  .container {
    width: 95%;
    padding: 1rem 0.75rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }

  /* Header & Navigation */
  header {
    padding: 0.75rem 0;
    min-height: 56px;
  }

  header .container {
    padding-left: calc(3.75rem + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(1rem + env(safe-area-inset-right, 0px)) !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
  }

  header h1 {
    font-size: 1.25rem !important;
    margin: 0;
  }

  header nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
  }

  header nav span {
    font-size: 0.85rem;
    color: var(--text-secondary);
  }

  header nav .btn {
    min-height: 38px;
    padding: 6px 14px;
    font-size: 0.85rem;
    width: auto;
  }

  /* Dashboard Layout */
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
  }

  .sidebar {
    padding: 1.5rem;
  }

  .content {
    padding: 0;
  }

  /* Attendance Summary */
  .lectures-panel > div {
    flex-direction: column;
    align-items: stretch !important;
  }

  .attendance-summary {
    width: 100% !important;
    margin-top: 1rem;
  }

  /* Subject Grid */
  .subject-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .subject-card {
    padding: 1.5rem;
  }

  /* Progress Modal */
  .download-modal-content {
    padding: 1.5rem;
    width: 95%;
  }

  /* Table Adjustments */
  .table-responsive {
    margin: 0.5rem 0;
    padding: 0;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: visible !important;
  }

  .table-responsive table {
    min-width: 0 !important; /* Remove min-width for mobile card layout */
    width: 100% !important;
  }

  /* FullCalendar */
  #exam-calendar .fc-toolbar {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  #exam-calendar .fc-toolbar-title {
    font-size: 1.1rem;
  }

  /* Form Group Adjustments */
  .form-group input, .form-group select, .form-group textarea {
    font-size: 16px !important; /* Prevent iOS zoom on focus */
  }

  /* Button stacking for small screens */
  .btn-group, .flex-row {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn, .flex-row .btn {
    width: 100%;
  }

  /* Admin Subject Panel adjustments */
   .admin-actions {
     display: flex;
     flex-direction: column;
     gap: 10px;
   }

   /* Study Materials Adjustments */
   .module-list li {
     flex-direction: column;
     align-items: stretch !important;
     gap: 0.75rem !important;
     padding: 1rem;
     background: rgba(15, 23, 42, 0.65);
     border: 1px solid rgba(255, 255, 255, 0.08);
     border-radius: 8px;
     margin-bottom: 1rem;
   }

   .module-list li .btn {
     width: 100%;
     text-align: center;
   }

   .login-glass, .setup-card {
     margin: 2rem auto;
     width: 95%;
   }

   /* Search Container Responsive */
   .search-container {
     flex-direction: column;
     align-items: stretch !important;
     gap: 1rem !important;
   }

   .search-hint {
     text-align: center;
   }

   .highlight-match {
     background-color: rgba(255, 255, 0, 0.3);
     color: #fff;
     border-radius: 2px;
     padding: 0 2px;
     font-weight: bold;
   }

   .table-responsive table {
     display: flex !important;
     flex-direction: column !important;
     border: none !important;
     background: transparent !important;
     gap: 1rem !important;
     min-width: 0 !important;
     width: 100% !important;
   }

   .table-responsive thead {
     display: none !important;
   }

   .table-responsive tbody {
     display: flex !important;
     flex-direction: column !important;
     gap: 1rem !important;
     min-width: 0 !important;
     width: 100% !important;
   }

   .table-responsive tr {
     display: block !important;
     width: 100% !important;
     min-width: 0 !important;
     margin-bottom: 0 !important;
     background: rgba(15, 23, 42, 0.92) !important;
     border: 1px solid rgba(255, 255, 255, 0.16) !important;
     border-radius: 16px !important;
     padding: 1rem !important;
     box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
     position: relative;
     box-sizing: border-box !important;
   }

   .table-responsive td {
     border: none !important;
     padding: 0.75rem 0.5rem !important;
     position: relative;
     padding-left: 45% !important; /* Back to 45% but ensured width */
     text-align: right !important;
     white-space: normal !important;
     min-height: 2.5rem;
     display: block !important;
     border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
     color: var(--text-primary) !important;
     width: 100% !important;
     box-sizing: border-box !important;
     overflow-wrap: break-word; /* Ensure long text doesn't push width */
   }

   /* Ensure empty cells still show labels and take space */
   .table-responsive td:empty::after {
     content: '\00a0'; /* Non-breaking space */
   }

   .table-responsive td:last-child {
     border-bottom: none !important;
   }

   .table-responsive td::before {
     content: attr(data-label);
     position: absolute;
     left: 0.5rem;
     top: 50%;
     transform: translateY(-50%); /* Center vertically */
     width: 40%;
     padding-right: 10px;
     white-space: normal;
     text-align: left;
     font-weight: 600;
     color: var(--primary-light);
     font-size: 0.7rem;
     text-transform: uppercase;
     letter-spacing: 0.05em;
     display: block;
   }

   /* Special case for actions/buttons in cards */
   .table-responsive td .btn, 
   .table-responsive td form,
   .table-responsive td div {
     display: inline-flex !important;
     vertical-align: middle;
     margin: 2px 0;
   }
   
   .table-responsive td div[style*="flex"] {
     justify-content: flex-end !important;
     width: 100%;
   }

   /* Mobile Sort Dropdown */
   .mobile-sort-container {
     margin-bottom: 1.5rem;
     background: rgba(255, 255, 255, 0.03);
     padding: 1rem;
     border-radius: 12px;
     border: 1px solid var(--glass-border);
   }

   .mobile-sort-select {
     width: 100%;
     padding: 0.75rem;
     background: var(--bg-dark);
     color: var(--text-primary);
     border: 1px solid var(--glass-border);
     border-radius: 8px;
     font-family: inherit;
     font-size: 1rem;
     outline: none;
     cursor: pointer;
   }
   
   .mobile-sort-select:focus {
     border-color: var(--primary);
   }
 }
 
 body {
  font-family: 'Inter', 'Open Sans', sans-serif;
  background: linear-gradient(to bottom right, var(--bg-dark), #1a1c2e);
  color: var(--text-primary);
  overflow-x: hidden;
  width: 100%;
  position: relative;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* Modern Background Effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, var(--primary) 0%, transparent 70%),
    radial-gradient(circle at 80% 70%, var(--secondary) 0%, transparent 70%);
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Container Layout */
.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
  padding: 1.5rem 1rem;
}
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  margin: 2rem 0;
}
@media (max-width:1024px) {
  .layout { grid-template-columns: 1fr; }
  /* .sidebar { display: none; }  -- removed to always show sidebar */
}

/* Responsive layout for dashboard sidebar: show on top in portrait/mobile */
@media (max-width: 900px) {
  main.container.layout {
    display: flex;
    flex-direction: column;
  }
  aside.sidebar {
    display: block !important;
    width: 100%;
    max-width: 100vw;
    margin-bottom: 1.5em;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    order: -1;
  }
  .content {
    width: 100%;
    max-width: 100vw;
  }
}

@media (max-width: 600px) {
  aside.sidebar {
    display: block !important;
    position: static !important;
    margin-bottom: 1.5em;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    background: var(--glass-card-bg);
    border: 1px solid var(--glass-card-border);
    z-index: 2;
    color: var(--text-primary);
  }
  main.container.layout {
    display: flex;
    flex-direction: column;
  }
  .content {
    width: 100%;
    max-width: 100vw;
  }
}

/* Modern High-Contrast Glass Panels */
.card, .upload-panel, .history-panel, .sidebar, .subject-card, .login-glass, .setup-card, .section-card {
  background: var(--glass-card-bg);
  background: var(--glass-card-bg-gradient);
  border: 1px solid var(--glass-card-border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 2rem;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  word-wrap: break-word; /* Ensure content inside cards wraps */
  overflow-wrap: anywhere;
  color: var(--text-primary);
}

/* Universal Typography & Strict Overflow Containment */
body, h1, h2, h3, h4, h5, h6, p, td, th, li, span, code, pre, a, strong, b, em, i, small, label, div {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.break-word,
.file-name-text,
.break-anywhere {
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
  word-break: break-all !important; /* Force break even without spaces */
}

/* Prevent flex children from overflowing due to unbreakable text tokens */
[class*="flex"] > *,
[style*="display: flex"] > *,
[style*="display:flex"] > *,
.card > *,
.section-card > *,
.stat-card > *,
.stat-grid > *,
.dashboard-tabs > * {
  min-width: 0;
  max-width: 100%;
}

.card::before, .upload-panel::before, .history-panel::before, .sidebar::before, 
.subject-card::before, .login-glass::before, .setup-card::before, .section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.04),
    transparent
  );
  transition: 0.5s;
}

.card:hover::before, .upload-panel:hover::before, .history-panel:hover::before,
.sidebar:hover::before, .subject-card:hover::before, .login-glass:hover::before,
.setup-card:hover::before, .section-card:hover::before {
  left: 100%;
}
.card:hover, .upload-panel:hover, .subject-card:hover, .section-card:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 229, 255, 0.15);
  transform: translateY(-2px);
}

/* Sidebar */
.sidebar { 
  text-align: center; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}
.sidebar .avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 1rem auto !important;
  background: var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar h2 {
  color: var(--neon-green);
  font-size: 1.5rem;
}

/* Buttons */
.btn, button[type=submit] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  font-family: 'Open Sans', 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--primary), #4338ca);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
  text-decoration: none !important;
}

a.btn, .btn a {
  text-decoration: none !important;
  color: inherit !important;
}

.btn::before, button[type=submit]::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.btn:hover, button[type=submit]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn:hover::before, button[type=submit]:hover::before {
  left: 100%;
}

.btn:active, button[type=submit]:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.btn.small { 
  padding: 0.45rem 0.9rem; 
  font-size: 0.85rem; 
  border-radius: 8px;
}

.btn.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a !important;
  font-weight: 700;
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn.warning:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}

.btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff !important;
  font-weight: 700;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn.success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

.btn.danger {
  background: linear-gradient(135deg, var(--error), #dc2626);
  color: #ffffff !important;
  font-weight: 700;
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

.btn.danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.55);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff !important;
}

.logout {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white !important;
}

.logout:hover {
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(79, 70, 229, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.35);
  white-space: nowrap;
}

.badge.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.4);
}

.badge.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde047;
  border-color: rgba(251, 191, 36, 0.4);
}

.badge.badge-danger, .badge.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
}

.badge.badge-info {
  background: rgba(0, 229, 255, 0.15);
  color: #67e8f9;
  border-color: rgba(0, 229, 255, 0.35);
}

/* Alerts & Toasts */
.alert.warning, .error, .toast {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
}

.alert.warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.error {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  color: #fff;
  z-index: 999;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  min-width: 300px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1),
             fadeOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) 2.5s forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.success {
  background: linear-gradient(135deg, var(--success), #34d399);
}

.toast.error {
  background: linear-gradient(135deg, var(--error), #f87171);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-20px); }
}

/* Forms & High-Contrast Inputs */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=date],
input[type=datetime-local],
input[type=file],
.form-group input,
.form-group select,
.form-group textarea,
.upload-panel select,
.upload-panel input[type=file],
select,
textarea {
  width: 100%;
  padding: 0.85rem 1.15rem;
  background: var(--glass-input-bg) !important;
  color: #ffffff !important;
  border: 1.5px solid var(--glass-input-border) !important;
  border-radius: 10px;
  transition: var(--transition);
  font-size: 0.95rem;
  font-family: inherit;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.upload-panel select:focus,
.upload-panel input[type=file]:focus {
  background: rgba(15, 23, 42, 0.98) !important;
  border-color: var(--neon-blue) !important;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
  outline: none !important;
  color: #ffffff !important;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

/* Eye Toggle Icon */
.eye-toggle {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--neon-blue);
  z-index: 2;
}

/* Password Strength Meter */
.strength-meter {
  display: flex;
  height: 8px;
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.strength-meter div {
  flex: 1;
  background: #4b5563;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left;
  animation: scaleX 0.3s ease-out;
}

.strength-meter .weak {
  background: linear-gradient(135deg, var(--error), #f87171);
}

.strength-meter .medium {
  background: linear-gradient(135deg, var(--warning), #fbbf24);
}

.strength-meter .strong {
  background: linear-gradient(135deg, var(--success), #34d399);
}

@keyframes scaleX {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Upload Panel Dropzone */
.upload-panel {
  border: 2px dashed var(--primary-light);
  text-align: center;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.upload-panel.dragover {
  background: rgba(79, 70, 229, 0.1);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.15);
  transform: scale(1.02);
}

.upload-panel h2 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.5rem;
}

.upload-panel p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.upload-panel .icon {
  width: 64px;
  height: 64px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

/* Table Styles */

/* Modern Table Effects */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: 16px;
}

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

.table-responsive::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.table-responsive table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: table;
  table-layout: auto;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.table-responsive th, .table-responsive td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: none;
  position: relative;
  display: table-cell;
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table-responsive th {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #ffffff !important;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  border-bottom: 2px solid rgba(0, 242, 254, 0.35) !important;
}

/* Table Sorting Styles */
.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

.sortable-header:hover {
  background: rgba(79, 70, 229, 0.2) !important;
}

.sortable-header-content {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important; /* Push icon to the right */
  gap: 10px !important;
  width: 100%;
  padding: 12px 15px;
  box-sizing: border-box;
}

.sort-icon {
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  -webkit-font-smoothing: antialiased !important;
  font-size: 0.9rem;
  color: var(--primary-light) !important;
  opacity: 0.5;
  transition: all 0.2s ease;
  display: inline-block !important;
  visibility: visible !important;
}

.sort-active {
  background: rgba(79, 70, 229, 0.25) !important;
}

.sort-active .sort-icon {
  opacity: 1 !important;
  transform: scale(1.1);
  color: var(--primary-light) !important;
}

.sort-active .sortable-header-content {
  color: var(--primary-light) !important;
}

.table-responsive tr:last-child td {
  border-bottom: none;
}

.table-responsive tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.table-responsive tr:hover {
  background: rgba(79, 70, 229, 0.14) !important;
  transition: var(--transition);
}

/* Table Search Styling */
.table-search-container {
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.table-search-input {
  width: 100%;
  padding: 12px 15px 12px 45px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #ffffff;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.table-search-input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
  background: rgba(15, 23, 42, 0.98);
}

.table-search-icon {
  position: absolute;
  left: 2.2rem; /* Adjusted for padding inside container */
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-light);
  opacity: 0.7;
  pointer-events: none;
  font-size: 1.1rem;
  z-index: 2;
}

/* Highlighting matched text */
.highlight {
    background-color: rgba(245, 158, 11, 0.4); /* Amber/Orange background */
    color: #fff;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.3);
}

/* Hide modules or items when filtered */
.hidden-item {
    display: none !important;
}

.module-card {
    transition: var(--transition);
}

.highlight-match {
  background-color: rgba(255, 255, 0, 0.3);
  color: #fff;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: bold;
}

.hidden-row,
tr.hidden-row,
.table-responsive tr.hidden-row,
.table-responsive tbody tr.hidden-row {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  pointer-events: none !important;
}

/* Subject Cards */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.subject-card {
  text-align: center;
  padding: 2.25rem 1.5rem;
  background: var(--glass-card-bg);
  background: var(--glass-card-bg-gradient);
  border: 1px solid var(--glass-card-border);
  border-radius: 20px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none !important;
  display: block;
}

.subject-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(0, 229, 255, 0.25);
  border-color: rgba(0, 229, 255, 0.5);
  color: #ffffff !important;
}

.subject-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.subject-card:hover::after {
  transform: scaleX(1);
}
.subject-card span {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--neon-blue);
  margin-bottom: 0.75rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
}
.subject-card p {
  color: var(--text-primary);
}

/* Login & Setup Pages */
.login-glass, .setup-card {
  max-width: 400px;
  margin: 4rem auto;
}
.login-glass h1, .setup-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--neon-blue);
}
.login-glass {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

a {
  color: var(--neon-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--neon-green);
  text-decoration: underline;
}

/* Toggle Switch */
.toggle input[type=checkbox] {
  appearance: none;
  width: 40px;
  height: 20px;
  background: #555;
  border-radius: 20px;
  position: relative;
  transition: background 0.3s;
  cursor: pointer;
}
.toggle input:checked { background: var(--neon-blue); }
.toggle input::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.toggle input:checked::before {
  transform: translateX(20px);
}

/* Custom Switch for Late Exam Toggles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background-color: var(--success, #10b981);
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}
.slider.round {
  border-radius: 24px;
}
.slider.round:before {
  border-radius: 50%;
}

.delete-icon {
  color: #ef4444 !important;
  margin-left: 8px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.15em;
  display: inline-block;
  line-height: 1;
  transition: transform 0.15s ease;
}
.delete-icon:hover {
  transform: scale(1.25);
  color: #f87171 !important;
}

.upload-icon {
  color: var(--neon-blue) !important;
  margin-left: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85em;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.upload-icon:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.star-btn, .admin-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  padding: 4px 6px;
}
.star-btn:hover, .admin-star-btn:hover {
  transform: scale(1.15);
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Mobile Polish & Touch Ergonomics */
@media (max-width: 480px) {
  body {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #1e293b; }
::-webkit-scrollbar-thumb {
  background: var(--neon-green);
  border-radius: 10px;
}

/* ==========================================================================
   Login Page Background Animation (Educational Theme)
   ========================================================================== */
body.login-bg {
  position: relative;
  overflow: hidden;
}
body.login-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(45deg, var(--neon-blue), var(--neon-green), var(--neon-blue));
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  opacity: 0.2;
  z-index: -2;
}

#modal {
  display: none;
}

#modal.active {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: rgb(0, 0, 0);
  padding: 2rem;
  border-radius: 12px;
  z-index: 1001;
  box-shadow: 0 0 20px var(--neon-green, #00e5ff);
  max-width: 400px;
  width: 90%;
}

select, select option {
  background-color: #1f2937;  /* Dark background */
  color: #f9fafb;             /* Light text */
}

/* Fix for selected option being invisible in some browsers */
select option:checked {
  background-color: #374151;  /* Slightly lighter gray */
  color: #f9fafb;             /* Light text for visibility */
}


/* Modern FullCalendar styles */
#exam-calendar .fc {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

#exam-calendar .fc table {
  border-collapse: separate;
  border-spacing: 2px;
}

#exam-calendar .fc td, #exam-calendar .fc th {
  border: none;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  transition: var(--transition);
}

#exam-calendar .fc td:hover {
  background: rgba(255, 255, 255, 0.05);
}

#exam-calendar .fc-day-today {
  background: rgba(var(--primary), 0.1) !important;
}
#exam-calendar .fc-toolbar-title {
  color: var(--neon-blue);
  font-family: 'Orbitron', 'Open Sans', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0, 229, 255, 0.35);
}
#exam-calendar .fc-daygrid-event {
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  border: none;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  padding: 2px 6px;
}
#exam-calendar .fc-event-pending {
  background: #F59E0B !important;
  color: #222 !important;
  animation: blink-pending 1s steps(1, end) infinite;
}

@keyframes blink-pending {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
#exam-calendar .fc-event-submitted {
  background: #10B981 !important; color: #fff !important; /* green */
}
#exam-calendar .fc-event-missed {
  background: #EF4444 !important; color: #fff !important; /* red */
}
#exam-calendar .fc-event-late {
  background: #ff8800 !important; color: #fff !important; /* red */
}
#exam-calendar .fc-daygrid-day.fc-day-today {
  background: rgba(0,229,255,0.08);
  border-radius: 8px;
}

/* Responsive fix for FullCalendar on mobile screens */
@media (max-width: 768px) {
  #exam-calendar {
    min-width: 0;
    width: 100%;
    padding: 1rem 0.6rem;
    background: var(--glass-card-bg-gradient) !important;
    border: 1px solid var(--glass-card-border) !important;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
  }
  #exam-calendar .fc {
    min-width: 0;
    width: 100%;
    font-size: 0.9em;
  }
  #exam-calendar .fc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem !important;
  }
  #exam-calendar .fc-toolbar-title {
    font-size: 1.15rem !important;
    text-align: center;
    order: 2;
    flex: 1 1 100%;
  }
  #exam-calendar .fc-toolbar-chunk:first-child {
    order: 1;
    display: flex;
    gap: 4px;
  }
  #exam-calendar .fc-button {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    min-height: 38px !important;
    border-radius: 8px !important;
  }
  #exam-calendar .fc-col-header-cell-cushion {
    font-size: 0.75rem;
    padding: 4px 2px;
  }
  #exam-calendar .fc-daygrid-day-number {
    font-size: 0.8rem;
    padding: 2px 4px;
  }
  #exam-calendar .fc-daygrid-event {
    font-size: 0.72rem !important;
    padding: 2px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    border-radius: 6px !important;
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.staticSuccess {
  background: rgba(16, 255, 128, 0.3);   /* brighter, more opaque green */
  color: #aaffcc;                         /* light mint for maximum readability */
  border-left: 4px solid #aaffcc;         /* match the text */
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-weight: 500;
}

/* Calendar data */
.calendar-data {
  display: none;
}

/* Calendar modal and detail styles */
#calendar-detail-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.18);
  z-index: 1000;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0;
}
#calendar-detail-modal[style*="display: flex"] {
  display: flex !important;
}
#calendar-detail-content {
  /* background removed to allow color classes to apply */
  border-radius: 14px;
  box-shadow: 0 4px 32px #0002;
  padding: 2em;
  min-width: 320px;
  max-width: 400px;
  max-height: 80vh;
  overflow: auto;
  position: fixed;
  top: 2.5em;
  right: 2.5em;
  left: auto;
  bottom: auto;
  margin: 0;
}

/* Popup color scheme for exam status */
.calendar-modal-empty {
  background: rgba(0, 229, 255, 0.92) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.calendar-modal-missed {
  background: rgba(239, 68, 68, 0.92) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.calendar-modal-warning {
  background: rgba(245, 158, 11, 0.95) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.calendar-modal-success {
  background: rgba(16, 185, 129, 0.95) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.calendar-modal-late {
  background: rgba(255, 119, 0, 0.95) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
#calendar-detail-close {
  position: absolute;
  top: 0.6em;
  right: 0.6em;
  font-size: 1.4em;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: #ffffff !important;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
#calendar-detail-close:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}
#calendar-detail-body {
  margin-top: 1.5em;
}

/* Maintenance Mode Styles */
.maintenance-card {
  max-width: 400px;
  margin: 4rem auto;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  padding: 2.5rem 1.5rem;
  color: var(--text-primary);
  backdrop-filter: blur(12px);
}
.maintenance-card h1 {
  color: var(--neon-blue);
  margin-bottom: 1.5rem;
  font-size: 2rem;
}
.maintenance-message {
  font-size: 1.2em;
  margin: 2em 0;
  color: var(--text-primary);
}
.maintenance-admin {
  color: #cbd5e1;
  font-size: 0.95em;
  margin-top: 1.5em;
}
.maintenance-admin a {
  color: var(--neon-blue);
  text-decoration: underline;
}
@media (max-width: 600px) {
  .maintenance-card {
    max-width: 98vw;
    margin: 2rem auto;
    padding: 1.2rem 0.5rem;
  }
  .maintenance-message {
    font-size: 1em;
    margin: 1.2em 0;
  }
}

/* Maintenance Mode Card and Snake Game Styles */
.maintenance-card {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 2.5em 1.5em;
  margin: 3em auto;
  max-width: 420px;
  text-align: center;
  color: var(--text-primary);
}
.maintenance-card h1 {
  color: var(--neon-blue);
  font-size: 2.2em;
  margin-bottom: 1em;
}
.maintenance-message {
  font-size: 1.2em;
  margin: 2em 0;
  color: var(--text-secondary);
}
#snake-game-container {
  margin-top: 2em;
  text-align: center;
}
#snake-canvas {
  background: #111;
  border-radius: 12px;
  box-shadow: 0 2px 8px #0003;
  margin: 0 auto;
  display: block;
  max-width: 100vw;
  width: 320px;
  height: 320px;
}
@media (max-width: 500px) {
  .maintenance-card {
    padding: 1.2em 0.5em;
    max-width: 98vw;
  }
  #snake-canvas {
    width: 98vw;
    height: 98vw;
    min-width: 220px;
    min-height: 220px;
    max-width: 320px;
    max-height: 320px;
  }
}

/* Responsive styles for .card only */
@media (max-width: 768px) {
  .card, .upload-panel, .history-panel, .section-card {
    width: 100%;
    min-width: 0;
    padding: 1.25rem 1rem;
    margin: 0.75rem 0;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--glass-card-bg-gradient) !important;
    border: 1px solid var(--glass-card-border) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

/* Responsive styles for tables in subject-panel (exam summary) */
@media (max-width: 768px) {
  #exam-summary table {
    display: block;
    width: 100%;
    overflow-x: auto;
    background: var(--glass-card-bg) !important;
    border: 1px solid var(--glass-card-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  }
  #exam-summary thead {
    display: none;
  }
  #exam-summary tr {
    display: block;
    margin-bottom: 1.2em;
    border-bottom: 1px solid #2226;
    background: none;
  }
  #exam-summary td {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5em 0.5em;
    text-align: left;
    border: none;
    background: none;
    position: relative;
  }
  #exam-summary td:before {
    content: attr(data-label);
    font-weight: bold;
    display: block;
    margin-bottom: 0.2em;
    color: #7dd3fc;
    font-size: 0.95em;
  }
}

/* ==========================================
   Modern Sidebar Styles
   ========================================== */

/* Responsive Table Cards for Mobile */
@media (max-width: 600px) {
  .table-responsive table, 
  .table-responsive thead, 
  .table-responsive tbody, 
  .table-responsive th, 
  .table-responsive td, 
  .table-responsive tr {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }
  
  .table-responsive thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .table-responsive tr {
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92) !important;
    padding: 0.5rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
  }
  
  .table-responsive td {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    padding-left: 50% !important;
    text-align: right !important;
    white-space: normal;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  
  .table-responsive td:last-child {
    border-bottom: none;
  }
  
  .table-responsive td:before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: var(--primary-light);
    font-size: 0.85rem;
    text-transform: uppercase;
  }
}

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 0px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: var(--primary);
    --sidebar-text: var(--text-secondary);
    --sidebar-text-active: var(--text-primary);
}

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

.main-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1100;
    transition: var(--transition);
}

.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    width: calc(100% - var(--sidebar-width));
}

/* Brand Section */
.sidebar-brand {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.brand-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

/* User Profile in Sidebar */
.sidebar-user {
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 1rem;
    border-radius: 12px;
}

.user-avatar {
    font-size: 2rem;
    color: var(--neon-blue);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow content to shrink and wrap */
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    word-break: break-word;
    line-height: 1.4;
    display: block;
    margin-bottom: 0.2rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--neon-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-item {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
    word-break: break-all;
}

.meta-item i {
    width: 12px;
    text-align: center;
    color: var(--primary-light);
    opacity: 0.7;
}

/* Nav Links */
.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--sidebar-text);
    border-radius: 10px;
    transition: var(--transition);
    text-decoration: none !important;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1.5rem 0;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--error) !important;
}

/* Footer in Sidebar */
.sidebar-footer {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Mobile Toggle & Responsive Navigation */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    left: calc(0.75rem + env(safe-area-inset-left, 0px));
    z-index: 1200;
    width: 44px;
    height: 44px;
    background: rgba(15, 23, 42, 0.92);
    border: 1.5px solid rgba(0, 242, 254, 0.45);
    border-radius: 12px;
    color: #00f2fe;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 242, 254, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:active {
    transform: scale(0.92);
    background: var(--primary);
    color: #ffffff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1050;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    .main-sidebar {
        left: -280px;
        max-width: 85vw;
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.7);
    }

    .main-sidebar.active {
        left: 0;
    }

    .app-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Adjust header in pages to not be covered by toggle */
    header .container {
        padding-left: calc(3.75rem + env(safe-area-inset-left, 0px));
    }
}



/* ==========================================================================
   Dashboard Specific Styles from Legacy dashboard.php
   ========================================================================== */
.dashboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.tab-btn {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn i { font-size: 1.1rem; }
.tab-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  border-color: rgba(0, 229, 255, 0.4);
}
.tab-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #00f2fe 100%) !important;
  color: #ffffff !important;
  border-color: #00f2fe !important;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.45), 0 0 15px rgba(79, 70, 229, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.35) !important;
  font-weight: 700 !important;
  position: relative;
}
.tab-btn.active i {
  color: #ffffff !important;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.85)) !important;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: #ffffff;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 8px #ffffff;
}
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.section-card { margin-bottom: 2rem; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.stat-value { 
  font-size: 2.25rem; 
  font-weight: 700; 
  color: var(--neon-blue); 
  margin: 0.4rem 0; 
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
}
.stat-label { 
  font-size: 0.85rem; 
  color: var(--text-secondary); 
  text-transform: uppercase; 
  letter-spacing: 0.06em; 
  font-weight: 600;
}

.notification-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  color: var(--text-primary);
}
.notification-warning { 
  border-left-color: var(--warning); 
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(245, 158, 11, 0.25);
}
.notification-error { 
  border-left-color: var(--error); 
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(239, 68, 68, 0.25);
}

/* Personalized Announcement / Attachment Banner */
.personalized-attachment-box,
.personalized-box {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  overflow: hidden !important;
}

.personalized-attachment-box .feedback-info {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.personalized-attachment-box .feedback-title {
  color: var(--warning);
  font-weight: 700;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.personalized-attachment-box .feedback-filename {
  font-size: 0.85rem;
  color: #f8fafc;
  font-weight: 500;
  display: block;
  overflow-wrap: anywhere !important;
  word-break: break-all !important;
  line-height: 1.45;
}

.personalized-attachment-box .feedback-download-btn {
  flex-shrink: 0;
  white-space: nowrap;
  background: var(--warning);
  color: #000;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.announcement-attachment-pill,
.announcement-link-pill {
  display: inline-flex !important;
  align-items: center !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
}

.announcement-attachment-pill span,
.announcement-link-pill span {
  overflow-wrap: anywhere !important;
  word-break: break-all !important;
}

.study-material-cta {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(20, 184, 166, 0.2));
  padding: 3rem;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  /* 2-Column Grid for Mobile Dashboard Tabs */
  .dashboard-tabs { 
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 1.5rem !important;
    overflow-x: visible !important;
    width: 100% !important;
  }

  .dashboard-tabs .tab-btn { 
    width: 100% !important;
    padding: 12px 10px !important;
    font-size: 0.88rem !important;
    justify-content: center !important;
    text-align: center !important;
    border-radius: 12px !important;
    min-height: 48px !important;
    white-space: normal !important;
    word-break: break-word !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .dashboard-tabs .tab-btn i { 
    font-size: 1.05rem !important;
    flex-shrink: 0;
  }

  /* When an odd tab is present (e.g. 5th tab in 5-tab admin panel), span both columns */
  .dashboard-tabs .tab-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  /* Compact 3-Column Stat Cards on Mobile */
  .stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 1.5rem;
  }
  .stat-card {
    padding: 0.85rem 0.4rem;
    border-radius: 12px;
  }
  .stat-value {
    font-size: 1.45rem;
    margin: 0.2rem 0;
  }
  .stat-label {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
  }
}

@media (max-width: 480px) {
  .dashboard-tabs {
    gap: 8px !important;
    margin-bottom: 1.25rem !important;
  }

  .dashboard-tabs .tab-btn {
    padding: 10px 6px !important;
    font-size: 0.82rem !important;
    min-height: 46px !important;
    gap: 6px !important;
  }

  .dashboard-tabs .tab-btn i {
    font-size: 0.95rem !important;
  }

  .stat-grid {
    gap: 6px;
    margin-bottom: 1.25rem;
  }
  .stat-card {
    padding: 0.75rem 0.3rem;
    border-radius: 10px;
  }
  .stat-value {
    font-size: 1.25rem;
    margin: 0.15rem 0;
  }
  .stat-label {
    font-size: 0.62rem;
  }
}

/* ==========================================================================
   Admin Subject Panel & Reordering Controls
   ========================================================================== */
.btn-move {
  background: var(--glass);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-move:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-light);
}
.admin-subject-link {
  color: var(--primary-light);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}
.admin-subject-link:hover {
  color: var(--neon-blue);
  text-decoration: underline;
}

/* ==========================================================================
   Cyber Glassmorphism Theme for SweetAlert2 Modals & Input Fields
   ========================================================================== */
.swal2-container {
  z-index: 999999 !important;
  backdrop-filter: blur(8px) !important;
}

.swal2-popup {
  background: #0f172a !important;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96)) !important;
  border: 1px solid rgba(0, 242, 254, 0.35) !important;
  border-radius: 20px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 242, 254, 0.25) !important;
  color: #f8fafc !important;
  font-family: 'Open Sans', 'Inter', -apple-system, sans-serif !important;
  padding: 2rem !important;
  box-sizing: border-box !important;
  max-width: 95vw !important;
}

.swal2-title {
  color: #ffffff !important;
  font-family: 'Orbitron', sans-serif !important;
  letter-spacing: 0.04em !important;
  font-size: 1.45rem !important;
  margin-bottom: 1rem !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100% !important;
}

.swal2-html-container {
  color: #cbd5e1 !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* All inputs inside SweetAlert2 popups: text, email, password */
.swal2-popup input.swal2-input,
.swal2-popup input[type=text],
.swal2-popup input[type=password],
.swal2-popup input[type=email] {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(0, 242, 254, 0.45) !important;
  border-radius: 10px !important;
  padding: 0.85rem 1.1rem !important;
  font-size: 1.05rem !important;
  caret-color: #00f2fe !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.25s ease !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  outline: none !important;
}

.swal2-popup input[type=password] {
  letter-spacing: 4px !important;
  font-weight: 700 !important;
}

.swal2-popup input.swal2-input:focus,
.swal2-popup input[type=text]:focus,
.swal2-popup input[type=password]:focus,
.swal2-popup input[type=email]:focus {
  background: rgba(15, 23, 42, 0.98) !important;
  border-color: #00f2fe !important;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.5) !important;
  color: #ffffff !important;
}

.swal2-popup input::placeholder {
  color: #64748b !important;
  letter-spacing: normal !important;
  font-weight: normal !important;
}

/* Labels and form groups inside SweetAlert2 */
.swal2-popup .form-group label {
  color: #94a3b8 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin-bottom: 6px !important;
  display: block !important;
}

/* Eye toggle for SweetAlert2 password fields */
.swal-password-wrapper {
  position: relative !important;
  width: 100% !important;
  margin-top: 4px !important;
}

.swal-eye-btn {
  position: absolute !important;
  top: 50% !important;
  right: 14px !important;
  transform: translateY(-50%) !important;
  color: var(--neon-blue, #00f2fe) !important;
  cursor: pointer !important;
  font-size: 1.15rem !important;
  z-index: 10 !important;
  opacity: 0.85 !important;
  transition: all 0.2s ease !important;
  padding: 4px !important;
}

.swal-eye-btn:hover {
  opacity: 1 !important;
  color: #ffffff !important;
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.8) !important;
}

/* Buttons in SweetAlert2 */
.swal2-confirm {
  background: linear-gradient(135deg, #4f46e5, #00f2fe) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em !important;
  padding: 10px 24px !important;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4) !important;
  transition: all 0.25s ease !important;
}

.swal2-confirm:hover {
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.6) !important;
  transform: translateY(-1px) !important;
}

.swal2-cancel {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 10px !important;
  padding: 10px 20px !important;
  transition: all 0.25s ease !important;
}

.swal2-cancel:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

.swal2-validation-message {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  border-radius: 8px !important;
  margin-top: 12px !important;
}

/* Selects & Textareas inside SweetAlert2 */
.swal2-popup select.swal2-input,
.swal2-popup select,
.swal2-popup textarea.swal2-textarea,
.swal2-popup textarea {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(0, 242, 254, 0.45) !important;
  border-radius: 10px !important;
  padding: 0.85rem 1.1rem !important;
  font-size: 1rem !important;
  font-family: inherit !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  outline: none !important;
}

.swal2-popup select:focus,
.swal2-popup textarea:focus {
  background: rgba(15, 23, 42, 0.98) !important;
  border-color: #00f2fe !important;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.5) !important;
  color: #ffffff !important;
}

.swal2-popup select option {
  background-color: #0f172a !important;
  color: #ffffff !important;
}

/* Links & Code in SweetAlert2 */
.swal2-popup a {
  color: var(--neon-blue, #00f2fe) !important;
  font-weight: 600 !important;
  text-decoration: underline !important;
}

.swal2-popup a:hover {
  color: #38bdf8 !important;
}

.swal2-popup code {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #00f2fe !important;
  border: 1px solid rgba(0, 242, 254, 0.3) !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
  font-family: monospace !important;
}

/* ==========================================================================
   Comprehensive Mobile UX & Touch Optimization
   ========================================================================== */
@media (max-width: 600px) {
  /* Action groups on cards (Study Materials, etc.) */
  .item-action-group {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 8px !important;
    justify-content: flex-start !important;
  }
  .item-action-group .btn-move {
    min-width: 42px !important;
    min-height: 42px !important;
    font-size: 1.05rem !important;
  }
  .item-action-group .btn {
    min-height: 40px !important;
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
  }

  /* Announcement batch actions (ZIP, CSV, Roster) */
  .announcement-actions {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }
  .announcement-actions .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 11px 14px !important;
    min-height: 44px !important;
    font-size: 0.88rem !important;
    box-sizing: border-box !important;
  }

  /* Admin Active/Archived subject list items */
  .card li .btn {
    min-height: 40px !important;
  }

  /* Personalized Announcement & Feedback Box on Mobile */
  .personalized-attachment-box,
  .personalized-box {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .personalized-attachment-box .feedback-info,
  .personalized-box > div:first-child {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .personalized-attachment-box .feedback-filename,
  .personalized-box .file-name {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: break-all !important;
    line-height: 1.45 !important;
  }
  .personalized-attachment-box .feedback-download-btn,
  .personalized-attachment-box a.btn,
  .personalized-box .btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
  }

  /* SweetAlert2 Mobile Optimization for <= 600px */
  .swal2-popup {
    padding: 1.25rem 0.85rem !important;
    width: 95% !important;
    max-width: 95vw !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
  }
  .swal2-title {
    font-size: 1.2rem !important;
    margin-bottom: 0.75rem !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .swal2-html-container {
    font-size: 0.88rem !important;
    line-height: 1.5 !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
  }
  .swal2-actions {
    width: 100% !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: 1.25rem !important;
  }
  .swal2-actions button {
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    font-size: 0.95rem !important;
  }
  .swal2-popup input.swal2-input,
  .swal2-popup input[type=text],
  .swal2-popup input[type=password],
  .swal2-popup input[type=email],
  .swal2-popup select,
  .swal2-popup textarea {
    font-size: 16px !important; /* Critical: Prevent iOS auto-zoom */
    min-height: 44px !important;
  }
}

@media (max-width: 480px) {

  /* Form inputs & buttons touch ergonomics */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="file"],
  select,
  textarea {
    font-size: 16px !important; /* Prevent iOS auto-zoom */
    min-height: 44px !important;
  }

  .btn {
    min-height: 44px !important;
    font-size: 0.92rem !important;
    padding: 10px 18px !important;
  }

  .btn.small {
    min-height: 40px !important;
    padding: 8px 14px !important;
    font-size: 0.84rem !important;
  }

  /* Login card on small screens */
  .login-glass, .setup-card {
    padding: 1.5rem 1rem !important;
    margin: 1.5rem auto !important;
    width: 96% !important;
  }
  .login-glass h1 {
    font-size: 1.35rem !important;
  }

  /* Subject Cards */
  .subject-card {
    padding: 1.5rem 1rem !important;
  }
  .subject-card span {
    font-size: 1.85rem !important;
  }
}
