/* SISTEMA DE DISEÑO DE BALLICHER - ESTILOS DE INTERFAZ */

/* ==========================================================================
   1. Variables de Tema y Fuentes
   ========================================================================== */
:root {
    /* Tema Claro (Default) */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: rgba(226, 232, 240, 0.8);
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    
    /* Colores Funcionales */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* Gradientes */
    --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --grad-purple: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --grad-orange: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
    
    /* Configuración Visual */
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --glass-blur: blur(12px);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Variables para Modo Oscuro */
[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-secondary: #131a26;
    --card-bg: rgba(19, 26, 38, 0.6);
    --card-border: rgba(255, 255, 255, 0.03);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.06);
    --accent-glow: rgba(59, 130, 246, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Reset y Estilos Globales */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================================================
   2. Estructura y Contenedor Principal (Layout)
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--grad-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-menu {
    flex-grow: 1;
}

.menu-item {
    margin-bottom: 8px;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.menu-item a i {
    font-size: 18px;
}

.menu-item:hover a,
.menu-item.active a {
    color: var(--accent-color);
    background-color: var(--accent-glow);
}

.menu-item.active a {
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

/* Contenido Principal */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    transition: var(--transition);
}

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

.header-title h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-title p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.content-body {
    flex-grow: 1;
    position: relative;
}

/* ==========================================================================
   3. Componentes Genéricos y Comunes
   ========================================================================== */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-primary);
    border-color: var(--text-muted);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   4. Estilos de la Sección de Dashboard
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
}

.bg-gradient-blue { background: var(--grad-blue); }
.bg-gradient-purple { background: var(--grad-purple); }
.bg-gradient-orange { background: var(--grad-orange); }
.bg-gradient-green { background: var(--grad-green); }

.metric-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
    display: block;
}

.dashboard-details {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
}

.dashboard-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-header i {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Lista de Progreso de Cursos */
.course-progress-item {
    margin-bottom: 18px;
}

.course-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.course-progress-name {
    font-weight: 600;
}

.course-progress-hours {
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* Lista de Conflictos */
.conflicts-list-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.conflict-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background-color: rgba(239, 68, 68, 0.05);
    border-left: 4px solid var(--danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
}

.conflict-item-warning {
    background-color: rgba(245, 158, 11, 0.05);
    border-left-color: var(--warning);
}

.conflict-item i {
    font-size: 16px;
    margin-top: 2px;
}

.conflict-item.conflict-item-warning i {
    color: var(--warning);
}

.conflict-item-info strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.conflict-item-info span {
    color: var(--text-secondary);
}

.no-conflicts-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.no-conflicts-msg i {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--success);
}

/* ==========================================================================
   5. Estilos de la Sección del Planificador
   ========================================================================== */
.planner-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

.planner-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.planner-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.planner-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.hours-badge {
    background-color: var(--accent-glow);
    color: var(--accent-color);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.4;
}

/* Lista de asignaturas en el panel de carga */
.subjects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subject-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.subject-item:hover {
    transform: translateX(4px);
    border-color: var(--accent-color);
}

.subject-item.selected {
    background-color: var(--accent-glow);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.subject-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.subject-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.subject-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subject-item-progress {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.subject-item-progress-bar {
    height: 4px;
    background-color: rgba(0,0,0,0.05);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.subject-item-progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    width: 0;
    transition: width 0.3s ease;
}

.subject-item-progress-fill.overlimit {
    background-color: var(--danger);
}

.subject-item-progress-fill.complete {
    background-color: var(--success);
}

/* Área Principal del Planificador */
.planner-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Permite al contenedor de grid encogerse y activar el scroll horizontal */
}

.planner-toolbar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 16px;
}

.selected-assignment-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.preview-tag-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
}

.preview-tag-wrapper .teacher-name {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 12px;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

/* Contenedor de la Rejilla */
.schedule-grid-container {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    color: #111827; /* Forzar color oscuro en rejilla para legibilidad e impresión */
    overflow-x: auto; /* Permite scroll horizontal si no cabe el horario */
}

/* Encabezado para impresión (oculto en la pantalla normal) */
.print-header {
    display: none;
    text-align: center;
    margin-bottom: 24px;
    border-bottom: 2px solid #111827;
    padding-bottom: 12px;
}

.print-header h2 {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

.print-header p {
    font-size: 14px;
    color: #4b5563;
}

/* La Rejilla CSS Grid */
.schedule-grid {
    display: grid;
    grid-template-columns: 120px repeat(5, minmax(0, 1fr));
    grid-auto-rows: minmax(75px, auto);
    border: 1px solid #9ca3af;
    background-color: #e5e7eb;
    gap: 1px;
    min-width: 900px; /* Asegura que entre el Viernes y no se encojan las celdas en pantallas angostas */
}

.grid-header {
    background-color: #1f2937;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
}

/* Celdas del Horario */
.grid-time-cell {
    background-color: #f3f4f6;
    font-weight: 700;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-align: center;
    gap: 4px;
    border-right: 2px solid #d1d5db;
}

.grid-time-number {
    font-size: 14px;
    color: #1f2937;
}

.grid-time-hours {
    font-weight: 500;
    color: #6b7280;
}

.grid-cell {
    background-color: #ffffff;
    cursor: pointer;
    position: relative;
    padding: 10px;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.grid-cell:hover {
    background-color: #f9fafb;
    box-shadow: inset 0 0 0 2px var(--accent-color);
}

.grid-cell.assigned {
    background-color: rgba(var(--teacher-color-rgb, 59, 130, 246), 0.12);
    border-left: 4px solid rgb(var(--teacher-color-rgb, 59, 130, 246));
}

.grid-cell-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
}

.grid-subject-title {
    font-size: 13px; /* Aumentado para mejor legibilidad */
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Aumentado a 4 para evitar cortar materias de nombres largos */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-teacher-name {
    font-size: 12px; /* Aumentado para mejor legibilidad */
    color: #475569;
    font-weight: 500;
    margin-top: auto;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.grid-cell-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.grid-cell:hover .grid-cell-actions {
    opacity: 1;
}

.grid-cell-actions button {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   6. Estilos de la Sección de Profesores y Tablas
   ========================================================================== */
.teachers-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 32px;
    align-items: start;
}

.teacher-form-card {
    position: sticky;
    top: 24px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
}

.color-picker::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.color-value-text {
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.teachers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.teachers-table th,
.teachers-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
}

.teachers-table th {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.teacher-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.teacher-name-cell {
    font-weight: 600;
}

.teacher-load-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
}

.teacher-load-badge.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.teacher-load-badge.overlimit {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.table-action-btn:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.table-action-btn.edit:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.table-action-btn.delete:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ==========================================================================
   7. Horarios Docentes y Ajustes
   ========================================================================== */
.consolidated-toolbar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group-inline label {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.teacher-schedule-container {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-lg);
    padding: 32px;
    color: #111827;
    overflow-x: auto; /* Permite scroll horizontal si es necesario */
}

.settings-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.settings-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.settings-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.settings-actions {
    display: flex;
    gap: 16px;
    margin-top: auto;
    flex-wrap: wrap;
}

.file-upload-wrapper {
    position: relative;
}

/* ==========================================================================
   8. Diálogos Modales
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--accent-color);
    font-weight: 700;
    margin-bottom: 20px;
    background-color: var(--accent-glow);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.conflict-warning-box {
    margin-top: 18px;
    padding: 12px;
    background-color: rgba(239, 68, 68, 0.08);
    border-left: 4px solid var(--danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
}

.conflict-warning-box i {
    font-size: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   9. Media Queries y Soporte Responsivo
   ========================================================================== */
@media (max-width: 1450px) {
    .planner-layout,
    .teachers-layout,
    .settings-layout {
        grid-template-columns: 1fr;
    }
    
    .teacher-form-card {
        position: relative;
        top: 0;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }
    
    .sidebar-brand .brand-text,
    .menu-item span,
    .sidebar-footer p,
    .theme-toggle span {
        display: none;
    }
    
    .sidebar-brand {
        justify-content: center;
        margin-bottom: 30px;
    }
    
    .menu-item a {
        justify-content: center;
        padding: 12px;
    }
    
    .theme-toggle {
        justify-content: center;
        padding: 12px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .dashboard-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions button {
        width: 100%;
    }
    
    .planner-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .toolbar-right {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    
    .schedule-grid-container {
        padding: 12px;
        overflow-x: auto;
    }
    
    .schedule-grid {
        min-width: 700px;
    }
}

/* ==========================================================================
   10. Estilos de Impresión (@media print)
   ========================================================================== */
@media print {
    body {
        background-color: #ffffff;
        color: #000000;
        font-size: 12pt;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    .app-container {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }
    
    .sidebar,
    .main-header,
    .planner-sidebar,
    .planner-toolbar,
    .consolidated-toolbar,
    .modal-overlay,
    .btn,
    .grid-cell-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    .content-body {
        padding: 0 !important;
    }
    
    .tab-pane {
        display: none !important;
    }
    
    /* Mostrar solo la sección activa de horarios */
    .tab-pane.active {
        display: block !important;
    }
    
    .schedule-grid-container,
    .teacher-schedule-container {
        border: none !important;
        padding: 0 !important;
        background-color: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    .print-header {
        display: block !important;
    }
    
    .schedule-grid {
        grid-template-columns: 90px repeat(5, minmax(0, 1fr)) !important;
        grid-auto-rows: 60px !important;
        border: 2px solid #000000 !important;
        background-color: #000000 !important;
        width: 100% !important;
        min-width: 0 !important; /* Desactivar ancho mínimo al imprimir */
        page-break-inside: avoid;
    }
    
    .grid-header {
        background-color: #e5e7eb !important;
        color: #000000 !important;
        border: 1px solid #000000 !important;
        font-size: 10pt !important;
    }
    
    .grid-time-cell {
        background-color: #f3f4f6 !important;
        color: #000000 !important;
        border: 1px solid #000000 !important;
        font-size: 9pt !important;
    }
    
    .grid-time-number {
        color: #000000 !important;
    }
    
    .grid-cell {
        background-color: #ffffff !important;
        border: 1px solid #000000 !important;
        color: #000000 !important;
        min-height: auto !important;
        height: auto !important;
        padding: 8px !important;
    }
    
    /* Mostrar sin colores, todo en blanco y negro al imprimir */
    .grid-cell.assigned {
        background-color: #ffffff !important;
        border-left: 1px solid #000000 !important;
    }
    
    .grid-cell[style*="background-color"] {
        background-color: #ffffff !important;
    }

    .grid-subject-title {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: #000000 !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
        white-space: normal !important;
    }
    
    .grid-teacher-name, span[style*="color"] {
        font-size: 12pt !important;
        color: #000000 !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
        white-space: normal !important;
    }
}
