/* ==========================================
   VARIABLES
   ========================================== */
:root {
    --primary: #28a745;
    --primary-dark: #1e7e34;
    --secondary: #007bff;
    --danger: #dc3545;
    --warning: #ffc107;
    --success: #28a745;
    --light: #f8f9fa;
    --dark: #343a40;
    --muted: #6c757d;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   LAYOUT
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: var(--dark);
}

#app-container {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e9ecef;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

#main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    width: calc(100% - 250px);
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.sidebar-header h5 {
    font-size: 0.95rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    border-bottom: 1px solid #f8f9fa;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-link:hover,
.sidebar-link.active {
    background-color: var(--light);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ==========================================
   WIZARD
   ========================================== */
.wizard-container {
    max-width: 900px;
    margin: 0 auto;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wizard-header {
    text-align: center;
    margin-bottom: 30px;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* ==========================================
   NIVEL CARDS
   ========================================== */
.nivel-card {
    position: relative;
}

.nivel-checkbox {
    position: absolute;
    opacity: 0;
}

.nivel-label {
    display: block;
    padding: 30px 20px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.nivel-checkbox:checked+.nivel-label {
    border-color: var(--primary);
    background-color: rgba(40, 167, 69, 0.1);
}

.nivel-label:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nivel-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.nivel-nombre {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

/* ==========================================
   TABLA DE HORARIO
   ========================================== */
.horario-table {
    font-size: 0.9rem;
}

.horario-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
}

.horario-table td {
    vertical-align: middle;
    min-height: 80px;
    padding: 8px;
}

.materia-card {
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.materia-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.slot-vacio-placeholder {
    color: #ccc;
    font-size: 1.2rem;
    padding: 20px 0;
}

.recreo-row td {
    background-color: #f8f9fa !important;
    font-style: italic;
    color: var(--muted);
    padding: 8px;
}

/* ==========================================
   MODO EDICIÓN
   ========================================== */
.slot-materia.editable,
.slot-vacio.editable {
    cursor: pointer;
    position: relative;
}

.slot-materia.editable:hover::after,
.slot-vacio.editable:hover::after {
    content: '✏️';
    position: absolute;
    top: 5px;
    right: 5px;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   FORMS
   ========================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   LOADER
   ========================================== */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-content {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================
   TABLES
   ========================================== */
.table-hover tbody tr:hover {
    background-color: rgba(40, 167, 69, 0.05);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
        width: 100%;
    }

    .horario-table {
        font-size: 0.75rem;
    }

    .materia-card {
        padding: 8px !important;
        min-height: 50px;
    }

    .wizard-container {
        padding: 10px;
    }
}

/* ==========================================
   UTILITIES
   ========================================== */
.text-uppercase {
    text-transform: uppercase;
}

.cursor-pointer {
    cursor: pointer;
}

.no-print {
    /* Will be hidden in print.css */
}

/* ==========================================
   GRILLA DE DISPONIBILIDAD
   ========================================== */
.disponibilidad-grid {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: auto;
}

.disponibilidad-grid table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.disponibilidad-grid th,
.disponibilidad-grid td {
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.disponibilidad-grid input[type="checkbox"] {
    cursor: pointer;
    width: 20px;
    height: 20px;
    margin: 0;
}

.disponibilidad-grid input[type="checkbox"]:hover {
    transform: scale(1.1);
}

/* Tabs de disponibilidad */
.disponibilidad-tabs .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    border: 1px solid transparent;
}

.disponibilidad-tabs .nav-link:hover {
    border-color: var(--border-color);
    background-color: var(--bg-light);
}

.disponibilidad-tabs .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    .disponibilidad-grid {
        font-size: 0.75rem;
    }

    .disponibilidad-grid input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .disponibilidad-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ==========================================
   EDICIÓN MANUAL DE HORARIOS
   ========================================== */

.horario-table-editor {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.horario-table-editor thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
    border: 1px solid #dee2e6;
}

.horario-table-editor tbody td {
    border: 1px solid #dee2e6;
}

.horario-table-editor .slot-cell {
    padding: 12px 8px;
    min-height: 70px;
    vertical-align: middle;
    text-align: center;
    transition: all 0.3s ease;
}

.horario-table-editor .slot-cell.editable {
    cursor: pointer;
}

.horario-table-editor .slot-cell.editable:hover {
    background-color: #e3f2fd;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.horario-table-editor .slot-cell.empty {
    background-color: #f5f5f5;
    color: #999;
}

.horario-table-editor .slot-cell.empty:hover {
    background-color: #e8f5e9;
}

.horario-table-editor .slot-cell.occupied {
    background-color: #fff;
}

.horario-table-editor .slot-cell.conflict {
    background-color: #ffebee;
    border: 2px solid #f44336;
}

.horario-table-editor .slot-content {
    line-height: 1.4;
}

.horario-table-editor .slot-content strong {
    display: block;
    color: #1976d2;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.horario-table-editor .slot-content small {
    color: #666;
    font-size: 0.85rem;
}

.modal-horario-editor .swal2-html-container {
    max-height: 70vh;
    overflow-y: auto;
    padding: 0 1rem;
}

.modal-horario-editor .swal2-popup {
    padding: 1.5rem;
}

.horario-editor-container {
    width: 100%;
}

.horario-editor-container .table-responsive {
    max-height: 65vh;
    overflow-y: auto;
}

/* Estilos para modal ancho */
.swal-wide {
    max-width: 95% !important;
    width: 95% !important;
}



.max-h-300 {
    max-height: 300px;
}

/* ==========================================
   CONFIG: Turnos y Estructura Cards
   ========================================== */
.config-card {
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    background-color: #fff;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
}

.config-card-header {
    background-color: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.config-card-header-flex {
    background-color: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-card-body {
    padding: 1rem;
}

/* ==========================================
   LOGIN SYSTEM
   ========================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease;
}

.login-card h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   CONFIGURACIÓN - TAB TURNOS PROFESIONAL
   ========================================== */

.config-turnos-tab {
    padding-top: 0.5rem !important;
}

.config-turnos-header {
    margin-bottom: 0.75rem;
}

.config-turnos-container {
    margin-top: 0 !important;
}

.config-turnos-title {
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.config-turnos-tab .alert {
    margin-top: 0;
}

.config-turnos-tab .config-card:first-of-type {
    margin-top: 0.75rem;
}