* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

.header {
  background: white;
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

h1 {
  color: #333;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.auth-buttons {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#authorize_button {
  background: #4285f4;
  color: white;
}

#authorize_button:hover:not(:disabled) {
  background: #357ae8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(66, 133, 244, 0.3);
}

#signout_button {
  background: #ea4335;
  color: white;
}

#signout_button:hover {
  background: #d33b2c;
}

/* --- Estilos para la sección de exportación --- */
.export-section {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.export-buttons {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap; /* Para que se ajusten en móviles */
}

#export_all_button {
  background: #34a853;
  color: white;
}
#export_all_button:hover:not(:disabled) {
  background: #2c8f45;
}

#export_assignments_button {
  background: #fbbc04;
  color: #333;
}
#export_assignments_button:hover:not(:disabled) {
  background: #e6a900;
}

#export_overdue_button {
  background: #ea4335; /* Rojo, para adeudados */
  color: white;
}
#export_overdue_button:hover:not(:disabled) {
  background: #d33b2c;
}

#export_status {
  margin-top: 15px;
  font-weight: 600;
  color: #333;
  display: none;
}
/* --- FIN --- */

.course-selector {
  margin-bottom: 30px;
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

select,
input[type="text"] {
  /* Añadido input[type="text"] */
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

select:focus,
input[type="text"]:focus {
  /* Añadido input[type="text"]:focus */
  outline: none;
  border-color: #4285f4;
}

.course-info {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  display: none;
}

.course-info.active {
  display: block;
  animation: fadeIn 0.5s;
}

.course-link {
  color: #4285f4;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

.course-link:hover {
  text-decoration: underline;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
}

.students-panel,
.assignments-panel {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  max-height: 600px;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

h2 {
  color: #333;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Estilo h3 (para el nuevo modal) */
h3 {
  color: #333;
  margin-top: 0;
  margin-bottom: 20px;
  text-align: center;
}

.badge {
  background: #333;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.assignment-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.assignment-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.metric-badge {
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.metric-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.metric-compliance {
  background: #2e7d32;
}

.metric-responsibility {
  background: #1565c0;
}

.metric-non-compliance {
  background: #c62828;
}

.metric-punctuality {
  background: #ef6c00;
}

.metric-score {
  background: #6a1b9a;
}

.badge-submitted {
  background: #34a853;
}

.badge-late {
  background: #fbbc04;
  color: #333;
}

.badge-missing {
  background: #ea4335;
}

.student-list {
  list-style: none;
}

.student-item {
  padding: 15px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 10px;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.student-info-clickable {
  flex-grow: 1;
  cursor: pointer;
  padding-right: 10px;
}

.student-item:hover .student-info-clickable {
  background: #e8eaed;
}

.student-item.selected {
  background: #e0eaff;
  color: #333;
}

.export-student-btn {
  padding: 8px 12px;
  font-size: 12px;
  background: #34a853;
  color: white;
  flex-shrink: 0;
  margin-left: 10px;
  border-radius: 6px;
}
.export-student-btn:hover:not(:disabled) {
  background: #2c8f45;
}
.export-student-btn svg {
  stroke: white;
  width: 16px;
  height: 16px;
}

/* --- INICIO: Estilos para lista de alumnos (ACTUALIZADOS) --- */
.student-real-name {
  font-weight: 600;
  font-size: 1.1rem; /* Más grande */
  color: #333;
  margin-bottom: 3px;
}

.student-name {
  font-weight: 400; /* Sin negrita */
  margin-bottom: 5px;
  font-size: 0.95rem;
}

.student-email,
.student-id {
  /* Aplicar estilo a ambos */
  font-size: 14px;
  opacity: 0.8;
  word-break: break-all; /* Para IDs largos */
}

.student-id {
  display: block; /* Asegurarse que sea visible */
  margin-top: 4px;
  font-size: 0.8rem; /* Un poco más chico */
  color: #666;
}

.student-extra-data {
  font-size: 0.8rem;
  color: #555;
  margin-top: 8px;
  border-top: 1px dashed #ddd;
  padding-top: 6px;
}
.student-extra-data span {
  margin-right: 12px;
  font-weight: 500;
}
/* --- FIN: Estilos para lista de alumnos --- */

/* --- INICIO: Estilos sección "Trabajos y Entregas" (ORIGINAL) --- */
.assignment-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  border-left: 4px solid #4285f4;
  transition: all 0.3s;
}

.assignment-card:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.assignment-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  font-size: 16px;
}

.assignment-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.meta-label {
  font-weight: 600;
  color: #333;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  margin-top: 10px;
}

.status-submitted {
  background: #34a853;
  color: white;
}

.status-late {
  background: #fbbc04;
  color: #333;
}

.status-missing {
  background: #ea4335;
  color: white;
}

.status-assigned {
  background: #4285f4;
  color: white;
}
/* --- FIN: Estilos sección "Trabajos y Entregas" (ORIGINAL) --- */

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4285f4;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-message {
  background: #fce4ec;
  color: #c62828;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  display: none;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* --- ESTILOS PARA EL MODAL (Exportar Adeudados) --- */
#course-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: fadeIn 0.3s;
}

#course-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  width: 90%;
  max-width: 500px;
  padding: 25px;
  animation: fadeIn 0.3s;
}

#course-modal h3 {
  margin-top: 0;
  margin-bottom: 20px;
  text-align: center;
  color: #333;
}

.modal-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.modal-controls button {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  background: #f1f3f4;
  color: #333;
}
.modal-controls button:hover {
  background: #e8eaed;
}

#course-modal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  max-height: 40vh;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
}

#course-modal-list li {
  padding: 8px;
  border-bottom: 1px solid #eee;
}
#course-modal-list li:last-child {
  border-bottom: none;
}

#course-modal-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 16px;
  color: #333;
}

#course-modal-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 20px;
}

#modal-cancel-btn {
  background: #f1f3f4;
  color: #333;
}
#modal-cancel-btn:hover {
  background: #e8eaed;
}

#modal-export-btn {
  background: #ea4335;
  color: white;
}
#modal-export-btn:hover:not(:disabled) {
  background: #d33b2c;
}
/* --- FIN DE ESTILOS DEL MODAL --- */

/* --- INICIO: Estilos para Funcionalidades Adicionales y Modal de Alumnos --- */

/* Estilo para la nueva tarjeta */
.admin-tools {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.tool-buttons {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

#manage_students_btn {
  background: #5a67d8;
  color: white;
}
#manage_students_btn:hover:not(:disabled) {
  background: #434190;
}

/* Estilo para el botón de importar (verde) */
#import_map_btn {
  background-color: #38a853; /* Verde más brillante */
  color: white;
}
#import_map_btn:hover:not(:disabled) {
  background-color: #2f855a;
}

/* --- INICIO: Estilo para botón Importar CSV --- */
#import_csv_btn {
  background-color: #4285f4; /* Azul de Google */
  color: white;
}
#import_csv_btn:hover:not(:disabled) {
  background-color: #357ae8;
}
/* --- FIN: Estilo para botón Importar CSV --- */

/* Estilos del Modal de Alumnos */
#student_modal_overlay {
  /* ID específico para el modal de alumnos */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none; /* Oculto por defecto */
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s;
}

#student_modal {
  /* ID específico para el modal de alumnos */
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  max-height: 90vh; /* Altura máxima */
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  font-size: 20px; /* Consistencia */
}

.modal-close {
  font-size: 2.5rem;
  font-weight: 300;
  line-height: 1;
  color: #888;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 30px;
  overflow-y: auto; /* Scroll si el contenido es mucho */
}

.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #e0e0e0;
  background: #f9f9f9;
  display: flex;
  justify-content: flex-end;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}

#save_and_export_map_btn {
  background: #34a853;
  color: white;
}
#save_and_export_map_btn:hover:not(:disabled) {
  background: #2c8f45;
}

/* --- INICIO: Estilos Modal Alumnos (Nuevos campos) --- */
.student-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 30px; /* Más espacio entre columnas */
  align-items: flex-start; /* Alinear arriba */
  padding: 20px 0;
  border-bottom: 1px solid #f0f0f0;
}
.student-entry:last-child {
  border-bottom: none;
}

.student-info {
  display: flex;
  flex-direction: column;
  padding-top: 5px; /* Alinear con inputs */
}
.student-info strong {
  font-size: 1.1rem;
  color: #333;
}
.student-info small {
  font-size: 0.9rem;
  color: #777;
  word-break: break-all;
}

.student-input-group {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Dos columnas para inputs */
  gap: 15px;
}

.student-input {
  display: flex;
  flex-direction: column;
}
/* Input de Nombre Real ocupa ambas columnas */
.student-input.full-width {
  grid-column: 1 / -1;
}

.student-input label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}
.student-input input {
  width: 100%;
  padding: 10px; /* Padding más pequeño para inputs dentro del modal */
  font-size: 14px; /* Fuente más pequeña */
}
/* --- FIN: Estilos Modal Alumnos (Nuevos campos) --- */

/* --- FIN: Estilos para Funcionalidades Adicionales --- */

@media (max-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .students-panel,
  .assignments-panel {
    max-height: 400px;
  }

  .export-buttons,
  .tool-buttons {
    /* Añadido .tool-buttons */
    flex-direction: column;
  }

  .assignment-metrics {
    grid-template-columns: 1fr;
  }

  /* Ajuste modal alumnos en móvil */
  .student-entry {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .student-input-group {
    grid-template-columns: 1fr; /* Inputs en una columna */
  }
}
