/* Modern Professional LMS Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

/* Root variables: map env-provided color vars (e.g. --primary-color) into the semantic tokens used across the stylesheet.
   The server injects --primary-color, --secondary-color, --success-color, etc. from detail/.env via /api/school-details.
   Use fallbacks so the stylesheet remains safe when env values are not present. */
:root {
  /* Color tokens (edit these via detail/.env -> server will inject as CSS vars)
     NOTE: add keys like TEXT_COLOR, BG_COLOR, CARD_BG_COLOR, NAVBAR_BG_COLOR, FOOTER_BG_COLOR
     to detail/.env (they will be exposed as --text-color, --bg-color, --card-bg-color, etc.)
     Example keys you can add to detail/.env:
       TEXT_COLOR=#222222
       BG_COLOR=#f4f7fa
       CARD_BG_COLOR=#ffffff
       NAVBAR_BG_COLOR=rgba(255,255,255,0.98)
       FOOTER_BG_COLOR=#ffffff
     Dark theme variants (prefix with DARK_):
       DARK_TEXT_COLOR=#f4f6f8
       DARK_BG_COLOR=#121212
       DARK_CARD_BG_COLOR=#1e1e1e
       DARK_NAVBAR_BG_COLOR=rgba(30,30,30,0.95)
       DARK_FOOTER_BG_COLOR=#1e1e1e
  */

  --primary:    var(--primary-color,    #4361ee);
  --primary-light: var(--primary-light, #4895ef);
  --primary-dark:  var(--primary-dark,  #3a0ca3);

  --secondary:  var(--secondary-color,  #7209b7);
  --secondary-light: var(--secondary-light, #9d4edd);

  --success:    var(--success-color,    #2ec4b6);
  --danger:     var(--danger-color,     #e63946);
  --warning:    var(--warning-color,    #ff9f1c);
  --info:       var(--info-color,       #4cc9f0);

  /* Derive semantic surface & text variables from env when available */
  --bg:        var(--bg-color,    #f4f7fa);        /* page background */
  --text:      var(--text-color,  #212529);        /* main text color */
  --card-bg:   var(--card-bg-color, #ffffff);      /* card / surface background */
  --navbar-bg: var(--navbar-bg-color, rgba(255,255,255,0.98)); /* navbar surface */
  --footer-bg: var(--footer-bg-color, #ffffff);    /* footer surface */

  /* Keep other fallbacks intact */
  --text-light: var(--text-light-color, #495057);
  --text-muted: var(--text-muted-color, #6c757d);
  --border: var(--border-color, #dee2e6);

  /* ...existing neutral/UI variables... */
  --light: #f8f9fa;
  --dark: #212529;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 16px rgba(17, 17, 26, 0.08), 0 2px 4px rgba(17, 17, 26, 0.04);
  --shadow-sm: 0 2px 8px rgba(17, 17, 26, 0.05);
  --shadow-lg: 0 8px 24px rgba(17, 17, 26, 0.1), 0 4px 8px rgba(17, 17, 26, 0.06);
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --heading-font: 'Poppins', var(--font-family);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  --container-max: 1280px;
  --container-narrow: 900px;

  /* Heading color (can be set by adding HEADING_TEXT_COLOR in detail/.env -> exposed as --heading-text-color).
     Fallback to main text color so headings are distinct from the primary accent by default. */
  --heading-color: var(--heading-text-color, var(--text));
}

/* Hide theme toggle controls globally (removed UI) */
.theme-toggle,
#themeToggle,
.nav-icon-btn#themeToggle {
    display: none !important;
}

/* Dynamic color variables injected by JS from /api/school-details */
/* 
:root {
  --primary: #4361ee;
  --primary-light: #4895ef;
  --primary-dark: #3a0ca3;
  --secondary: #7209b7;
  --secondary-light: #9d4edd;
  --success: #2ec4b6;
  --danger: #e63946;
  --warning: #ff9f1c;
  --info: #4cc9f0;
}
*/

/* Dark theme */
[data-theme="dark"] {
  --primary: var(--dark-primary-color, var(--primary));
  --primary-light: var(--dark-primary-light, var(--primary-light));
  --primary-dark: var(--dark-primary-dark, var(--primary-dark));
  --secondary: var(--dark-secondary-color, var(--secondary));
  --success: var(--dark-success-color, var(--success));
  --danger: var(--dark-danger-color, var(--danger));
  --warning: var(--dark-warning-color, var(--warning));
  --info: var(--dark-info-color, var(--info));

  /* Dark surface & text mapping (env-driven if present) */
  --bg:        var(--dark-bg-color,    #121212);
  --text:      var(--dark-text-color,  #f8f9fa);
  --card-bg:   var(--dark-card-bg-color, #1e1e1e);
  --navbar-bg: var(--dark-navbar-bg-color, rgba(30, 30, 30, 0.95));
  --footer-bg: var(--dark-footer-bg-color, #1e1e1e);

  --text-light: var(--dark-text-light-color, #e9ecef);
  --text-muted: var(--dark-text-muted-color, #adb5bd);
  --border: var(--dark-border-color, #495057);

  --focus: var(--dark-focus-color, rgba(76, 201, 240, 0.25));
  --hover-bg: var(--dark-hover-bg, #2a2a2a);

  /* Dark heading color (optional env key: DARK_HEADING_TEXT_COLOR) */
  --heading-color: var(--dark-heading-text-color, var(--text));
}

/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
  transition: var(--transition);
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: inherit;
  letter-spacing: 0.01em;
  font-weight: 400;
  line-height: 1.6;
  transition: var(--transition);
  overflow-x: hidden;
  width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--heading-font);
  margin-top: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--heading-color); /* previously: var(--primary) */
  line-height: 1.3;
}

h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* Layout */
.container {
  max-width: var(--container-max);
  width: 100%;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.container-narrow {
  max-width: var(--container-narrow);
}

/* Navigation */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navbar-bg);
  color: var(--primary);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.navbar .logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  font-family: var(--heading-font);
}

.navbar .nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.navbar .nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.2s ease;
}

.navbar .nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.navbar .nav-links a:hover {
  color: var(--primary);
}

.navbar .nav-links a:hover::after {
  width: 100%;
}

.navbar .nav-links a.active {
  color: var(--primary);
}

.navbar .nav-links a.active::after {
  width: 100%;
}

/* Menu toggle for mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
  z-index: 1001;
}

.menu-toggle span {
  height: 3px;
  width: 100%;
  background: var(--text);
  border-radius: 10px;
  transition: all 0.3s ease;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  margin-left: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--primary);
  background: var(--hover-bg);
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
  margin-bottom: 2rem;
  position: relative;
  color: var(--text);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

[data-theme="dark"] .card {
  border-color: var(--gray-800);
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-title {
  font-size: 1.1rem;
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.card-title i {
  margin-right: 8px;
}

/* Card animation */
.card-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Quick action cards */
.quick-action-card {
  background: var(--card-bg);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  text-align: center;
  border: 1px solid var(--gray-200);
  transition: var(--transition-slow);
}

[data-theme="dark"] .quick-action-card {
  border-color: var(--gray-800);
}

.quick-action-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.quick-action-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
  transition: var(--transition);
}

.quick-action-card:hover .quick-action-icon {
  transform: scale(1.1);
  color: var(--primary-light);
}

/* Summary cards */
.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  transition: var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.summary-icon {
  font-size: 2.5rem;
  margin-right: 1rem;
  color: white;
}

.summary-info {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.btn:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--secondary);
}

.btn-secondary:hover {
  background: var(--secondary-light);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #c4303c;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn:disabled {
  background: var(--gray-400);
  color: var(--gray-700);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  border-color: var(--gray-700);
  background: var(--gray-900);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus);
}

/* Floating label animation */
.form-group.floating {
  position: relative;
}

.form-group.floating label {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  margin-bottom: 0;
  transition: all 0.2s ease;
  pointer-events: none;
  opacity: 0.7;
}

.form-group.floating label.active,
.form-group.floating input:focus ~ label,
.form-group.floating textarea:focus ~ label,
.form-group.floating select:focus ~ label,
.form-group.floating input:not(:placeholder-shown) ~ label,
.form-group.floating textarea:not(:placeholder-shown) ~ label {
  top: -0.5rem;
  left: 0.75rem;
  font-size: 0.75rem;
  padding: 0 0.25rem;
  background: var(--card-bg);
  opacity: 1;
  color: var(--primary);
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Footer */
footer {
  background: var(--footer-bg);
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

/* Tables */
.accounts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accounts-table th, .accounts-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.accounts-table th {
  background-color: var(--gray-100);
  color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .accounts-table th {
  background-color: var(--gray-800);
}

.accounts-table tr:hover {
  background-color: var(--hover-bg);
}

.accounts-table tr:last-child td {
  border-bottom: none;
}

/* Action buttons in tables */
.btn-action {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  margin-right: 0.5rem;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  transition: var(--transition);
}

.btn-edit {
  color: var(--info);
  border-color: var(--info);
}

.btn-edit:hover {
  background: var(--info);
  color: white;
}

.btn-delete {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-delete:hover {
  background: var(--danger);
  color: white;
}

/* Status and message displays */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--gray-600);
  font-weight: 500;
}

.loading-spinner:before {
  content: "";
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin-right: 1rem;
  animation: spinner 1s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.no-accounts-message, .no-classes-message {
  text-align: center;
  padding: 2rem;
  font-style: italic;
  color: var(--text-muted);
  background: var(--hover-bg);
  border-radius: var(--radius);
  margin: 1rem 0;
  border: 1px dashed var(--border);
}

/* Success and error messages */
.success-message, .error-message {
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-size: 1rem;
  display: none;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

.success-message {
  background: #e3fcef;
  color: #0c6b3d;
  border: 1px solid #c3e6cb;
}

.error-message {
  background: #fee6ea;
  color: #b02a37;
  border: 1px solid #f5c2c7;
}

[data-theme="dark"] .success-message {
  background: rgba(46, 196, 182, 0.15);
  color: #3fdfc9;
  border-color: rgba(46, 196, 182, 0.4);
}

[data-theme="dark"] .error-message {
  background: rgba(230, 57, 70, 0.15);
  color: #ff6b6b;
  border-color: rgba(230, 57, 70, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0; 
  left: 0;
  right: 0; 
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  animation: modalIn 0.3s forwards;
}

.modal.active .modal-content {
  transform: scale(1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.close-modal {
  color: var(--text-muted);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.close-modal:hover {
  color: var(--danger);
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--dark);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  z-index: 1200;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tooltip:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: var(--dark) transparent transparent transparent;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Notification styles */
.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.5rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 1050;
  max-width: 350px;
  border-left: 4px solid var(--primary);
}

/* Header / Sidebar badge styles for notifications and chat */
.notification-badge, .chat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    line-height: 1;
    border-radius: 12px;
    color: #fff;
    background: var(--danger);
}

/* When badge is inside a sidebar link (which is a flex row), push it to the far right */
.sidebar-nav a .notification-badge,
.sidebar-nav a .chat-badge {
    margin-left: auto;
    margin-right: 0;
}

/* Header bell: keep badge absolute top-right for compact look */
#notificationBtn .notification-badge,
.nav-icon-chat .chat-badge,
#chatBtn .chat-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    margin-left: 0;
    background: var(--danger);
}

/* Chat badge color variant */
.chat-badge { background: var(--success); }

.notification.visible {
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  margin-left: 1rem;
  padding: 0.25rem;
}

.notification.info {
  border-left-color: var(--info);
}

.notification.success {
  border-left-color: var(--success);
}

.notification.warning {
  border-left-color: var(--warning);
}

.notification.error {
  border-left-color: var(--danger);
}

/* Hero banner */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.hero:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="white" fill-opacity="0.05" d="M0,160L48,170.7C96,181,192,203,288,208C384,213,480,203,576,197.3C672,192,768,192,864,192C960,192,1056,192,1152,181.3C1248,171,1344,149,1392,138.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
  background-size: cover;
  background-position: center;
  opacity: 0.2;
}

.hero h1 {
  font-size: 3rem;
  color: white;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto 2rem;
}

.hero .btn {
  margin: 0.5rem;
  min-width: 150px;
}

/* Feature cards */
.feature-card {
  padding: 2rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--primary);
  margin-bottom: 2rem;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.feature-card h3 {
  margin-top: 0;
}

/* Feature list */
.feature-list {
  list-style-type: none;
  padding-left: 0;
}

.feature-list li {
  padding: 0.5rem 0;
  position: relative;
  padding-left: 1.5rem;
  line-height: 1.5;
}

.feature-list li:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: bold;
}

/* New Sidebar Navigation */
.page-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.sidebar {
  width: 250px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 990;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 1rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--heading-font);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-section {
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.nav-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav a:hover {
  background: var(--hover-bg);
  color: var(--primary);
}

.sidebar-nav a.active {
  background: var(--primary);
  color: white;
}

.content-wrapper {
  flex: 1;
  margin-left: 250px;
  transition: margin-left 0.3s ease;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 991px) {
  .content-wrapper {
    margin-left: 0 !important;
  }
}

.container {
  margin-top: 1rem;
}

/* Modified navbar for new layout */
.navbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.5rem 1rem;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 980;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .navbar {
    padding: 0.5rem 1.5rem;
  }
}

@media (min-width: 1200px) {
  .navbar {
    padding: 0.5rem 2rem;
  }
}

.navbar .logo {
  margin-right: auto;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text);
  padding: 0.5rem;
  margin-right: 1rem;
}

/* Unify navbar border color for all roles */
body.admin .navbar,
body.teacher .navbar,
body.student .navbar,
body.principal .navbar {
  border-bottom: 3px solid var(--primary);
}

/* Remove these old role-specific overrides (delete these blocks if present) */
/*
body.teacher .navbar {
  border-bottom: 3px solid var(--success);
}
body.student .navbar {
  border-bottom: 3px solid var(--danger);
}
body.principal .navbar {
  border-bottom: 3px solid var(--info);
}
*/

/* Responsive adjustments */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .content-wrapper {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 985;
  }
  
  .sidebar-backdrop.show {
    display: block;
  }
}

/* User profile in sidebar */
.sidebar-profile {
  padding: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.profile-info-small {
  overflow: hidden;
}

.profile-name-small {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role-small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Enhanced modal styles */
.modal-lg .modal-content {
    max-width: 90vw;
    width: 800px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(4px);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

/* Enhanced table responsiveness */
.table-responsive {
    overflow-x: auto;
    margin: -1px;
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .assessment-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .status-guide {
        grid-template-columns: 1fr;
    }
    
    .status-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        text-align: left;
    }
    
    .class-list, .subject-list {
        justify-content: flex-start;
    }
    
    .assessment-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-lg .modal-content {
        width: 95vw;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .grid.grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Enhanced action buttons */
.btn-action.btn-view {
    background: var(--info);
    color: white;
}

.btn-action.btn-view:hover {
    background: var(--info-dark);
}

/* Light/dark theme enhancements */
[data-theme="dark"] .status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: rgb(16, 185, 129);
}

[data-theme="dark"] .status-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: rgb(245, 158, 11);
}

[data-theme="dark"] .status-badge.danger {
    background: rgba(239, 68, 68, 0.2);
    color: rgb(239, 68, 68);
}

[data-theme="dark"] .type-badge {
    background: rgba(59, 130, 246, 0.2);
    color: rgb(59, 130, 246);
}

[data-theme="dark"] .class-badge,
[data-theme="dark"] .subject-badge {
    background: rgba(156, 163, 175, 0.2);
    color: rgb(156, 163, 175);
}


/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--gray-900);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--gray-700);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Role-specific styling */
body.admin .navbar {
  border-bottom: 3px solid var(--primary);
}

body.teacher .navbar {
  border-bottom: 3px solid var(--primary);
}

body.student .navbar {
  border-bottom: 3px solid var(--primary);
}

body.principal .navbar {
  border-bottom: 3px solid var(--primary);
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.bg-primary { background-color: var(--primary); color: white; }
.bg-secondary { background-color: var(--secondary); color: white; }
.bg-success { background-color: var(--success); color: white; }
.bg-danger { background-color: var(--danger); color: white; }
.bg-warning { background-color: var(--warning); color: white; }
.bg-info { background-color: var(--info); color: white; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* Insight items for class overview */
.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  line-height: 1.5;
  border-left: 4px solid;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.insight-item i {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.insight-item.success {
  border-left-color: var(--success);
  background: rgba(46, 196, 182, 0.08);
  color: var(--text);
}

.insight-item.success i {
  color: var(--success);
}

.insight-item.warning {
  border-left-color: var(--warning);
  background: rgba(255, 159, 28, 0.08);
  color: var(--text);
}

.insight-item.warning i {
  color: var(--warning);
}

.insight-item.danger {
  border-left-color: var(--danger);
  background: rgba(230, 57, 70, 0.08);
  color: var(--text);
}

.insight-item.danger i {
  color: var(--danger);
}

.insight-item.info {
  border-left-color: var(--info);
  background: rgba(76, 201, 240, 0.08);
  color: var(--text);
}

.insight-item.info i {
  color: var(--info);
}

[data-theme="dark"] .insight-item {
  background: rgba(30, 30, 30, 0.5);
}

[data-theme="dark"] .insight-item.success {
  background: rgba(46, 196, 182, 0.12);
}

[data-theme="dark"] .insight-item.warning {
  background: rgba(255, 159, 28, 0.12);
}

[data-theme="dark"] .insight-item.danger {
  background: rgba(230, 57, 70, 0.12);
}

[data-theme="dark"] .insight-item.info {
  background: rgba(76, 201, 240, 0.12);
}

/* Student detail modal enhancements */
.student-detail-grid {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.detail-section {
    background: var(--hover-bg);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.detail-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-section p {
    margin-bottom: 0.75rem;
}

.detail-section p:last-child {
    margin-bottom: 0;
}

.modal-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.access-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--light);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

[data-theme="dark"] .access-note {
    background: var(--gray-800);
}

.access-note p {
    margin: 0;
    color: var(--text-muted);
}

.access-note i {
    color: var(--info);
}

/* Challan Generator Styles */
.challan-copy {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    min-width: 280px;
    max-width: 420px;
    display: inline-block;
    vertical-align: top;
    width: 32%;
    margin-right: 1%;
}
.challan-copy:last-child {
    margin-right: 0;
}
.challan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    gap: 1rem;
}
.challan-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.challan-header-left img.output-logo {
    height: 56px;
    width: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
}
.challan-header-right {
    text-align: right;
}
.challan-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}
.challan-details {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
}
.challan-fee-table {
    margin-top: 1.5rem;
}
.challan-fee-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}
.challan-fee-table th, .challan-fee-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.challan-fee-table th {
    background: var(--gray-100);
    color: var(--primary);
    font-weight: 600;
}
.challan-fee-table .font-bold {
    font-weight: 700;
}
.challan-note {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}
.challan-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 2rem;
    font-size: 1rem;
    gap: 1rem;
}
.challan-footer-left {
    width: 65%;
}
.challan-footer-left .output-amount-in-words {
    border-bottom: 1px dotted var(--border);
    padding-bottom: 0.5rem;
    min-height: 2.2em;
}
.challan-footer-right {
    width: 35%;
    text-align: center;
    padding-top: 1rem;
}
.challan-bank-stamp {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.school-logo {
    height: 56px;
    width: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    outline: none;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    background: var(--bg);
}
.text-muted {
    color: var(--text-muted);
}
.bg-light {
    background: var(--gray-100);
}
.w-full {
    width: 100%;
}
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.max-h-48 { max-height: 12rem; }
.rounded { border-radius: var(--radius); }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-1 { padding: 0.25rem; }
.bg-white { background: #fff; }
.bg-card { background: var(--card-bg); }
.border { border: 1px solid var(--border); }
.border-dotted { border-style: dotted; }
.border-top { border-top: 1px solid var(--border); }
.text-lg { font-size: 1.25rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.85rem; }
.text-sm { font-size: 0.95rem; }
.max-w-screen-xl { max-width: 1280px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.mt-8 { margin-top: 2rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-1 { padding-bottom: 0.25rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.max-w-420 { max-width: 420px; }
.inline-block { display: inline-block; }
.vertical-align-top { vertical-align: top; }

/* Print styles for challan */
@media print {
    @page {
        size: landscape;
        margin: 0.5cm;
    }
    body * {
        visibility: hidden;
    }
    #challan-preview-container, #challan-preview-container * {
        visibility: visible;
    }
    #challan-preview-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }
    .sidebar, .sidebar-backdrop, .navbar, .theme-toggle, .menu-toggle, #challan-form-container, #print-button-container, footer {
        display: none !important;
    }
    .content-wrapper, .container, .container-narrow, #challan-preview-container {
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
        width: 100% !important;
        border: none !important;
    }
    #challan-output {
        display: flex !important;
        width: 100% !important;
        justify-content: space-around !important;
        gap: 1rem;
    }
    .challan-copy {
        page-break-inside: avoid !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
        padding: 0.5rem !important;
        width: 32% !important;
        display: inline-block !important;
        vertical-align: top !important;
        margin: 0 !important;
    }
    .challan-copy:not(:last-child) {
        border-right: 2px dashed #666 !important;
    }
}


.empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.8;
}
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
}
.chat-input input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.chat-input button {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.chat-input button:hover {
    background: var(--primary-dark);
}
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #323232;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 120;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
}
.toast.show {
    display: block;
    animation: fade 0.35s ease;
}
@keyframes fade {
    from { opacity: 0; transform: translate(-50%,8px);}
    to { opacity: 1; transform: translate(-50%,0);}
}

/* Chat UI - Bubble, Avatar, Input, Scrollbar, Responsive, Error Fixes */
.page {
    display: flex;
    height: 100vh;
    gap: 16px;
    padding: 16px;
    box-sizing: border-box;
    background: var(--bg);
}
.chat-list {
    width: 360px;
    min-width: 260px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: 100vh;
}
.list-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    z-index: 2;
}
.search {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--hover-bg);
    padding: 8px;
    border-radius: 20px;
    gap: 8px;
    margin-bottom: 8px;
}
.search input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 1rem;
    color: var(--text);
}
.contacts {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 8px;
}
.contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--hover-bg);
    cursor: pointer;
    transition: background 0.15s;
}
.contact:hover {
    background: var(--hover-bg);
}
.contact .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.contact .meta {
    flex: 1;
    min-width: 0;
}
.contact .meta .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
}
.contact .meta .last {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge {
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 8px;
}
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    height: 100%;
    max-height: 100vh;
}
.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-top .back {
    display: none;
    background: var(--hover-bg);
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.chat-top .back:hover {
    background: var(--primary-light);
    color: #fff;
}
.chat-top .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.messages {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--bg), var(--card-bg));
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.msg {
    position: relative;
    max-width: 70%;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    font-size: 1rem;
    word-break: break-word;
    transition: background 0.2s;
    min-width: 80px;
}
.msg.me {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}
.msg.me:after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-bottom-right-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.msg.them {
    background: var(--card-bg);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid var(--border);
}
.msg.them:after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: var(--card-bg);
    border-bottom-left-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .msg.them {
    background: var(--gray-900);
    color: var(--text-light);
    border: 1px solid var(--gray-700);
}
[data-theme="dark"] .msg.them:after {
    background: var(--gray-900);
    border-left: 1px solid var(--gray-700);
    border-bottom: 1px solid var(--gray-700);
}
.msg .time {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
    opacity: 0.7;
}
.empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.8;
}
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
}
.chat-input input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.chat-input button {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.chat-input button:hover {
    background: var(--primary-dark);
}
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #323232;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 120;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
}
.toast.show {
    display: block;
    animation: fade 0.35s ease;
}
@keyframes fade {
    from { opacity: 0; transform: translate(-50%,8px);}
    to { opacity: 1; transform: translate(-50%,0);}
}

/* Attendance Page Styles */
.header {
    background: var(--primary);
    color: var(--heading-color, white);
    padding: 20px;
    margin: -2rem -2rem 2rem -2rem;
    border-radius: var(--radius) var(--radius) 0 0;
}
.header h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--heading-color, white);
}
.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 1rem;
}
.calendar-wrap {
    margin-bottom: 1.25rem;
}
.calendar-table {
    border-collapse: collapse;
    width: 100%;
    background: var(--card-bg, #f9f9fc);
}
.calendar-table th, .calendar-table td {
    border: 1px solid var(--border, #eee);
    padding: 6px;
    text-align: center;
    font-size: 13px;
}
.calendar-table th {
    background: var(--gray-100, #f1f3f7);
}
.calendar-table td.day-cell {
    cursor: pointer;
}
.calendar-table td.selected {
    background: var(--primary);
    color: #fff;
}
.calendar-table td.today {
    border: 2px solid var(--primary);
}
.calendar-table td .count {
    display: block;
    font-size: 12px;
    color: var(--primary);
}
.student-list {
    border-top: 1px solid var(--border, #eee);
}
.student {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100, #f4f4f4);
}
.student .left {
    display: flex;
    gap: 12px;
    align-items: center;
}
.student .name {
    font-weight: 600;
}
.report {
    margin-top: 1.25rem;
}
.status-present {
    background: var(--success, #e6f7ea);
    color: #2a7a36;
}
.status-absent {
    background: var(--danger, #fff1f0);
    color: #b02a2a;
}
.status-leave {
    background: var(--warning, #fffbe6);
    color: #b08a00;
}
.small {
    font-size: 13px;
    color: var(--text-muted, #666);
}
.export-btn {
    margin-top: 12px;
}


.badge {
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 8px;
}
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    height: 100%;
    max-height: 100vh;
}
.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-top .back {
    display: none;
    background: var(--hover-bg);
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.chat-top .back:hover {
    background: var(--primary-light);
    color: #fff;
}
.chat-top .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.messages {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--bg), var(--card-bg));
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.msg {
    position: relative;
    max-width: 70%;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    font-size: 1rem;
    word-break: break-word;
    transition: background 0.2s;
    min-width: 80px;
}
.msg.me {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}
.msg.me:after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-bottom-right-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.msg.them {
    background: var(--card-bg);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid var(--border);
}
.msg.them:after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: var(--card-bg);
    border-bottom-left-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .msg.them {
    background: var(--gray-900);
    color: var(--text-light);
    border: 1px solid var(--gray-700);
}
[data-theme="dark"] .msg.them:after {
    background: var(--gray-900);
    border-left: 1px solid var(--gray-700);
    border-bottom: 1px solid var(--gray-700);
}
.msg .time {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
    opacity: 0.7;
}
.empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.8;
}
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
}
.chat-input input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.chat-input button {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.chat-input button:hover {
    background: var(--primary-dark);
}
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #323232;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 120;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
}
.toast.show {
    display: block;
    animation: fade 0.35s ease;
}
@keyframes fade {
    from { opacity: 0; transform: translate(-50%,8px);}
    to { opacity: 1; transform: translate(-50%,0);}
}

/* Chat UI - Bubble, Avatar, Input, Scrollbar, Responsive, Error Fixes */
.page {
    display: flex;
    height: 100vh;
    gap: 16px;
    padding: 16px;
    box-sizing: border-box;
    background: var(--bg);
}
.chat-list {
    width: 360px;
    min-width: 260px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: 100vh;
}
.list-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    z-index: 2;
}
.search {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--hover-bg);
    padding: 8px;
    border-radius: 20px;
    gap: 8px;
    margin-bottom: 8px;
}
.search input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 1rem;
    color: var(--text);
}
.contacts {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 8px;
}
.contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--hover-bg);
    cursor: pointer;
    transition: background 0.15s;
}
.contact:hover {
    background: var(--hover-bg);
}
.contact .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.contact .meta {
    flex: 1;
    min-width: 0;
}
.contact .meta .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
}
.contact .meta .last {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge {
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 8px;
}
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    height: 100%;
    max-height: 100vh;
}
.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-top .back {
    display: none;
    background: var(--hover-bg);
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.chat-top .back:hover {
    background: var(--primary-light);
    color: #fff;
}
.chat-top .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.messages {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--bg), var(--card-bg));
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.msg {
    position: relative;
    max-width: 70%;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    font-size: 1rem;
    word-break: break-word;
    transition: background 0.2s;
    min-width: 80px;
}
.msg.me {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}
.msg.me:after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-bottom-right-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.msg.them {
    background: var(--card-bg);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid var(--border);
}
.msg.them:after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: var(--card-bg);
    border-bottom-left-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .msg.them {
    background: var(--gray-900);
    color: var(--text-light);
    border: 1px solid var(--gray-700);
}
[data-theme="dark"] .msg.them:after {
    background: var(--gray-900);
    border-left: 1px solid var(--gray-700);
    border-bottom: 1px solid var(--gray-700);
}
.msg .time {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
    opacity: 0.7;
}
.empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.8;
}
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
}
.chat-input input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.chat-input button {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.chat-input button:hover {
    background: var(--primary-dark);
}
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #323232;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 120;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
}
.toast.show {
    display: block;
    animation: fade 0.35s ease;
}
@keyframes fade {
    from { opacity: 0; transform: translate(-50%,8px);}
    to { opacity: 1; transform: translate(-50%,0);}
}

/* Chat UI - Bubble, Avatar, Input, Scrollbar, Responsive, Error Fixes */
.page {
    display: flex;
    height: 100vh;
    gap: 16px;
    padding: 16px;
    box-sizing: border-box;
    background: var(--bg);
}
.chat-list {
    width: 360px;
    min-width: 260px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: 100vh;
}
.list-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    z-index: 2;
}
.search {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--hover-bg);
    padding: 8px;
    border-radius: 20px;
    gap: 8px;
    margin-bottom: 8px;
}
.search input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 1rem;
    color: var(--text);
}
.contacts {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 8px;
}
.contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--hover-bg);
    cursor: pointer;
    transition: background 0.15s;
}
.contact:hover {
    background: var(--hover-bg);
}
.contact .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.contact .meta {
    flex: 1;
    min-width: 0;
}
.contact .meta .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
}
.contact .meta .last {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge {
    background: var(--success);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    margin-left: 8px;
}
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    height: 100%;
    max-height: 100vh;
}
.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-top .back {
    display: none;
    background: var(--hover-bg);
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.chat-top .back:hover {
    background: var(--primary-light);
    color: #fff;
}
.chat-top .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    letter-spacing: 1px;
}
.messages {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--bg), var(--card-bg));
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.msg {
    position: relative;
    max-width: 70%;
    margin-bottom: 10px;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(17,17,26,0.07);
    font-size: 1rem;
    word-break: break-word;
    transition: background 0.2s;
    min-width: 80px;
}
.msg.me {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
}
.msg.me:after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-bottom-right-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.msg.them {
    background: var(--card-bg);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 18px;
    border-top-left-radius: 18px;
    border-bottom-right-radius: 18px;
    border: 1px solid var(--border);
}
.msg.them:after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 16px;
    height: 16px;
    background: var(--card-bg);
    border-bottom-left-radius: 16px;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .msg.them {
    background: var(--gray-900);
    color: var(--text-light);
    border: 1px solid var(--gray-700);
}
[data-theme="dark"] .msg.them:after {
    background: var(--gray-900);
    border-left: 1px solid var(--gray-700);
    border-bottom: 1px solid var(--gray-700);
}
.msg .time {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
    opacity: 0.7;
}
.empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.8;
}
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    z-index: 2;
}
.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: border 0.2s;
}
.chat-input input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.chat-input button {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.chat-input button:hover {
    background: var(--primary-dark);
}
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    background: #323232;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 120;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
}
.toast.show {
    display: block;
    animation: fade 0.35s ease;
}
@keyframes fade {
    from { opacity: 0; transform: translate(-50%,8px);}
    to { opacity: 1; transform: translate(-50%,0);}
}

/* Attendance Page Styles */
.header {
    background: var(--primary);
    color: white;
    padding: 20px;
    margin: -2rem -2rem 2rem -2rem;
    border-radius: var(--radius) var(--radius) 0 0;
}
.header h1 {
    margin: 0;
    font-size: 2rem;
    color: white;
}
.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 1rem;
}
.calendar-wrap {
    margin-bottom: 1.25rem;
}
.calendar-table {
    border-collapse: collapse;
    width: 100%;
    background: #f9f9fc;
}
.calendar-table th, .calendar-table td {
    border: 1px solid #eee;
    padding: 6px;
    text-align: center;
    font-size: 13px;
}
.calendar-table th {
    background: #f1f3f7;
}
.calendar-table td.day-cell {
    cursor: pointer;
}
.calendar-table td.selected {
    background: var(--primary);
    color: #fff;
}
.calendar-table td.today {
    border: 2px solid var(--primary);
}
.calendar-table td .count {
    display: block;
    font-size: 12px;
    color: var(--primary);
}
.student-list {
    border-top: 1px solid #eee;
}
.student {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f4f4f4;
}
.student .left {
    display: flex;
    gap: 12px;
    align-items: center;
}
.student .name {
    font-weight: 600;
}
.report {
    margin-top: 1.25rem;
}
.status-present {
    background: #e6f7ea;
    color: #2a7a36;
}
.status-absent {
    background: #fff1f0;
    color: #b02a2a;
}
.status-leave {
    background: #fffbe6;
    color: #b08a00;
}
.small {
    font-size: 13px;
    color: #666;
}
.export-btn {
    margin-top: 12px;
}

/* Enhanced Attendance System Styles */
.attendance-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.action-buttons {
    margin: 1.5rem 0;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 150px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border, #e0e0e0);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text, #212529);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted, #6c757d);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--light, #f8f9fa);
    color: var(--danger, #e63946);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text, #212529);
}

.modal-body textarea.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border, #e0e0e0);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.modal-body textarea.form-control:focus {
    outline: none;
    border-color: var(--primary, #4361ee);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border, #e0e0e0);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.leave-reason-note {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fff3cd;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leave-reason-note i {
    color: #ff9800;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border, #e0e0e0);
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text, #212529);
}

.attendance-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}

.stat-item.stat-present {
    background: #d4edda;
    color: #155724;
}

.stat-item.stat-absent {
    background: #f8d7da;
    color: #721c24;
}

.stat-item.stat-leave {
    background: #fff3cd;
    color: #856404;
}

.stat-item.stat-unmarked {
    background: #e2e3e5;
    color: #383d41;
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--card-bg, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.attendance-table thead {
    background: linear-gradient(135deg, var(--primary, #4361ee) 0%, var(--primary-dark, #3a0ca3) 100%);
    color: white;
}

.attendance-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attendance-table th:first-child {
    text-align: center;
    width: 60px;
}

.attendance-table th:nth-child(3) {
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
}

.attendance-table tbody tr {
    border-bottom: 1px solid var(--border, #e0e0e0);
    transition: background-color 0.2s ease;
}

.attendance-table tbody tr:hover {
    background: var(--light, #f8f9fa);
}

.attendance-table tbody tr.status-present {
    background: rgba(46, 196, 182, 0.05);
}

.attendance-table tbody tr.status-absent {
    background: rgba(230, 57, 70, 0.05);
}

.attendance-table tbody tr.status-leave {
    background: rgba(255, 159, 28, 0.05);
}

.attendance-table td {
    padding: 1rem;
    font-size: 0.9rem;
}

.attendance-table td.text-center {
    text-align: center;
    color: var(--text-muted, #6c757d);
    font-weight: 500;
}

.attendance-table td.student-name {
    font-weight: 600;
    color: var(--text, #212529);
}

.attendance-table td.text-muted {
    color: var(--text-muted, #6c757d);
    font-size: 0.85rem;
}

.attendance-table .status-cell {
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.action-cell {
    text-align: center;
}

.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

.btn-status {
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: var(--light, #f8f9fa);
    color: var(--text-muted, #6c757d);
}

.btn-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-status.btn-present {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-status.btn-present:hover {
    background: #c8e6c9;
    border-color: #4caf50;
}

.btn-status.btn-present.active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-status.btn-absent {
    background: #ffebee;
    color: #c62828;
}

.btn-status.btn-absent:hover {
    background: #ffcdd2;
    border-color: #f44336;
}

.btn-status.btn-absent.active {
    background: #f44336;
    color: white;
    border-color: #f44336;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.btn-status.btn-leave {
    background: #fff8e1;
    color: #f57c00;
}

.btn-status.btn-leave:hover {
    background: #ffecb3;
    border-color: #ff9800;
}

.btn-status.btn-leave.active {
    background: #ff9800;
    color: white;
    border-color: #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.calendar-table .day-number {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.calendar-table .day-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.7rem;
    margin-top: 4px;
}

.calendar-table .day-stats span {
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.calendar-table .stat-present {
    background: #d4edda;
    color: #155724;
}

.calendar-table .stat-absent {
    background: #f8d7da;
    color: #721c24;
}

.calendar-table .stat-leave {
    background: #fff3cd;
    color: #856404;
}

.calendar-table .stat-unmarked {
    background: #e2e3e5;
    color: #6c757d;
    font-size: 0.65rem;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.report-table th,
.report-table td {
    border: 1px solid var(--border, #dee2e6);
    padding: 0.5rem;
    text-align: center;
}

.report-table th {
    background: var(--gray-100, #f1f3f7);
    font-weight: 600;
}

.report-table .status-unmarked {
    background: #f8f9fa;
    color: #adb5bd;
}

.report-table .total-cell {
    font-weight: 700;
    background: var(--light, #f8f9fa);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted, #6c757d);
    font-size: 1.1rem;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted, #6c757d);
}

.error {
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    text-align: center;
}

.btn-primary {
    background: var(--primary, #4361ee);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-dark, #3a0ca3);
}

.btn-secondary {
    background: var(--gray-200, #e9ecef);
    color: var(--text, #212529);
    border: 1px solid var(--border, #ced4da);
}

.btn-secondary:hover {
    background: var(--gray-300, #dee2e6);
}

.subtitle {
    color: var(--text-muted, #6c757d);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .attendance-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .attendance-table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .attendance-table thead {
        display: none;
    }
    
    .attendance-table tbody {
        display: block;
    }
    
    .attendance-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border, #e0e0e0);
        border-radius: 8px;
        padding: 1rem;
        background: var(--card-bg, #fff);
    }
    
    .attendance-table tr.status-present {
        border-left: 4px solid #4caf50;
    }
    
    .attendance-table tr.status-absent {
        border-left: 4px solid #f44336;
    }
    
    .attendance-table tr.status-leave {
        border-left: 4px solid #ff9800;
    }
    
    .attendance-table td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        text-align: left !important;
    }
    
    .attendance-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        width: 100px;
        color: var(--text-muted, #6c757d);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    .attendance-table td:first-child::before {
        content: "Sr. No: ";
    }
    
    .attendance-table td:nth-child(2)::before {
        content: "Name: ";
    }
    
    .attendance-table td:nth-child(3)::before {
        content: "Username: ";
    }
    
    .attendance-table td:nth-child(4)::before {
        content: "Status: ";
    }
    
    .attendance-table td:nth-child(5)::before {
        content: "";
    }
    
    .attendance-table .student-name {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    
    .attendance-table .text-muted {
        font-size: 0.75rem;
    }
    
    .btn-group {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .btn-status {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        flex: 1;
        min-width: 80px;
    }
    
    .leave-reason-note {
        font-size: 0.75rem;
    }
    
    .calendar-table {
        font-size: 0.75rem;
    }
    
    .calendar-table .day-number {
        font-size: 0.9rem;
    }
    
    .calendar-table .day-stats {
        font-size: 0.6rem;
    }
    
    .calendar-table th,
    .calendar-table td {
        padding: 4px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        min-width: auto;
    }
    
    .controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .controls label {
        width: 100%;
    }
    
    .controls input,
    .controls button {
        width: 100%;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .attendance-section {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .section-header {
        padding-bottom: 0.75rem;
    }
    
    .section-header h2 {
        font-size: 1.1rem;
    }
    
    .stat-item {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .btn-status {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .calendar-table .day-stats {
        font-size: 0.55rem;
    }
    
    .report-table {
        font-size: 0.7rem;
    }
    
    .report-table th,
    .report-table td {
        padding: 0.3rem;
    }
}

/* Tablet Landscape (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .attendance-table {
        font-size: 0.85rem;
    }
    
    .btn-status {
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
    }
    
    .section-header h2 {
        font-size: 1.35rem;
    }
}

/* Large Screens (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .attendance-table {
        font-size: 1rem;
    }
    
    .calendar-table {
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .controls,
    .action-buttons,
    .modal-overlay {
        display: none !important;
    }
    
    .attendance-section {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .attendance-table {
        font-size: 10pt;
    }
    
    .btn-status {
        display: none;
    }
    
    .leave-reason-note {
        background: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* ========================================
   MODERN SIDEBAR & HEADER STYLES
   ======================================== */

/* Modern Professional Sidebar - 280px wide */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-color) 100%);
    color: white;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-header {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    font-family: 'DM Sans', 'Poppins', var(--heading-font);
    font-size: 22px;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.sidebar-logo i {
    font-size: 28px;
    background: linear-gradient(135deg, #ffffff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-profile {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.15);
    margin: 16px;
    border-radius: 14px;
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-info-small {
    flex: 1;
}

.profile-name-small {
    font-family: var(--heading-font);
    font-weight: 600;
    font-size: 15px;
    color: white;
    margin-bottom: 2px;
}

.profile-role-small {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.nav-section {
    margin: 24px 0;
}

.nav-section-title {
    padding: 0 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-nav a i {
    width: 20px;
    font-size: 18px;
    text-align: center;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateX(4px);
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: white;
    border-radius: 0 4px 4px 0;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Modern Top Navigation Bar */
.navbar {
    height: 70px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

@media (min-width: 768px) {
    .navbar-left {
        gap: 1.25rem;
    }
}

.page-title-header {
    font-family: var(--heading-font);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .page-title-header {
        font-size: 1.375rem;
    }
}

@media (min-width: 1200px) {
    .page-title-header {
        font-size: 1.625rem;
    }
}

.breadcrumb {
    display: none;
}

@media (min-width: 768px) {
    .breadcrumb {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.8125rem;
        color: var(--text-muted);
        margin-top: 0.125rem;
    }
}

.breadcrumb span {
    color: var(--primary-color);
    font-weight: 500;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .navbar-right {
        gap: 1rem;
    }
}

.nav-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .nav-icon-btn {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        font-size: 1.125rem;
    }
}

.nav-icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    border: 2px solid var(--card-bg-color, white);
    z-index: 10;
    animation: pulse-badge 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

/* Sidebar notification badge */
.sidebar-nav a {
    position: relative;
}

.sidebar-nav a .notification-badge {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    font-size: 12px;
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-width: 90vw;
    background: var(--card-bg-color, white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 15px;
    width: 16px;
    height: 16px;
    background: var(--card-bg-color, white);
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.notification-dropdown-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-dropdown-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.notification-dropdown-content {
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-dropdown-item:hover {
    background: var(--hover-bg-color, #f3f4f6);
}

.notification-dropdown-item.unread {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    border-left: 3px solid var(--primary-color, #007bff);
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 10px;
}

.notification-item-header strong {
    flex: 1;
    font-size: 14px;
    color: var(--text-color, #1f2937);
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted-color, #9ca3af);
    white-space: nowrap;
}

.notification-item-message {
    font-size: 13px;
    color: var(--text-secondary-color, #6b7280);
    line-height: 1.5;
    margin: 0;
}

.notification-dropdown-footer {
    padding: 12px 20px;
    background: var(--bg-secondary-color, #f9fafb);
    border-top: 1px solid var(--border-color, #e5e7eb);
    text-align: center;
}

.btn-see-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.btn-see-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.notification-dropdown-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted-color, #9ca3af);
}

.notification-dropdown-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-dropdown-empty p {
    margin: 0;
    font-size: 14px;
}

.notification-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted-color, #9ca3af);
    font-size: 14px;
}

.notification-loading i {
    margin-right: 8px;
}

.nav-icon-btn.active {
    background: var(--hover-bg-color, #f3f4f6);
    color: var(--primary-color, #007bff);
}

.sidebar-nav a.active .notification-badge {
    border-color: var(--primary-color);
}

/* Content wrapper with sidebar offset */
.content-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--bg-color);
    transition: margin-left 0.3s ease;
}

/* Dashboard specific styles */
.dashboard-container {
    padding: 32px;
    max-width: 1400px;
}

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    padding: 40px;
    color: white;
    margin-bottom: 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
}

.welcome-content {
    position: relative;
    z-index: 1;
}

.welcome-content h1 {
    font-family: var(--heading-font);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.welcome-content p {
    font-size: 16px;
    opacity: 0.95;
    margin-bottom: 24px;
    line-height: 1.6;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.welcome-stat-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-stat-item .number {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--heading-font);
    margin-bottom: 6px;
}

.welcome-stat-item .label {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.stat-icon.primary {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(67, 97, 238, 0.05));
    color: var(--primary-color);
}

.stat-icon.success {
    background: linear-gradient(135deg, rgba(46, 196, 182, 0.1), rgba(46, 196, 182, 0.05));
    color: var(--success-color);
}

.stat-icon.warning {
    background: linear-gradient(135deg, rgba(255, 159, 28, 0.1), rgba(255, 159, 28, 0.05));
    color: var(--warning-color);
}

.stat-icon.info {
    background: linear-gradient(135deg, rgba(76, 201, 240, 0.1), rgba(76, 201, 240, 0.05));
    color: var(--info-color);
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    font-family: var(--heading-font);
    color: var(--text-color);
    line-height: 1.2;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    margin-top: 8px;
}

.stat-trend.up {
    background: rgba(46, 196, 182, 0.1);
    color: var(--success-color);
}

.stat-trend.down {
    background: rgba(230, 57, 70, 0.1);
    color: var(--danger-color);
}

.section-title {
    font-family: var(--heading-font);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: var(--primary-color);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.action-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.action-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.action-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 20px;
    transition: transform 0.3s ease;
}

.action-card:hover .action-icon {
    transform: scale(1.1) rotate(5deg);
}

.action-card h3 {
    font-family: var(--heading-font);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.action-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   COMMON PAGE UTILITY CLASSES
   ======================================== */

/* Page Header Card - Used on all pages for consistent page titles */
.page-header-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    margin-bottom: 2rem;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(67, 97, 238, 0.25);
    border: none;
}

.page-header-card h1 {
    margin: 0 0 0.5rem 0;
    color: white;
    font-size: 2rem;
    font-family: var(--heading-font);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05rem;
}

/* Table Header with Gradient */
.table-header-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    border-bottom: 3px solid var(--primary-color);
    border-radius: var(--radius) var(--radius) 0 0;
}

.table-header-gradient h2 {
    margin: 0 0 0.5rem 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-header-gradient p {
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
}

/* Form Container Card */
.form-container-card {
    background: var(--card-bg);
    padding: 0;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.form-container-card:hover {
    box-shadow: var(--shadow);
}

.form-container-card form {
    padding: 2rem;
}

/* Loading Spinner */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.loading-spinner-container .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-data-message i {
    font-size: 4rem;
    color: var(--border-color);
    display: block;
    margin-bottom: 1.5rem;
}

.no-data-message h3 {
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-family: var(--heading-font);
}

.no-data-message p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Enhanced Form Groups */
.form-group.floating {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-group.floating input,
.form-group.floating select,
.form-group.floating textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-top: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-group.floating label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all 0.3s ease;
    pointer-events: none;
    font-weight: 500;
}

.form-group.floating input:focus,
.form-group.floating input:not(:placeholder-shown),
.form-group.floating select:focus,
.form-group.floating select:not([value=""]),
.form-group.floating textarea:focus,
.form-group.floating textarea:not(:placeholder-shown) {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-group.floating input:focus ~ label,
.form-group.floating input:not(:placeholder-shown) ~ label,
.form-group.floating select:focus ~ label,
.form-group.floating select:not([value=""]) ~ label,
.form-group.floating textarea:focus ~ label,
.form-group.floating textarea:not(:placeholder-shown) ~ label {
    top: 0.75rem;
    font-size: 0.75rem;
    color: var(--primary-color);
}

.form-group.floating input:focus,
.form-group.floating select:focus,
.form-group.floating textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-group.floating small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Table Container */
.table-container-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

/* Insights Section (used in class-overview) */
.insights-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Chat Badge Styles */
.chat-badge {
    display: inline-block;
    background: #e63946;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
    vertical-align: middle;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(230, 57, 70, 0);
    }
}

/* ...existing code... */

/* Student dashboard - additional mobile fixes */
@media (max-width: 991px) {
    /* Ensure content occupies full width when sidebar is hidden */
    .content-wrapper {
        margin-left: 0 !important;
    }
    /* Slightly reduce navbar padding on smaller widths */
    .navbar {
        padding: 0.5rem 1rem !important;
    }
    .navbar .page-title-header {
        font-size: 1rem !important;
    }
}

@media (max-width: 575px) {
    /* Tighten spacing for very small screens */
    .container {
        padding-left: 0.625rem !important;
        padding-right: 0.625rem !important;
    }

    .page-header {
        padding: 0.9rem !important;
    }

    .page-header-text h1 {
        font-size: 1.05rem !important;
        line-height: 1.25 !important;
    }

    /* Hide breadcrumb on smallest screens to avoid overflow */
    .breadcrumb {
        display: none !important;
    }

    /* Make quick action buttons stack and compress */
    .quick-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Ensure notification badge doesn't overflow */
    .notification-badge {
        top: -2px !important;
        right: -2px !important;
        min-width: 18px !important;
        height: 18px !important;
        font-size: 10px !important;
    }

    /* Make notification dropdown responsive when positioned via JS */
    .notification-dropdown {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        left: 8px !important;
        right: 8px !important;
        top: auto !important;
        bottom: auto !important;
        position: fixed !important;
    }

    /* Sidebar behavior: keep it off-canvas by default and toggle with .show */
    .sidebar {
        transform: translateX(-100%) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 995 !important;
    }
    .sidebar.show {
        transform: translateX(0) !important;
    }
    .sidebar-backdrop {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.45) !important;
        z-index: 990 !important;
    }
    .sidebar-backdrop.show {
        display: block !important;
    }
}

/* ==================== Notification Modal Styles ==================== */
#notificationModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

#notificationModal .modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

#notificationModal input[type="checkbox"]:checked ~ i,
#notificationModal label:has(input[type="checkbox"]:checked) {
    border-color: #4361ee;
    background: #f0f4ff;
}

#notificationModal .notification-type-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#notificationModal .notification-type-label:hover {
    border-color: #4361ee;
    background: #f8f9ff;
}

#notificationModal .recipient-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

#notificationModal .recipient-label:hover {
    border-color: #4361ee;
    background: #f8f9ff;
}
