/* Variables Globales */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-light: #f8f9fa;
    --content-background-light: #ffffff;
    --text-light: #343a40;
    --text-muted-light: #6c757d;
    --border-light: #dee2e6;
    --hover-light: #e9ecef;

    --background-dark: #1e1e1e;
    --content-background-dark: #2c2c2c;
    --text-dark: #f8f9fa;
    --text-muted-dark: #adb5bd;
    --border-dark: #3a3a3a;
    --hover-dark: #3a3a3a;

    --transition-speed: 0.3s;
}

/* Tema Oscuro */
body.dark-mode {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --background-light: var(--background-dark);
    --content-background-light: var(--content-background-dark);
    --text-light: var(--text-dark);
    --text-muted-light: var(--text-muted-dark);
    --border-light: var(--border-dark);
    --hover-light: var(--hover-dark);
}

/* Reset Básico y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-light);
    color: var(--text-light);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* Evita scroll horizontal */
}

.container {
    display: flex;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: #0056b3; /* Un tono más oscuro al pasar el mouse */
}

/* --- Sidebar --- */
.sidebar {
    width: 250px;
    background-color: var(--content-background-light);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto; /* Permite scroll si el contenido es largo */
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header .logo {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 5px;
    background-color: var(--primary-color); /* Placeholder color */
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
}

.sidebar nav ul li {
    margin-bottom: 15px;
    transition: background-color var(--transition-speed) ease;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 5px;
    color: var(--text-muted-light);
    font-weight: 500;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.sidebar nav ul li a i {
    margin-right: 15px;
    font-size: 1.1rem;
    width: 20px; /* Para alinear iconos */
    text-align: center;
}

.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
    background-color: var(--hover-light);
    color: var(--primary-color);
}

.theme-switcher {
    margin-top: auto; /* Empuja al final */
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-switcher span {
    font-size: 0.9rem;
    color: var(--text-muted-light);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition-speed) ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-speed) ease;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    transition: margin-left var(--transition-speed) ease;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap; /* Para que se adapte en pantallas pequeñas */
}

.header h1 {
    color: var(--primary-color);
    margin: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 5px 10px;
    background-color: var(--content-background-light);
    margin: 0 20px; /* Espacio entre el título y el perfil */
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    color: var(--text-light);
    padding: 5px;
}

.search-bar button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-profile img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid var(--primary-color);
}

.user-profile span {
    font-weight: bold;
    color: var(--text-light);
}

/* --- Secciones de Contenido --- */
.content-section {
    background-color: var(--content-background-light);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block; /* Para que el borde solo abarque el texto */
}

/* --- Dashboard / Summary Cards --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--content-background-light);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    border-left: 5px solid var(--primary-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.12);
}

.card .card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.card h3 {
    font-size: 1.1rem;
    color: var(--text-muted-light);
    margin-bottom: 10px;
}

.card p {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-light);
}

/* --- Charts --- */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.chart {
    background-color: var(--content-background-light);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 350px; /* Altura fija para los gráficos */
}

.chart h3 {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* --- Forms & Tables --- */
.form-container {
    background-color: var(--content-background-light);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.form-container h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-light);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background-color: var(--background-light);
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color var(--transition-speed) ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Radio Button Group */
.radio-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.radio-group input[type="radio"] {
    display: none; /* Ocultar el radio button nativo */
}
.radio-group label {
    display: inline-flex; /* Para que el check marque el label */
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-left: 25px; /* Espacio para el círculo customizado */
    margin-bottom: 0;
    font-weight: 400;
}
.radio-group label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    background-color: var(--background-light);
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}
.radio-group input[type="radio"]:checked + label:before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.radio-group input[type="radio"]:checked + label:after {
    content: '';
    position: absolute;
    left: 6px;
    top: calc(50% - 3px); /* Centra el punto interior */
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


.btn-submit, .btn-secondary {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    margin-right: 10px;
}

.btn-submit:hover, .btn-secondary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.btn-cancel:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.table-container {
    overflow-x: auto; /* Permite scroll horizontal en tablas si son muy anchas */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--content-background-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden; /* Asegura que las esquinas redondeadas funcionen */
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-light);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: var(--background-light); /* Sutil diferencia para filas pares */
}

tr:hover {
    background-color: var(--hover-light);
}

td .action-buttons button {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 8px;
    color: var(--text-muted-light);
    font-size: 1.1rem;
    transition: color var(--transition-speed) ease;
}

td .action-buttons button:hover {
    color: var(--primary-color);
}

td .action-buttons .edit-btn:hover { color: #28a745; }
td .action-buttons .delete-btn:hover { color: #dc3545; }

/* --- Report Options --- */
.report-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.report-card {
    background-color: var(--content-background-light);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 5px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 180px; /* Altura fija */
}

.report-card i {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.report-card h4 {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.report-card button {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color var(--transition-speed) ease;
}

.report-card button:hover {
    background-color: #0056b3;
}

/* --- Config Options --- */
.config-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.config-item {
    background-color: var(--content-background-light);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 3px solid var(--primary-color);
}

.config-item h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.config-item p {
    color: var(--text-muted-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .sidebar {
        width: 60px; /* Colapsado */
        overflow: hidden;
        padding: 10px 0;
    }
    .sidebar .sidebar-header h2 {
        display: none; /* Ocultar texto del logo */
    }
    .sidebar nav ul li a {
        justify-content: center; /* Centrar iconos */
    }
    .sidebar nav ul li a i {
        margin-right: 0;
    }
    .sidebar nav ul li a span {
        display: none; /* Ocultar texto de enlaces */
    }
    .theme-switcher {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .theme-switcher span {
        display: none; /* Ocultar texto de "Modo Oscuro" */
    }

    .main-content {
        padding: 20px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .search-bar {
        width: 100%;
        margin: 0 0 10px 0;
    }

    .summary-cards, .charts-container, .report-options, .config-options {
        grid-template-columns: 1fr; /* Columnas únicas en pantallas pequeñas */
    }

    table, th, td {
        font-size: 0.9rem;
    }
}

/* Clases para ocultar secciones */
.hidden {
    display: none !important;
}

/* Estilos específicos para el resultado de calificación */
td .resultado-aprobado {
    color: #28a745; /* Verde */
    font-weight: bold;
}
td .resultado-desaprobado {
    color: #dc3545; /* Rojo */
    font-weight: bold;
}