/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
}
.error-message { color: #ff4d4d; font-size: 0.9em; margin-top: 15px; height: 1em; }

/* Estilo del Contenedor de Login */
.login-container {
    width: 100%;
    max-width: 400px;
    margin: 10vh auto;
    padding: 40px;
    background-color: #002b49; /* Azul oscuro UNEMI */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    color: #fff;
}
.login-logo { max-width: 200px; margin-bottom: 20px; }
.login-container h2 { margin-bottom: 25px; }
.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 5px; font-size: 0.9em; }
.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #00568c;
    border-radius: 4px;
    background-color: #003f6a;
    color: #fff;
    box-sizing: border-box;
}
.login-container button {
    width: 100%;
    padding: 12px;
    background-color: #ffc107; /* Amarillo/Dorado */
    border: none;
    border-radius: 4px;
    color: #002b49;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
.login-container button:hover { background-color: #e0a800; }

/* Estilos del Dashboard */
.dashboard-container { display: flex; height: 100vh; }
.sidebar { width: 280px; background-color: #002b49; color: #fff; display: flex; flex-direction: column; }
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid #003f6a; }
.sidebar-header img { max-width: 80%; }
#course-list { flex-grow: 1; overflow-y: auto; }
#course-list a {
    display: block; padding: 15px 20px; color: #fff; text-decoration: none;
    border-bottom: 1px solid #003f6a; transition: background-color 0.2s; cursor: pointer;
}
#course-list a:hover, #course-list a.active { background-color: #003f6a; }
.logout-button {
    padding: 15px 20px; text-align: center; background-color: #ffc107;
    color: #002b49; text-decoration: none; font-weight: bold;
}

/* --- SECCIÓN MODIFICADA --- */
.main-content {
    flex-grow: 1;
    background-color: #ffffff; /* Fondo blanco */
    color: #333333;           /* Texto oscuro */
    display: flex;
    flex-direction: column;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #002b49;
    border-bottom: 2px solid #ffc107;
    color: #ffffff; /* Texto del título blanco */
}
/* --- FIN DE LA SECCIÓN MODIFICADA --- */

.main-header h1 { margin: 0; font-size: 1.5em; }
#content-area { padding: 30px; overflow-y: auto; }

/* Estilos de la tabla de notas y acciones */
.actions-container { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; align-items: center;}
.actions-container button, .upload-btn {
    padding: 10px 15px; border: none; border-radius: 5px; background-color: #ffc107;
    color: #002b49; cursor: pointer; font-weight: bold;
}
#student_csv {
    color: #333; /* Cambiado a oscuro para que sea visible en fondo blanco */
}
.grades-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.grades-table th, .grades-table td { border: 1px solid #dee2e6; padding: 12px; text-align: left; }
.grades-table th {
    background-color: #002b49;
    color: #ffffff;
}
.grades-table input[type="number"] {
    width: 60px;
    border: 1px solid #ccc;
    color: #333;
    text-align: center;
    border-radius: 4px;
    padding: 5px;
}
.grades-table .sum, .grades-table .average { font-weight: bold; }

/* --- NUEVOS ESTILOS PARA EL DASHBOARD DE TARJETAS --- */

.dashboard-main {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #002b49;
    color: #fff;
}
.btn-primary:hover {
    background-color: #003f6a;
}
.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}
.btn-danger {
    background-color: #dc3545;
    color: #fff;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.course-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.course-card h3 {
    margin-top: 0;
    color: #002b49;
}

.course-card-body {
    flex-grow: 1;
}

.course-card-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* --- ESTILOS PARA EL MODAL --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
}
.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

/* --- ESTILOS PARA PESTAÑAS Y ASISTENCIA --- */
.back-to-courses {
    display: block;
    color: #ffc107;
    text-decoration: none;
    margin-bottom: 10px;
}
.tabs {
    background-color: #002b49;
    border-bottom: 2px solid #ffc107;
}
.tab-link {
    background-color: transparent;
    border: none;
    color: white;
    padding: 14px 16px;
    font-size: 16px;
    cursor: pointer;
}
.tab-link:hover {
    background-color: #003f6a;
}
.tab-link.active {
    background-color: #003f6a;
    border-bottom: 2px solid #ffc107;
}
.tab-content {
    display: none;
    padding-top: 20px;
}
.tab-content.active {
    display: block;
}

#attendance-table {
    width: 100%;
}
/* --- ARREGLO PARA LA BARRA LATERAL EN GESTION DE CURSO --- */
#course-list-sidebar a {
    display: block; /* <-- ESTA LÍNEA ES LA SOLUCIÓN MÁGICA */
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid #003f6a;
    transition: background-color 0.2s;
    white-space: nowrap; /* Evita que el texto largo se parta en dos líneas */
    overflow: hidden; /* Oculta el texto que no quepa */
    text-overflow: ellipsis; /* Añade "..." si el texto es muy largo */
}

#course-list-sidebar a:hover, #course-list-sidebar a.active {
    background-color: #003f6a;
}
/* --- ESTILOS PARA EL FORMULARIO DE HORARIO --- */
.schedule-day {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
}
.schedule-day > label {
    font-weight: bold;
    margin-left: 5px;
}
.time-inputs {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
/* --- ESTILOS PARA LA PÁGINA DE HORARIO SEMANAL --- */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    table-layout: fixed; /* Asegura que las columnas tengan el mismo ancho */
}

.schedule-table th, .schedule-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    height: 80px; /* Altura fija para las celdas */
}

.schedule-table th {
    background-color: #002b49;
    color: white;
}

.schedule-table td {
    vertical-align: top;
}

.class-entry {
    background-color: #e7f3ff;
    border-left: 5px solid #00568c;
    border-radius: 4px;
    padding: 5px;
    text-align: left;
    font-size: 0.9em;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.class-entry strong {
    color: #002b49;
}
.class-entry span {
    font-size: 0.9em;
    color: #555;
}
.class-entry small {
    margin-top: auto;
    color: #00568c;
    font-weight: bold;
}