/* Variables de Tema */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --background-light: #f4f7f6;
    --text-light: #333;
    --card-background-light: #ffffff;
    --border-color-light: #e0e0e0;
    --sidebar-bg-light: #ffffff;
    --sidebar-text-light: #444;
    --sidebar-hover-light: #f0f0f0;

    --background-dark: #1e1e1e;
    --text-dark: #e0e0e0;
    --card-background-dark: #2c2c2c;
    --border-color-dark: #444;
    --sidebar-bg-dark: #252525;
    --sidebar-text-dark: #eee;
    --sidebar-hover-dark: #3a3a3a;

    --accent-color: #e95420;
    --success-color: #4CAF50;
    --danger-color: #f44336;
}

/* Tema Oscuro - Aplicación Global */
body.dark-theme {
    --primary-color: #90caf9; /* Azul claro */
    --secondary-color: #80cbc4; /* Verde azulado claro */
    --background-light: var(--background-dark);
    --text-light: var(--text-dark);
    --card-background-light: var(--card-background-dark);
    --border-color-light: var(--border-color-dark);
    --sidebar-bg-light: var(--sidebar-bg-dark);
    --sidebar-text-light: var(--sidebar-text-dark);
    --sidebar-hover-light: var(--sidebar-hover-dark);
}

/* Reset Básico y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-light);
    color: var(--text-light);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* Evitar scroll horizontal */
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg-light);
    color: var(--sidebar-text-light);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100vh; /* Altura completa */
    position: sticky; /* Para que permanezca fijo */
    top: 0; /* Alineado arriba */
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.sidebar-header .logo-icon {
    font-size: 2.5em;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

.sidebar-header h2 {
    font-size: 1.8em;
    font-weight: 700;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    margin-bottom: 15px;
}

.sidebar nav ul li a {
    text-decoration: none;
    color: var(--sidebar-text-light);
    display: block;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.sidebar nav ul li a i {
    margin-right: 15px;
    font-size: 1.2em;
    width: 20px; /* Para alinear iconos */
    text-align: center;
}

.sidebar nav ul li a:hover {
    background-color: var(--sidebar-hover-light);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar nav ul li.active a {
    background-color: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.sidebar-footer {
    margin-top: auto; /* Empuja al final */
    padding-top: 20px;
    border-top: 1px solid var(--border-color-light);
}

.theme-toggle-btn {
    width: 100%;
    padding: 10px 15px;
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.theme-toggle-btn i {
    margin-right: 10px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto; /* Permite scroll solo en el contenido principal */
    height: 100vh; /* Altura completa */
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color-light);
}

.main-header h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    font-weight: 500;
}

.user-profile .user-icon {
    font-size: 2em;
    margin-right: 10px;
    color: var(--primary-color);
}

/* Content Sections */
.content-section {
    margin-bottom: 40px;
    background-color: var(--card-background-light);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.content-section h2 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: var(--primary-color);
    font-weight: 700;
}

/* Overview Cards */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.overview-cards .card {
    background-color: var(--card-background-light);
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid var(--primary-color);
}

.overview-cards .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.overview-cards .card .card-icon {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.overview-cards .card h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 10px;
}

.overview-cards .card p {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.charts-container .chart {
    background-color: var(--card-background-light);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.charts-container .chart h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 20px;
    text-align: center;
}

/* Actions Container */
.actions-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Para que se ajuste en pantallas pequeñas */
    gap: 15px;
}

.actions-container .btn-add {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
}

.actions-container .btn-add i {
    margin-right: 8px;
}

.actions-container .btn-add:hover {
    background-color: #3a80c2;
    transform: translateY(-2px);
}

.actions-container input[type="text"],
.actions-container select {
    padding: 10px 15px;
    border: 1px solid var(--border-color-light);
    border-radius: 5px;
    transition: border-color 0.2s ease;
    min-width: 200px; /* Ancho mínimo para mejor visualización */
}

.actions-container input[type="text"]:focus,
.actions-container select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden; /* Para que las esquinas redondeadas funcionen con el contenido */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.2s ease;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 1.1em;
}

tbody tr:hover {
    background-color: var(--sidebar-hover-light);
}

/* Acciones en tabla */
td .actions-icons {
    display: flex;
    gap: 10px;
}

td .actions-icons .btn-edit,
td .actions-icons .btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    transition: color 0.2s ease, transform 0.1s ease;
}

td .actions-icons .btn-edit {
    color: var(--primary-color);
}

td .actions-icons .btn-delete {
    color: var(--danger-color);
}

td .actions-icons .btn-edit:hover {
    color: #3a80c2;
    transform: scale(1.1);
}

td .actions-icons .btn-delete:hover {
    color: #e53935;
    transform: scale(1.1);
}

/* Modals (Pop-ups) */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed; /* Posición fija */
    z-index: 1000; /* Encima de todo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Permite scroll si el contenido es largo */
    background-color: rgba(0, 0, 0, 0.6); /* Fondo semitransparente */
    backdrop-filter: blur(5px); /* Efecto de desenfoque */
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--card-background-light);
    margin: 10% auto; /* 10% desde arriba y centrado */
    padding: 30px;
    border-radius: 10px;
    width: 80%; /* Ancho */
    max-width: 500px; /* Máximo ancho */
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
    font-size: 1.8em;
    font-weight: 700;
}

.modal-content form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-content form input[type="text"],
.modal-content form input[type="number"],
.modal-content form input[type="date"],
.modal-content form select,
.modal-content form textarea {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color-light);
    border-radius: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-content form input:focus,
.modal-content form select:focus,
.modal-content form textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

.modal-content form textarea {
    min-height: 100px;
    resize: vertical;
}

.modal-content .btn-submit {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content .btn-submit:hover {
    background-color: #3a80c2;
    transform: translateY(-2px);
}

.modal-content .close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2em;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-content .close-button:hover {
    color: var(--danger-color);
}

/* Report Options */
.report-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.report-card {
    background-color: var(--card-background-light);
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-top: 5px solid var(--secondary-color);
}

.report-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.report-card .report-icon {
    font-size: 3em;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.report-card h3 {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 10px;
}

.report-card p {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-report {
    background-color: var(--secondary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-report:hover {
    background-color: #4ac1a2;
    transform: translateY(-2px);
}

/* Configuration Section */
.config-options {
    background-color: var(--card-background-light);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.config-options h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.config-options p {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
}

.theme-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.theme-btn {
    background-color: transparent;
    border: 2px solid var(--border-color-light);
    color: var(--text-light);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.theme-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.theme-btn i {
    margin-right: 8px;
}

.grade-config {
    margin-bottom: 15px;
}

.grade-config label {
    display: inline-block;
    margin-right: 15px;
    font-weight: 500;
}

.grade-config input[type="number"] {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid var(--border-color-light);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}

.grade-config input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 60px; /* Reduce sidebar width */
        overflow-x: hidden; /* Hide horizontal scroll */
        transition: width 0.3s ease;
    }

    .sidebar:hover { /* Expand on hover for usability */
        width: 250px;
    }

    .sidebar nav ul li a span { /* Hide text when sidebar is collapsed */
        display: none;
    }

    .sidebar nav ul li a {
        justify-content: center; /* Center icons */
        padding: 15px 10px;
    }

    .sidebar nav ul li a i {
        margin-right: 0; /* No margin for icons */
    }

    .sidebar-header h2 {
        display: none; /* Hide logo text when collapsed */
    }

    .sidebar-header .logo-icon {
        font-size: 2em; /* Adjust icon size */
    }

    .sidebar-footer {
        padding-top: 10px;
    }

    .theme-toggle-btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .main-content {
        padding: 20px;
    }

    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .overview-cards {
        grid-template-columns: 1fr; /* Stack cards vertically */
    }

    .charts-container {
        grid-template-columns: 1fr; /* Stack charts vertically */
    }

    .actions-container {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-container input[type="text"],
    .actions-container select {
        width: 100%;
        min-width: auto;
    }

    .modal-content {
        width: 90%;
        margin: 5% auto;
    }

    .report-options {
        grid-template-columns: 1fr;
    }
}

/* Estilos adicionales para elementos ocultos */
.hidden {
    display: none !important;
}