/* ==========================================================================
   Hoja de Estilos para mi Aplicación de Asistencia (styles.css)
   Versión M3 con Layouts Corregidos y Comentarios ADSO
   ========================================================================== */

/* ==============================
   1. Mis Colores y Formas (Variables CSS)
   ============================== */
   :root {
      /* ---- Paleta para Tema Claro (el que se ve normalmente) ---- */
      --clr-primary: #506ba4;
      --clr-on-primary: #ffffff;
      --clr-primary-container: #ffdddd;
      --clr-on-primary-container: #21005e;
      --clr-primary-hover: #14357e;
      --clr-primary-rgb: 103, 80, 164;
  
      --clr-background: #fef7ff;
      --clr-surface: #fef7ff;
      --clr-surface-container: #f3edf7;
      --clr-surface-container-low: #f7f2fa;
      --clr-surface-container-high: #efe7f1;
      --clr-surface-bright: #fef7ff;
      
      --clr-on-surface: #1d1b20;
      --clr-on-surface-variant: #49454e;
      --clr-on-surface-rgb: 29, 27, 32;
  
      --clr-outline: #79747e;
      --clr-outline-variant: #cac4cf;
  
      --clr-danger: #b3261e;
      --clr-on-danger: #ffffff;
      --clr-danger-container: #f9dedc;
      --clr-on-danger-container: #410e0b;
      --clr-danger-rgb: 179, 38, 30;
  
      --clr-success-bg: #d1e7dd;
      --clr-success-text: #4be09a; /* Ajustado, antes era verde muy oscuro #0f5132, ahora más brillante */
      --clr-success-border: #badbcc;
      
      --clr-error-bg: #f8d7da;
      --clr-error-text: #ce3644; /* Ajustado, antes era #721c24 */
      --clr-error-border: #f5c2c7;
      --clr-warning-text: var(--clr-error-text);
  
      --clr-presente-active-bg: #4CAF50; --clr-presente-active-text: white; --clr-presente-active-border: #388e3c;
      --clr-tarde-active-bg: #FFC107;    --clr-tarde-active-text: #333;    --clr-tarde-active-border: #ffa000;
      --clr-ausente-active-bg: #c93737;  --clr-ausente-active-text: white;  --clr-ausente-active-border: #d32f2f;
      --clr-permiso-active-bg: #03A9F4;  --clr-permiso-active-text: white;  --clr-permiso-active-border: #0288d1;
      
      --clr-presente-bg: #caf9ce; --clr-presente-text: #2e7d32; --clr-presente-rgb: 46, 125, 50;
      --clr-tarde-bg: #fcefc4;    --clr-tarde-text: #ffa000;   --clr-tarde-rgb: 255, 160, 0;
      --clr-ausente-bg: rgb(255, 192, 201);  --clr-ausente-text: #c62828;  --clr-ausente-rgb: 198, 40, 40;
      --clr-permiso-bg: #e1f5fe;  --clr-permiso-text: #0277bd;  --clr-permiso-rgb: 2, 119, 189;
      
      --clr-sin-marcar-bg: #e0e0e0; 
      --clr-sin-marcar-text: #757575; 
      --clr-sin-marcar-border: #bdbdbd; 
      
      --clr-retirado-card-bg: #f5f5f5; --clr-retirado-card-border: #bdbdbd;
      --clr-retirado-indicator-bg: var(--clr-error-bg); --clr-retirado-indicator-text: var(--clr-error-text); --clr-retirado-indicator-border: var(--clr-error-border);
      --clr-text-disabled: #bdbdbd; --clr-border-disabled: var(--clr-outline-variant);
      
      --clr-toggle-text: var(--clr-on-surface-variant); --clr-toggle-border: var(--clr-outline-variant); --clr-toggle-hover-bg: rgba(var(--clr-primary-rgb), 0.16); --clr-toggle-hover-text: var(--clr-primary);
      --clr-edit-text: var(--clr-primary); --clr-edit-border: var(--clr-outline-variant); --clr-edit-hover-bg: rgba(var(--clr-primary-rgb), 0.16);
      --clr-delete-text: var(--clr-danger); --clr-delete-border: var(--clr-outline-variant); --clr-delete-hover-bg: rgba(var(--clr-danger-rgb), 0.16);
      
      --clr-shadow-level1: 0 1px 2px rgba(0,0,0,0.1), 0 1px 1px rgba(0,0,0,0.08);
      --clr-shadow-level2: 0 1px 2px rgba(0,0,0,0.1), 0 2px 3px rgba(0,0,0,0.08);
      --clr-shadow-level3: 0 4px 4px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
      --clr-scrim: rgba(0, 0, 0, 0.4); 
      --clr-loader-track: #e0e0e0; --clr-loader-bar: var(--clr-primary);
      
      --radius-xs: 4px; --radius-s: 8px; --radius-m: 12px; --radius-l: 16px; --radius-xl: 28px; --radius-full: 99px;
      --transition-speed: 0.2s;
  }
  
  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; font-family: 'Roboto', sans-serif; background-color: var(--clr-background); color: var(--clr-on-surface); line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  
  /* ==============================
     2. Contenedor Principal
     ============================== */
  .container { max-width: 950px; margin: 24px auto; padding: 16px; background-color: var(--clr-surface-container); border-radius: var(--radius-l); box-shadow: var(--clr-shadow-level1); border: 1px solid var(--clr-outline-variant); }
  
  /* ==============================
     3. Encabezado de la Página (Header)
     ============================== */
  .app-header {
      background-color: var(--clr-surface);
      color: var(--clr-on-surface);
      padding: 8px 16px;
      border-bottom: 1px solid var(--clr-outline-variant);
      display: flex;
      align-items: center;
      justify-content: flex-start; /* MODIFICADO: Para acomodar botón de menú a la izquierda */
      flex-wrap: wrap; 
      gap: 12px; /* Ajustar gap según necesidad */
      min-height: 64px;
      position: relative; 
  }
  /* El H1 original se mueve a .header-title-bar > h1 más abajo para mejor control con flexbox */
  /* .app-header h1 { margin: 0; font-size: 1.375rem; font-weight: 400; line-height: 1.75rem; flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 100px; color: var(--clr-on-surface); } */
  
  .header-info { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 0; margin: 0; /* order: 2; Se manejará en media query */ }
  .info-item { display: flex; align-items: center; gap: 6px; }
  .header-info span:not(.material-symbols-outlined) { font-size: 0.875rem; color: var(--clr-on-surface-variant); line-height: 1.25rem; white-space: nowrap; }
  .header-info .icon-small { font-size: 1.25rem; color: var(--clr-on-surface-variant); vertical-align: middle; }
  
  /* .header-actions ya no se usa, se reemplaza por .header-actions-main y .side-nav */
  /* .header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } */
  
  /* ==============================
     4. Estilos Generales de Botones
     ============================== */
  .button, .attendance-actions button, .button-icon, .button-toggle-status {
      font-weight: 500; font-size: 0.875rem; letter-spacing: 0.1px; text-decoration: none;
      cursor: pointer; transition: background-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease, color var(--transition-speed) ease;
      display: inline-flex; align-items: center; justify-content: center; gap: 8px;
      white-space: nowrap; vertical-align: middle; border: none;
      min-height: 40px; padding: 0 24px; border-radius: var(--radius-full);
  }
  .button .material-symbols-outlined, .attendance-actions button .material-symbols-outlined,
  .button-icon .material-symbols-outlined, .button-toggle-status .material-symbols-outlined {
      font-size: 1.125rem; display: block;
  }
  .button { background-color: var(--clr-primary); color: var(--clr-on-primary); box-shadow: var(--clr-shadow-level1); }
  .button:hover { background-color: var(--clr-primary-hover); box-shadow: var(--clr-shadow-level2); }
  .button:active { box-shadow: none; }
  
  /* Botón "Agregar Estudiante" (ahora en side-nav, pero mantenemos por si se usa en otro lado) */
  .btn-add { background-color: var(--clr-primary); color: var(--clr-on-primary); }
  .btn-add:hover { background-color: var(--clr-primary-hover); }

  /* Botón "Cerrar Sesión" - MODIFICADO */
  .button.btn-logout,
  .header-actions .btn-logout { /* Para mantener compatibilidad con HTML anterior si existe */
      background-color: var(--clr-danger-container);
      color: var(--clr-on-danger-container);
      border: 1px solid transparent; /* O var(--clr-danger-container) */
      /* box-shadow: var(--clr-shadow-level1); Ya viene de .button */
  }
  .button.btn-logout:hover,
  .header-actions .btn-logout:hover {
      background-color: var(--clr-danger);
      color: var(--clr-on-danger);
      border-color: var(--clr-danger); /* Opcional */
      /* box-shadow: var(--clr-shadow-level2); Ya viene de .button:hover */
  }

  .form-actions .btn-submit { background-color: var(--clr-primary); color: var(--clr-on-primary); }
  .form-actions .btn-submit:hover { background-color: var(--clr-primary-hover); }
  
  .form-actions .btn-cancel, .back-button { background-color: transparent; color: var(--clr-primary); border: 1px solid var(--clr-outline); box-shadow: none; }
  .form-actions .btn-cancel:hover, .back-button:hover { background-color: rgba(var(--clr-primary-rgb), 0.08); }
  
  .attendance-actions button:not(.active) { border-radius: var(--radius-full); padding: 0 16px; height: 36px; box-shadow: none; border: none; }
  .btn-presente:not(.active) { background-color: var(--clr-presente-bg); color: var(--clr-presente-text); } .btn-presente:not(.active):hover { background-color: rgba(var(--clr-presente-rgb), 0.12); }
  .btn-tarde:not(.active) { background-color: var(--clr-tarde-bg); color: var(--clr-tarde-text); } .btn-tarde:not(.active):hover { background-color: rgba(var(--clr-tarde-rgb), 0.12); }
  .btn-ausente:not(.active) { background-color: var(--clr-ausente-bg); color: var(--clr-ausente-text); } .btn-ausente:not(.active):hover { background-color: rgba(var(--clr-ausente-rgb), 0.12); }
  .btn-permiso:not(.active) { background-color: var(--clr-permiso-bg); color: var(--clr-permiso-text); } .btn-permiso:not(.active):hover { background-color: rgba(var(--clr-permiso-rgb), 0.12); }
  
  .attendance-actions button.active { border-radius: var(--radius-full); padding: 0 16px; height: 36px; box-shadow: var(--clr-shadow-level1); border: none; }
  .btn-presente.active, .btn-presente.active:hover { background-color: var(--clr-presente-active-bg); color: var(--clr-presente-active-text); }
  .btn-tarde.active, .btn-tarde.active:hover { background-color: var(--clr-tarde-active-bg); color: var(--clr-tarde-active-text); }
  .btn-ausente.active, .btn-ausente.active:hover { background-color: var(--clr-ausente-active-bg); color: var(--clr-ausente-active-text); }
  .btn-permiso.active, .btn-permiso.active:hover { background-color: var(--clr-permiso-active-bg); color: var(--clr-permiso-active-text); }
  
  .button-toggle-status, .button-icon { background-color: transparent; border: 1px solid var(--clr-outline-variant); color: var(--clr-on-surface-variant); border-radius: var(--radius-full); padding: 8px; width: 40px; height: 40px; line-height: 0; box-shadow: none; }
  .button-toggle-status .material-symbols-outlined, .button-icon .material-symbols-outlined { font-size: 1.25rem; display: block; }
  .button-toggle-status:hover { background-color: var(--clr-toggle-hover-bg); color: var(--clr-toggle-hover-text); border-color: transparent; }
  .btn-edit:hover { background-color: var(--clr-edit-hover-bg); color: var(--clr-edit-text); border-color: transparent; }
  .btn-delete:hover { background-color: var(--clr-delete-hover-bg); color: var(--clr-delete-text); border-color: transparent; }
  .btn-edit { color: var(--clr-edit-text); border-color: var(--clr-edit-border); }
  .btn-delete { color: var(--clr-delete-text); border-color: var(--clr-delete-border); }
  
  button:disabled, button:disabled:hover, .button:disabled, .button:disabled:hover,
  .attendance-actions button:disabled, .attendance-actions button:disabled:hover {
      background-color: var(--clr-surface-container) !important; border: 1px solid var(--clr-outline-variant) !important;
      color: var(--clr-text-disabled) !important; cursor: not-allowed; opacity: 0.5; box-shadow: none !important;
  }
  
  /* ==============================
     5. Formularios y Controles (Inputs, Selects)
     ============================== */
  .filter-controls, .search-controls { margin-bottom: 20px; padding: 16px; background-color: var(--clr-surface-container-low); border-radius: var(--radius-m); display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
  .filter-controls label, .search-controls label, .form-group label { display: block; margin-bottom: 4px; margin-right: 0; font-weight: 500; color: var(--clr-on-surface-variant); flex-shrink: 0; font-size: 0.75rem; letter-spacing: 0.5px; }
  
  .filter-controls select, 
  .search-controls input[type="text"],
  .form-group input[type="text"], 
  .form-group input[type="number"],
  .form-group input[type="password"],
  .export-form select, 
  .export-form input[type="number"], 
  .export-form input[type="date"] {
      background-color: var(--clr-surface-container-high); color: var(--clr-on-surface);
      border: none; border-bottom: 1px solid var(--clr-on-surface-variant);
      border-radius: var(--radius-xs) var(--radius-xs) 0 0; padding: 16px 12px 8px 12px;
      font-size: 1rem; width: auto; transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
      min-width: 180px; flex-grow: 1; max-width: 350px;
      line-height: 1.25rem; height: 56px;
  }

  .filter-controls select:hover, 
  .search-controls input[type="text"]:hover, 
  .form-group input:hover, 
  .export-form select:hover, 
  .export-form input[type="number"]:hover, 
  .export-form input[type="date"]:hover,
  .form-group select:hover { /* Añadido para select en form-group */
      background-color: var(--clr-surface-container-high); 
      border-bottom-color: var(--clr-on-surface);
  }

  .filter-controls select:focus, 
  .search-controls input[type="text"]:focus, 
  .form-group input:focus, 
  .export-form select:focus, 
  .export-form input[type="number"]:focus, 
  .export-form input[type="date"]:focus,
  .form-group select:focus { /* Añadido para select en form-group */
      outline: none; background-color: var(--clr-surface-container-high);
      border-bottom: 2px solid var(--clr-primary); padding-bottom: 7px; 
  }
  
  .form-group input[type="text"], 
  .form-group input[type="number"],
  .form-group input[type="password"] { 
      min-width: auto; flex-grow: initial; max-width: none; width: 100%; 
  }

  .form-group select {
      background-color: var(--clr-surface-container-high); color: var(--clr-on-surface);
      border: none; border-bottom: 1px solid var(--clr-on-surface-variant);
      border-radius: var(--radius-xs) var(--radius-xs) 0 0; padding: 16px 12px 8px 12px; 
      font-size: 1rem; transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
      line-height: 1.25rem; height: 56px; width: 100%; min-width: auto; 
      -webkit-appearance: none; -moz-appearance: none; appearance: none;         
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2349454E' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; 
  }
  
  .search-controls input[type="text"]::placeholder, 
  .form-group input::placeholder { color: var(--clr-on-surface-variant); opacity: 1; font-style: normal; }
  
  .form-container { max-width: 600px; margin: 30px auto; padding: 24px; background-color: var(--clr-surface-container); border-radius: var(--radius-l); box-shadow: var(--clr-shadow-level1); border: 1px solid var(--clr-outline-variant); }
  .form-container h2 { text-align: center; margin-bottom: 24px; color: var(--clr-on-surface); font-weight: 400; font-size: 1.75rem; }
  .form-group { margin-bottom: 16px; }
  .form-group input[type=number]::-webkit-inner-spin-button, .form-group input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  .form-group input[type=number] { -moz-appearance: textfield; appearance: textfield; }
  .form-actions { display: flex; justify-content: flex-end; align-items: center; margin-top: 32px; gap: 8px; }
  
  .export-options-container { background-color: var(--clr-surface-container-low); padding: 20px; border-radius: var(--radius-m); margin-bottom: 24px; border: 1px solid var(--clr-outline-variant); }
  .export-options-container.visible { display: block; }
  .export-options-container h3 { margin-top: 0; margin-bottom: 20px; color: var(--clr-primary); font-size: 1.3em; display: flex; align-items: center; gap: 8px; }
  .export-options-container h3 .material-symbols-outlined { font-size: 1.5em; vertical-align: middle; }
  .export-form { display: flex; flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 20px; }
  .export-form:last-of-type { margin-bottom: 0; }
  .export-inputs-row { display: flex; gap: 16px; align-items: flex-end; }
  .export-form .form-group { margin-bottom: 0; flex-grow: 1; }
  .export-form label { font-size: 0.875rem; margin-bottom: 4px; display: block; color: var(--clr-on-surface-variant); }
  .export-form select, .export-form input[type="number"], .export-form input[type="date"] { width: 100%; }
  .export-form button.button { align-self: flex-end; width: auto; margin-left: 0; }

  /* ==============================
     6. Mensajes y Contador (de index.php)
     ============================== */
  .message { padding: 10px 15px; margin-bottom: 16px; border-radius: var(--radius-s); text-align: center; font-size: 0.875rem; border: 1px solid transparent; }
  .message.success { background-color: var(--clr-success-bg); color: var(--clr-success-text); border-color: var(--clr-success-border); }
  .message.error { background-color: var(--clr-error-bg); color: var(--clr-error-text); border-color: var(--clr-error-border); }
  .contador-simple { text-align: center; font-size: 1em; margin-bottom: 20px; padding: 10px 15px; color: var(--clr-on-surface); border-radius: var(--radius-s); border: 1px solid var(--clr-outline-variant); }
  .contador-simple strong { color: var(--clr-primary); font-weight: 500; }
  .contador-simple span { color: var(--clr-on-surface-variant); font-size: 0.9em; }
  
  /* ==============================
     7. Tarjeta de Estudiante (index.php)
     ============================== */
  .student-card { background-color: var(--clr-surface); border: 1px solid var(--clr-outline-variant); border-radius: var(--radius-m); margin-bottom: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; box-shadow: var(--clr-shadow-level1); transition: box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease; }
  .student-card:hover { box-shadow: var(--clr-shadow-level2); background-color: var(--clr-surface-container-high); }
  .student-info { display: flex; flex-direction: column; flex-grow: 1; gap: 4px; min-width: 0; }
  .student-name { font-weight: 500; font-size: 1rem; color: var(--clr-on-surface); }
  .student-doc { font-size: 0.875rem; color: var(--clr-on-surface-variant); }
  .status-indicator { font-size: 0.75rem; margin-top: 4px; padding: 4px 8px; border-radius: var(--radius-s); display: inline-block; font-weight: 500; border: 1px solid transparent; line-height: 1.2; }
  .status-indicator.presente { background-color: var(--clr-presente-active-bg); border-color: var(--clr-presente-active-border); color: var(--clr-presente-active-text); }
  .status-indicator.tarde { background-color: var(--clr-tarde-active-bg); border-color: var(--clr-tarde-active-border); color: var(--clr-tarde-active-text); }
  .status-indicator.ausente { background-color: var(--clr-ausente-active-bg); border-color: var(--clr-ausente-active-border); color: var(--clr-ausente-active-text); }
  .status-indicator.permiso { background-color: var(--clr-permiso-active-bg); border-color: var(--clr-permiso-active-border); color: var(--clr-permiso-active-text); }
  .status-indicator.sin-marcar { background-color: var(--clr-sin-marcar-bg); border-color: var(--clr-sin-marcar-border); color: var(--clr-sin-marcar-text); }
  .status-indicator.retirado-indicator { background-color: var(--clr-retirado-indicator-bg); color: var(--clr-retirado-indicator-text); border: 1px solid var(--clr-retirado-indicator-border); font-weight: 500; }
  
  /* ==============================
     8. Botones de Acciones del Estudiante (index.php)
     ============================== */
  .attendance-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; flex-shrink: 0; }
  .attendance-actions form { margin: 0; display: inline-block; vertical-align: middle; }
  
  /* ==============================
     9. Estilos para Estudiantes Retirados
     ============================== */
  .student-card.student-card-retired { background-color: var(--clr-surface-container-low); opacity: 0.6; border-left: 4px solid var(--clr-outline-variant); box-shadow: none; }
  .student-card.student-card-retired:hover { opacity: 0.8; background-color: var(--clr-surface-container); }
  
  /* ==============================
     10. Tabla de Resumen (resumen.php)
     ============================== */
  .summary-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 20px; border: 1px solid var(--clr-outline-variant); border-radius: var(--radius-s); overflow: hidden; }
  .summary-table th, .summary-table td { border: none; border-bottom: 1px solid var(--clr-outline-variant); padding: 12px 16px; text-align: left; vertical-align: middle; background-color: var(--clr-surface); color: var(--clr-on-surface); }
  .summary-table th { background-color: var(--clr-surface-container-low); color: var(--clr-on-surface-variant); font-weight: 500; font-size: 0.875rem; border-bottom-width: 1px; border-bottom-color: var(--clr-outline); }
  .summary-table tbody tr:last-child td { border-bottom: none; }
  .summary-table tbody tr.student-row-filterable:hover td { background-color: var(--clr-surface-container-high); }
  .summary-table td.count-warning { font-weight: 500; color: var(--clr-error-text); }
  
  /* ==============================
     11. Modal (Pop-Up de Detalles en resumen.php)
     ============================== */
  .modal-overlay { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: var(--clr-scrim); align-items: center; justify-content: center; } 
  .modal-content { background-color: var(--clr-surface-bright); margin: auto; padding: 24px; border: 1px solid var(--clr-outline-variant); width: 90%; max-width: 600px; border-radius: var(--radius-xl); box-shadow: var(--clr-shadow-level3); position: relative; animation: fadeInModal 0.3s ease-out; } @keyframes fadeInModal { from {opacity: 0; transform: translateY(-20px) scale(0.98);} to {opacity: 1; transform: translateY(0) scale(1);} } 
  .modal-close-btn { color: var(--clr-on-surface-variant); position: absolute; top: 16px; right: 16px; font-size: 1.5rem; background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--radius-full); line-height: 0; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; } 
  .modal-close-btn:hover { background-color: rgba(var(--clr-on-surface-rgb, 29 27 32), 0.08); } 
  .modal-content h3 { margin-top: 0; margin-bottom: 16px; color: var(--clr-on-surface); text-align: center; font-weight: 400; font-size: 1.5rem; line-height: 2rem; } 
  .modal-details { max-height: 60vh; overflow-y: auto; border-top: 1px solid var(--clr-outline-variant); margin-top: 16px; padding-top: 16px; } 
  .modal-details-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; } 
  .modal-details-table th, .modal-details-table td { border-bottom: 1px solid var(--clr-outline-variant); padding: 10px 8px; text-align: left; vertical-align: middle; } 
  .modal-details-table th { font-weight: 500; background-color: var(--clr-surface-container-low); white-space: nowrap; color: var(--clr-on-surface-variant); } 
  .modal-details-table tr:last-child td { border-bottom: none; } 
  .modal-details-table td.estado-tarde  { color: var(--clr-tarde-text); font-weight: 500; }
  .modal-details-table td.estado-ausente { color: var(--clr-error-text); font-weight: 500; } 
  .modal-details-table td.estado-permiso { color: var(--clr-permiso-text); font-weight: 500; } 
  .modal-details-table td.estado-presente { color: var(--clr-success-text); font-weight: 900; }
  
  /* ==============================
     12. Loader (Círculo de Carga)
     ============================== */
  .loader { border: 4px solid var(--clr-surface-container-high); border-radius: 50%; border-top-color: var(--clr-primary); width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; display: block; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
  
  /* ==============================
     13. Utilidades (Clases de Ayuda)
     ============================== */
  .hidden { display: none; } 
  
  /* ==========================================================================
     14. Tema Oscuro (Dark Mode) 
     ========================================================================== */
  @media (prefers-color-scheme: dark) {
      :root {
          --clr-primary: #d0bcff; --clr-on-primary: #381e72; --clr-primary-container: #4f378a; --clr-on-primary-container: #eaddff; --clr-primary-hover: #d8c5ff; --clr-primary-rgb-dark: 208, 188, 255;
          --clr-background: #141218; --clr-surface: #141218; --clr-surface-container: #211f26; --clr-surface-container-low: #1d1b20; --clr-surface-container-high: #2b2930; --clr-surface-bright: #3b383e; --clr-on-surface: #e6e0e9; --clr-on-surface-variant: #cac4cf; --clr-on-surface-rgb: 230, 224, 233;
          --clr-outline: #938f99; --clr-outline-variant: #49454e;
          --clr-danger: #f2b8b5; --clr-on-danger: #601410; --clr-danger-container: #8c1d18; --clr-on-danger-container: #f9dedc; --clr-danger-hover: #f5c6c3; --clr-danger-rgb: 242, 184, 181;
         
          --clr-sin-marcar-bg: #424242;
          --clr-sin-marcar-text: #e0e0e0;
          --clr-sin-marcar-border: #616161;
      }
      img { filter: brightness(.85) contrast(1); }
  
      .contador-simple,
      .contador-simple strong { color: #d0bcff !important; }
      .contador-simple span { color: #646464 !important; }
      
      .modal-details-table td.estado-presente { font-weight: 500 !important; }
      .modal-details-table td.estado-tarde { font-weight: 500 !important; }
      .modal-details-table td.estado-ausente { font-weight: 500 !important; }
      .modal-details-table td.estado-permiso { font-weight: 500 !important; }
      .modal-details-table td.estado-sin-marcar { font-weight: 500 !important; }
        
      .form-actions .btn-cancel, .back-button { color: var(--clr-primary); border-color: var(--clr-outline); } 
      .form-actions .btn-cancel:hover, .back-button:hover { background-color: rgba(var(--clr-primary-rgb-dark), 0.08); } 
      .modal-close-btn:hover { background-color: rgba(var(--clr-on-surface-rgb), 0.08); } 
      .button-toggle-status:hover { background-color: var(--clr-toggle-hover-bg); color: var(--clr-toggle-hover-text); border-color: transparent; } 
      .btn-edit:hover { background-color: var(--clr-edit-hover-bg); color: var(--clr-primary); border-color: transparent; } 
      .btn-delete:hover { background-color: var(--clr-delete-hover-bg); color: var(--clr-danger); border-color: transparent; }
  } 
  
  /* ==========================================================================
     15. Media Queries para Responsividad (Ajustes para pantallas pequeñas)
     ========================================================================== */
  /* SECCIÓN 15.0: Reglas responsivas originales para .app-header y .app-header h1 que se SOBRESCRIBIRÁN/AJUSTARÁN más abajo */
  /* @media (max-width: 768px) {
      .app-header { flex-direction: column; align-items: flex-start; padding: 16px; gap: 12px; border-radius: 0 0 var(--radius-l) var(--radius-l); }
      .app-header h1 { font-size: 1.25rem; line-height: 1.5rem; white-space: normal; width: 100%; margin-bottom: 0; }
  }
  @media (max-width: 480px) {
      .app-header { padding: 12px; border-radius: 0 0 var(--radius-l); }
      .app-header h1 { font-size: 1.25rem; line-height: 1.5rem; }
  } */

  /* --- El resto de tus media queries para 768px y 480px (SIN CAMBIOS, excepto lo referente a .app-header y .app-header h1 que se manejan en la Sección 16) --- */
  @media (max-width: 768px) {
      .student-card { flex-direction: column; align-items: stretch; }
      .student-info { margin-right: 0; margin-bottom: 16px; }
      .attendance-actions { flex-direction: column; align-items: stretch; gap: 12px; width: 100%; margin-top: 8px; }
      .attendance-actions .attendance-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; order: 1; }
      .attendance-actions .attendance-form button { width: 100%; min-height: 40px; padding: 8px 10px; justify-content: center; }
      .admin-actions-group { display: flex; justify-content: space-between; align-items: center; gap: 6px; order: 2; width: 100%; margin-top: 8px; }
      .admin-actions-group .button-toggle-status, .admin-actions-group .button-icon { width: 44px; height: 44px; padding: 10px; }
      .admin-actions-group .button-toggle-status .material-symbols-outlined, .admin-actions-group .button-icon .material-symbols-outlined { font-size: 1.375rem; }
      
      /* Los estilos de .app-header y .app-header h1 para esta media query se manejan en la Sección 16 */
      .header-info { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; width: 100%; order: 2; background-color: transparent !important; padding: 0 !important; border-radius: 0 !important; margin: 0 !important; }
      /* .header-actions { width: 100%; justify-content: flex-start; order: 2; flex-wrap: wrap; gap: 8px; } Ya no se usa esta clase general para acciones */
      /* .header-actions .button { height: 36px; padding: 0 16px; font-size: 0.8125rem; } */
      .modal-content { width: 90%; padding: 20px 25px; } .modal-content h3 { font-size: 1.2em; } .modal-details { max-height: 70vh; }
      .filter-controls, .search-controls { flex-direction: column; align-items: stretch; }
      .filter-controls select, .search-controls input[type="text"] { min-width: auto; max-width: none; width: 100%; }
      .summary-table th, .summary-table td { padding: 8px 6px; font-size: 0.9em; white-space: normal; vertical-align: top; }
      .summary-table th { font-size: 0.85em; }
  
      .export-options-container { padding: 16px; }
      .export-options-container h3 { font-size: 1.2em; margin-bottom: 16px; }
      .export-options-container h3 .material-symbols-outlined { font-size: 1.4em; }
      .export-form { gap: 12px; margin-bottom: 16px; }
      .export-inputs-row { display: flex; flex-direction: row; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
      .export-form select, .export-form input[type="number"], .export-form input[type="date"] { width: 100%; min-width: 120px; }
      .export-form button.button { align-self: stretch; width: 100%; margin-left: 0; margin-top: 8px; }
  }
  
  @media (max-width: 480px) {
      .container { margin: 10px; padding: 16px; border-radius: var(--radius-l); }
      /* Los estilos de .app-header y .app-header h1 para esta media query se manejan en la Sección 16 */
      .header-info span:not(.material-symbols-outlined) { font-size: 0.75rem; }
      .header-info .icon-small { font-size: 1rem; }
      .header-info { gap: 6px 12px; }
      /* .header-actions .button { height: 36px; padding: 0 16px; font-size: 0.8125rem; gap: 4px; } */
      /* .header-actions .button .material-symbols-outlined { font-size: 1.125rem; } */
      .student-name { font-size: 1rem; }
      .attendance-actions .attendance-form button { padding: 8px 10px; font-size: 0.8125rem; gap: 6px; min-height: 36px; }
      .attendance-actions .attendance-form button .material-symbols-outlined { font-size: 1rem; }
      .admin-actions-group .button-toggle-status, .admin-actions-group .button-icon { height: 40px; width: 40px; padding: 8px;}
      .admin-actions-group .button-toggle-status .material-symbols-outlined, .admin-actions-group .button-icon .material-symbols-outlined { font-size: 1.25rem; }
      .summary-table th, .summary-table td { padding: 6px 4px; font-size: 0.8em; }
      .summary-table th { font-size: 0.75em; }
      .modal-content { padding: 16px; border-radius: var(--radius-xl); }
      .modal-details-table { font-size: 0.875rem; }
      .modal-details-table th, .modal-details-table td { padding: 8px 4px; }
      .modal-close-btn { width: 40px; height: 40px; top: 12px; right: 12px; font-size: 1.5rem;}
  
      .export-inputs-row { gap: 10px; }
      .export-form button.button { margin-top: 12px; }
  }

/* ==============================
   16. Menú Lateral Desplegable (Side Nav)
   ============================== */
/* La regla .app-header principal ya fue MODIFICADA más arriba (aprox línea 103) */

.menu-toggle-btn {
    background: none;
    border: none;
    color: var(--clr-on-surface);
    cursor: pointer;
    padding: 6px;
    margin-right: 12px; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: background-color 0.2s ease;
}
.menu-toggle-btn:hover {
    background-color: rgba(var(--clr-on-surface-rgb), 0.08);
}
.menu-toggle-btn .material-symbols-outlined {
    font-size: 26px;
}

.header-title-bar {
    display: flex; 
    align-items: center;
    flex-grow: 1; 
    min-width: 0; 
}

.header-title-bar > h1 {
    flex-shrink: 1; 
    flex-grow: 1;   
    margin: 0;      
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
    font-size: 1.375rem; /* Tamaño original del h1 global */
    font-weight: 400;   /* Peso original del h1 global */
    line-height: 1.75rem; /* Altura de línea original */
    color: var(--clr-on-surface);
}

.header-actions-main {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto; 
}
.button-header-main {
    padding: 0 16px;
    min-height: 38px;
    font-size: 0.85rem;
}
.button-header-main .material-symbols-outlined {
    font-size: 1.05rem;
    margin-right: 6px;
}

.side-nav {
    position: fixed;
    left: -300px; 
    top: 0;
    width: 280px; 
    height: 100%;
    background-color: var(--clr-surface-bright); 
    box-shadow: var(--clr-shadow-level3);
    padding: 0; 
    z-index: 1002; 
    transition: left 0.35s cubic-bezier(0.25, 0.1, 0.25, 1); 
    border-right: 1px solid var(--clr-outline-variant);
    display: flex;
    flex-direction: column;
}
.side-nav.active {
    left: 0;
}
.side-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--clr-outline-variant);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--clr-primary);
}
.close-nav-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--clr-on-surface-variant);
    cursor: pointer;
    display: inline-flex;
    border-radius: var(--radius-full);
}
.close-nav-btn:hover {
    background-color: rgba(var(--clr-on-surface-rgb), 0.08);
    color: var(--clr-on-surface);
}
.close-nav-btn .material-symbols-outlined {
    font-size: 24px;
}
.side-nav ul {
    list-style: none;
    padding: 16px; 
    margin: 0;
    flex-grow: 1; 
    overflow-y: auto; 
}
.side-nav ul li a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 10px; 
    text-decoration: none;
    color: var(--clr-on-surface-variant);
    border-radius: var(--radius-m); 
    margin-bottom: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 400;
    font-size: 0.9rem;
}
.side-nav ul li a:hover,
.side-nav ul li a.active-nav-link { 
    background-color: rgba(var(--clr-primary-rgb), 0.08);
    color: var(--clr-primary);
    font-weight: 500;
}
.side-nav ul li a .material-symbols-outlined {
    font-size: 1.3rem; 
    color: var(--clr-primary); 
}
.side-nav ul li a:hover .material-symbols-outlined,
.side-nav ul li a.active-nav-link .material-symbols-outlined {
    color: var(--clr-primary); 
}

.overlay-screen {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--clr-scrim); 
    z-index: 1001; 
    opacity: 0;
    transition: opacity 0.35s ease;
}
.overlay-screen.active {
    display: block;
    opacity: 1;
}

/* Media Query para el header y elementos relacionados, consolidado aquí */
@media (max-width: 768px) {
    .app-header { /* Hereda de la regla global y se ajusta aquí */
        flex-direction: column; 
        align-items: stretch; 
        padding: 12px 16px; 
        gap: 10px; 
        /* border-radius: 0 0 var(--radius-l) var(--radius-l); Ya lo tenías */
    }

    .header-title-bar { 
        width: 100%; 
        /* No necesita padding-bottom si .app-header tiene gap */
    }
    
    .app-header .header-title-bar > h1 {
        font-size: 1.1rem; 
        line-height: 1.3rem;
        white-space: normal; 
        padding-left: 8px; 
        /* flex-grow y margin:0 ya están globales */
    }

    .header-info { /* Se mantiene como lo tenías para esta media query */
        /* width: 100%;  (ya debería ser por align-items:stretch en .app-header) */
        order: 2; 
        /* justify-content: flex-start; (no es necesario si es width 100%) */
        /* gap: 6px 10px; (el gap de .header-info global aplica) */
        /* background-color: transparent !important; padding: 0 !important; border-radius: 0 !important; margin: 0 !important; */ /* Mantenido de tu original */
    }

    .header-actions-main {
        width: 100%; /* Ocupar todo el ancho */
        justify-content: space-around; /* Distribuir botones si son varios */
        order: 1; 
    }
    .header-actions-main .button-header-main {
        flex-grow: 1; /* Que los botones se expandan para ocupar espacio */
        justify-content: center; 
        padding: 0 10px; 
        font-size: 0.8rem;
        min-height: 38px;
        /* height: 36px; font-size: 0.8125rem; (de tu original para .header-actions .button) */
    }
}

@media (max-width: 480px) {
    .side-nav {
        width: 250px; 
        left: -270px;
    }
     .app-header .header-title-bar > h1 {
        font-size: 1rem;
        padding-left: 4px;
        /* line-height: 1.5rem; (ya lo tenías) */
    }
    .header-actions-main .button-header-main {
        font-size: 0.75rem; 
        gap: 4px; /* (de tu original para .header-actions .button) */
    }
    .header-actions-main .button-header-main .material-symbols-outlined {
        margin-right: 4px;
        font-size: 1.1rem; /* (de tu original para .header-actions .button .material-symbols-outlined) */
    }
    /* Estilos para .app-header y .header-info en 480px se heredan o ajustan de 768px y los globales */
     .app-header { padding: 12px; /* (ya lo tenías) */ }
     /* .header-info span:not(.material-symbols-outlined) { font-size: 0.75rem; } (ya lo tenías) */
     /* .header-info .icon-small { font-size: 1rem; } (ya lo tenías) */
     /* .header-info { gap: 6px 12px; } (ya lo tenías) */
}
/* Estilos para el header minimal de seleccionar_salon.php */
.app-header-minimal {
    width: 100%;
    background-color: var(--clr-surface);
    color: var(--clr-on-surface);
    padding: 10px 20px; /* Padding original que tenías */
    border-bottom: 1px solid var(--clr-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Título a la izquierda, info y botón a la derecha */
}

.app-header-minimal h1 {
    font-size: 1.25rem; /* Tamaño de título para esta cabecera */
    margin: 0;
    font-weight: 400;
    color: var(--clr-on-surface);
}

.user-info-minimal {
    display: flex;
    align-items: center;
    gap: 16px; /* Espacio entre el nombre de usuario y el botón de salir */
}

.user-info-minimal span {
     color: var(--clr-on-surface-variant);
     font-size: 0.9rem; /* Tamaño de texto para info de usuario */
     display: inline-flex; /* Para alinear icono y texto */
     align-items: center;
}

/* Nueva clase para botones pequeños en headers como el de seleccionar_salon.php */
.button.button-small-header {
    padding: 6px 12px; /* Padding más pequeño */
    font-size: 0.8rem;   /* Texto más pequeño */
    min-height: 32px;    /* Altura mínima más pequeña */
    gap: 6px;            /* Menos espacio entre icono y texto */
}

.button.button-small-header .material-symbols-outlined {
    font-size: 1rem; /* Icono más pequeño, acorde al texto */
    /* margin-right: 4px; No es necesario si se usa gap en el botón */
}

/* Asegurar que el btn-logout con button-small-header mantenga los colores de peligro */
.button.btn-logout.button-small-header {
    /* Los colores de fondo y texto se heredan de .btn-logout */
    /* No es necesario redefinirlos a menos que quieras una variación específica */
}
.button.btn-logout.button-small-header:hover {
    /* Los colores de fondo y texto en hover se heredan de .btn-logout:hover */
}

/* ==============================
   18. Pie de Página (Footer)
   ============================== */
   .app-footer {
    text-align: center;
    padding: 25px 15px; /* Más padding vertical */
    border-radius: 16px; /* Bordes redondeados */
    margin-top: 50px;    /* Más espacio arriba del footer */
    border-top: 1px solid var(--clr-outline-variant);
    font-size: 0.85rem; /* Un poco más legible */
    color: var(--clr-on-surface-variant);
    background-color: rgba(255, 255, 255, 0.493); 
  
    line-height: 1.6; /* Espacio entre líneas si el texto se envuelve */












}

.app-footer p {
    margin: 0;
}

.app-footer a {
    color: var(--clr-primary); /* Color primario para el enlace */
    text-decoration: none;
    font-weight: 500; /* Ligeramente más destacado */
}

.app-footer a:hover {
    text-decoration: underline;
    color: var(--clr-primary-hover); /* Color primario hover */
}

/* Ajustes para Modo Oscuro (si tus variables están bien definidas, esto podría no ser necesario,
   pero es bueno tenerlo por si --clr-surface-container-low es demasiado claro en modo oscuro) */
@media (prefers-color-scheme: dark) {
    .app-footer {
        background-color: var(--clr-surface-container); /* Un fondo un poco menos claro en modo oscuro */
        border-top-color: var(--clr-outline);
    }
    .app-footer a {
        color: var(--clr-primary); /* Usar la variable primaria del tema oscuro */
    }
    .app-footer a:hover {
        color: var(--clr-primary-hover); /* Usar la variable primaria hover del tema oscuro */
    }
}