/* ============================================
   GENERADOR DE HORARIOS - EL PROFE CAICEDO
   Tema claro profesional
   ============================================ */

:root {
    --h-bg: #f1f5f9;
    --h-card: #ffffff;
    --h-border: #e2e8f0;
    --h-primary: #0d9488;
    --h-primary-glow: rgba(13, 148, 136, 0.25);
    --h-accent: #d97706;
    --h-text: #1e293b;
    --h-text-dim: #64748b;
    --h-danger: #dc2626;
    --h-font: 'Montserrat', sans-serif;
    --h-radius: 10px;
    --h-v2-bg-1: #ecfeff;
    --h-v2-bg-2: #f8fafc;
    --h-v2-card-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    --h-v2-card-shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--h-font);
    background: linear-gradient(180deg, var(--h-v2-bg-1) 0%, var(--h-v2-bg-2) 22%, var(--h-bg) 100%);
    color: var(--h-text);
    min-height: 100vh;
    overflow-x: hidden;
}

.h-main-v2 { max-width: 1280px; }

.panel-v2 {
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--h-v2-card-shadow-soft);
    backdrop-filter: blur(6px);
}
.panel-v2 .step-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(13,148,136,0.08);
    border: 1px solid rgba(13,148,136,0.2);
}

/* HEADER */
.h-header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid var(--h-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.h-header-left { display: flex; align-items: center; gap: 16px; }

.h-back { display: none !important; }

.h-header h1 { font-size: 1.15rem; font-weight: 800; color: var(--h-primary); }
.h-header-actions { display: flex; gap: 10px; }

/* WIZARD NAV */
.wizard-nav {
    position: fixed;
    top: 56px; left: 0; width: 100%;
    background: #ffffff;
    border-bottom: 1px solid var(--h-border);
    display: flex;
    overflow-x: auto;
    padding: 0 16px;
    z-index: 999;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.wizard-nav::-webkit-scrollbar { display: none; }

.wizard-step {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    color: var(--h-text-dim);
    background: none; border: none;
    font-family: var(--h-font);
    font-size: 0.82rem; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.wizard-step:hover { color: var(--h-text); }
.wizard-step.active { color: var(--h-primary); border-bottom-color: var(--h-primary); }
.wizard-step.completed { color: #059669; }

.step-num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800;
    color: var(--h-text-dim);
}
.wizard-step.active .step-num,
.wizard-step.completed .step-num { background: var(--h-primary); color: white; }

/* BOTON TUTORIAL */
.btn-tutorial {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 16px; margin: 6px 8px 6px 0;
    background: #ff0050; color: #fff;
    border-radius: 20px; font-family: var(--h-font);
    font-size: 0.78rem; font-weight: 700;
    text-decoration: none; white-space: nowrap;
    transition: all 0.2s; flex-shrink: 0;
    animation: tutorial-pulse 2s ease-in-out infinite;
}
.btn-tutorial:hover { background: #d6003f; transform: scale(1.05); }
.btn-tutorial i { font-size: 1.05rem; }
@keyframes tutorial-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,0,80,0.4); }
    50% { box-shadow: 0 0 10px 3px rgba(255,0,80,0.2); }
}

/* MAIN */
.h-main {
    padding: 120px 24px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.step-panel { display: none; animation: fadeSlide 0.3s ease; }
.step-panel.active { display: block; }

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

.step-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; color: var(--h-text); }
.step-desc { color: var(--h-text-dim); margin-bottom: 20px; font-size: 0.88rem; }

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

.form-label {
    display: block; font-size: 0.8rem; font-weight: 700;
    color: var(--h-text-dim); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 11px 14px;
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 0.92rem;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}
.form-select option { background: #ffffff; color: var(--h-text); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 8px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--h-border);
    transition: all 0.2s;
    font-size: 0.9rem;
}
.form-check.checked { border-color: var(--h-primary); background: rgba(13,148,136,0.08); }
.form-check input { accent-color: var(--h-primary); }

/* TIME PICKER AM/PM */
.time-picker-wrap { position: relative; }
.time-picker-display {
    display: flex; align-items: center; padding: 10px 14px;
    background: #ffffff; border: 2px solid var(--h-border);
    border-radius: var(--h-radius); font-size: 1rem; font-weight: 600;
    cursor: pointer; min-height: 44px; transition: border-color 0.2s;
}
.time-picker-display:hover { border-color: var(--h-primary); }
.time-picker-display:focus { outline: none; border-color: var(--h-primary); box-shadow: 0 0 0 3px var(--h-primary-glow); }
.time-picker-dropdown {
    display: none; position: absolute; top: 100%; left: 0; margin-top: 4px;
    background: #fff; border: 1px solid var(--h-border); border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: 1000;
    padding: 14px; min-width: 200px;
}
.time-picker-dropdown.show { display: block; }
.time-picker-row { display: flex; align-items: center; gap: 8px; }
.time-picker-select {
    padding: 8px 10px; border: 1px solid var(--h-border); border-radius: 8px;
    font-size: 1rem; font-weight: 600; background: #f8fafc; cursor: pointer;
}
.time-picker-sep { font-size: 1.2rem; font-weight: 700; color: var(--h-text-dim); }
.time-picker-ampm { display: flex; gap: 4px; margin-left: 6px; }
.time-picker-ampm .ampm-btn {
    padding: 8px 14px; border: 1px solid var(--h-border); border-radius: 8px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer; background: #f1f5f9;
    color: var(--h-text-dim); transition: all 0.2s;
}
.time-picker-ampm .ampm-btn.active { background: var(--h-primary); color: white; border-color: var(--h-primary); }
.time-picker-ampm .ampm-btn:hover:not(.active) { background: #e2e8f0; color: var(--h-text); }

/* BUTTONS */
.btn {
    padding: 10px 20px; border: none; border-radius: var(--h-radius);
    font-family: var(--h-font); font-weight: 700; font-size: 0.88rem;
    cursor: pointer; transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 8px;
}

.btn-primary { background: var(--h-primary); color: white; }
.btn-primary:hover { background: #0f766e; transform: translateY(-1px); box-shadow: 0 4px 12px var(--h-primary-glow); }
.btn-primary:disabled, .btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; pointer-events: none; }

.btn-secondary { background: #f1f5f9; color: var(--h-text); border: 1px solid var(--h-border); }
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger { background: var(--h-danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-generate {
    background: linear-gradient(135deg, var(--h-primary), #0f766e);
    color: white; padding: 18px 40px;
    font-size: 1.15rem; font-weight: 800;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--h-primary-glow);
    text-transform: uppercase; letter-spacing: 1px;
    border: none; cursor: pointer;
    font-family: var(--h-font);
    transition: all 0.2s;
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--h-primary-glow); }

/* CARDS */
.h-card {
    background: var(--h-card);
    border: 1px solid var(--h-border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--h-v2-card-shadow);
}
.panel-v2 .h-card:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.10);
}

/* TABLES */
.h-table-wrap { overflow-x: auto; margin: 14px 0; }

.h-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.h-table th {
    background: #f0fdf4;
    padding: 11px 14px; text-align: left;
    font-weight: 700; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--h-primary);
    border-bottom: 2px solid rgba(13,148,136,0.3);
}
.h-table td { padding: 10px 14px; border-bottom: 1px solid var(--h-border); color: var(--h-text); }
.h-table tr:hover td { background: #f8fafc; }
.h-table .actions { display: flex; gap: 6px; }

/* COLOR SWATCH */
.color-swatch {
    width: 28px; height: 28px; border-radius: 6px;
    border: 2px solid rgba(0,0,0,0.15);
    cursor: pointer; transition: transform 0.15s;
    display: inline-block;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: var(--h-text); box-shadow: 0 0 8px rgba(0,0,0,0.2); transform: scale(1.15); }

.color-picker-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
}

/* AVAILABILITY GRID */
.avail-grid { overflow-x: auto; margin: 12px 0; }

.avail-table { border-collapse: collapse; width: 100%; }
.avail-table th {
    font-size: 0.7rem; font-weight: 700;
    text-align: center; color: var(--h-text-dim);
    padding: 6px 4px;
}
.avail-table td { padding: 3px; }

.avail-cell {
    width: 100%; padding: 7px 2px;
    border: none; border-radius: 5px;
    cursor: pointer; font-size: 0.65rem;
    font-weight: 700; text-align: center;
    transition: all 0.1s;
    display: block;
}
.avail-cell.available { background: rgba(13,148,136,0.15); color: #0d9488; }
.avail-cell.unavailable { background: rgba(220,38,38,0.12); color: #dc2626; }
.avail-cell.avail-disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; opacity: 0.7; }

/* SCHEDULE GRID */
.schedule-container {
    overflow-x: auto; margin: 20px 0;
    border-radius: 14px;
    border: 1px solid rgba(148,163,184,0.35);
    box-shadow: var(--h-v2-card-shadow-soft);
}

.schedule-table { width: 100%; border-collapse: collapse; min-width: 600px; }

.schedule-table th {
    background: #f8fafc;
    padding: 10px 6px; font-size: 0.78rem;
    font-weight: 700; text-transform: uppercase;
    color: var(--h-text-dim);
    border: 1px solid var(--h-border);
    text-align: center;
}

.schedule-table td {
    padding: 0;
    border: 1px solid var(--h-border);
    text-align: center; vertical-align: middle;
    height: 62px; min-width: 100px;
    position: relative;
}

.schedule-table .time-col {
    width: 75px; min-width: 75px;
    font-size: 0.72rem; font-weight: 600;
    color: var(--h-text-dim);
    background: #f8fafc;
    padding: 6px;
}

.schedule-cell {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 5px; cursor: pointer;
    transition: all 0.12s; min-height: 62px;
}
.schedule-cell:hover { filter: brightness(1.05); box-shadow: 0 2px 10px rgba(0,0,0,0.15); z-index: 1; }

.schedule-cell .materia-nombre {
    font-size: 0.72rem; font-weight: 800;
    text-transform: uppercase; line-height: 1.2;
}
.schedule-cell .profesor-nombre { font-size: 0.62rem; opacity: 0.85; margin-top: 2px; }

.schedule-cell.empty {
    background: #fafafa; color: var(--h-text-dim);
    font-size: 0.75rem;
}
.schedule-cell.empty:hover { background: rgba(13,148,136,0.06); }

/* Celdas con choque de horario */
.schedule-cell.schedule-cell-choque {
    box-shadow: inset 0 0 0 3px #ef4444;
    animation: choque-pulse 1.5s ease-in-out infinite;
}
.schedule-cell.schedule-cell-choque:hover { box-shadow: inset 0 0 0 3px #ef4444, 0 2px 10px rgba(239,68,68,0.3); }
.choque-badge { font-size: 0.7rem; margin-left: 2px; }
@keyframes choque-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.85; } }

/* Opciones deshabilitadas en modal celda (por conflicto) */
.option-item-disabled { opacity: 0.7; cursor: not-allowed; pointer-events: none; }

/* Vista Profesor: atenuar celdas cuando se filtra por aula */
.schedule-cell.prof-aula-dim {
    opacity: 0.25;
    pointer-events: none;
}

.recreo-row td {
    background: #fffbeb !important;
    height: 32px !important;
    font-size: 0.72rem; font-weight: 700;
    color: var(--h-accent);
    text-transform: uppercase; letter-spacing: 1px;
}

/* SECTION TABS */
.section-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.section-tab {
    padding: 8px 16px;
    border: 1px solid var(--h-border);
    border-radius: 20px; background: transparent;
    color: var(--h-text-dim);
    font-family: var(--h-font); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.section-tab.active { background: var(--h-primary); color: white; border-color: var(--h-primary); }
.section-tab:hover:not(.active) { border-color: var(--h-primary); color: var(--h-primary); }

/* VIEW TOGGLE */
.view-toggle {
    display: flex; background: #f1f5f9;
    border-radius: var(--h-radius); overflow: hidden;
    border: 1px solid var(--h-border); margin-bottom: 16px;
}
.view-toggle button {
    flex: 1; padding: 10px 16px; background: none; border: none;
    color: var(--h-text-dim); font-family: var(--h-font);
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
}
.view-toggle button.active { background: var(--h-primary); color: white; }

.view-toggle-v2 {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(13,148,136,0.25);
    background: linear-gradient(90deg, rgba(13,148,136,0.08), rgba(13,148,136,0.02));
}
.view-toggle-v2 button { font-weight: 700; }

.resultado-v2 {
    margin-top: 16px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(148,163,184,0.3);
    background: rgba(255,255,255,0.75);
}
.vista-v2 {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: var(--h-v2-card-shadow-soft);
}

/* MODAL */
.h-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 5000;
    align-items: center; justify-content: center;
}
.h-modal-overlay.show { display: flex; }

.h-modal {
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: 16px; padding: 26px;
    max-width: 650px; width: 92%;
    max-height: 85vh; overflow-y: auto;
    animation: modalPop 0.25s ease;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
@keyframes modalPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.h-modal h3 { margin-bottom: 16px; font-size: 1.05rem; color: var(--h-text); }

/* OPTION LIST */
.option-item {
    padding: 12px 14px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    margin-bottom: 8px; cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.12s;
    color: var(--h-text);
}
.option-item:hover { border-color: var(--h-primary); background: rgba(13,148,136,0.06); }
.option-color { width: 10px; height: 34px; border-radius: 4px; flex-shrink: 0; }

/* STATS BAR */
.stats-bar { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.stat-box {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148,163,184,0.35);
    border-radius: 12px;
    padding: 12px 18px;
    display: flex; flex-direction: column; gap: 3px;
}
.stat-label { font-size: 0.72rem; color: var(--h-text-dim); text-transform: uppercase; font-weight: 700; }
.stat-value { font-size: 1.2rem; font-weight: 800; color: var(--h-primary); }

/* SECTION CHECKBOX GRID */
.grid-secciones { width: 100%; border-collapse: collapse; margin-top: 12px; }
.grid-secciones th,
.grid-secciones td { text-align: center; padding: 6px 4px; }
.grid-secciones th {
    font-size: 0.82rem; font-weight: 700; color: var(--h-text-dim);
    padding-bottom: 10px;
}
.grid-secciones .grid-secciones-label {
    text-align: left; font-weight: 700; font-size: 0.9rem;
    color: var(--h-text); padding-right: 14px; white-space: nowrap;
}
.grid-secciones-cell { position: relative; }
.grid-secciones-cell input[type="checkbox"] { display: none; }
.grid-secciones-cell label {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin: 0 auto;
    border: 2.5px solid #475569; border-radius: 8px;
    cursor: pointer; transition: all 0.15s;
    font-size: 1rem; font-weight: 800; color: transparent;
    background: #f1f5f9;
}
.grid-secciones-cell label:hover {
    border-color: var(--h-primary); background: rgba(13,148,136,0.08);
}
.grid-secciones-cell input:checked + label {
    border: 2.5px solid #0d9488; background: rgba(13,148,136,0.18);
    color: #0d9488;
}
.grid-secciones-cell input:checked + label::after {
    content: '✓'; font-size: 1.2rem; font-weight: 900; color: #0d9488;
}
.grid-secciones-empty {
    text-align: center; color: var(--h-text-dim); padding: 20px;
    font-size: 0.88rem;
}
@media (max-width: 480px) {
    .grid-secciones-cell label { width: 34px; height: 34px; }
    .grid-secciones .grid-secciones-label { font-size: 0.78rem; }
}

/* SECTION LIST */
.section-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px; margin: 16px 0;
}
.section-item {
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    padding: 14px 10px; text-align: center;
    cursor: pointer; transition: all 0.2s;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.section-item.selected { border-color: var(--h-primary); background: rgba(13,148,136,0.06); }
.section-item:hover { border-color: var(--h-primary); }
.section-item .section-name { font-weight: 800; font-size: 1.05rem; color: var(--h-text); }
.section-item .section-info { font-size: 0.72rem; color: var(--h-text-dim); margin-top: 4px; }
.section-item .section-delete {
    position: absolute; top: 6px; right: 8px;
    background: none; border: none; color: var(--h-text-dim);
    cursor: pointer; font-size: 0.9rem; padding: 2px;
    opacity: 0; transition: opacity 0.2s;
}
.section-item:hover .section-delete { opacity: 1; }
.section-item .section-delete:hover { color: var(--h-danger); }

/* PROF CARD */
.prof-card {
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    padding: 16px; margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.prof-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.prof-card-name { font-weight: 700; font-size: 1rem; color: var(--h-text); }
.prof-card-materias { display: flex; flex-wrap: wrap; gap: 6px; }

/* CHIPS */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 0.75rem; font-weight: 600;
}

/* ALERTS */
.h-alert {
    padding: 12px 18px; border-radius: var(--h-radius);
    margin-bottom: 14px; font-size: 0.88rem; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}
.h-alert-success { background: #ecfdf5; border: 1px solid #10b981; color: #065f46; }
.h-alert-warning { background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; }
.h-alert-error { background: #fef2f2; border: 1px solid #ef4444; color: #991b1b; }
.h-alert-info { background: #eff6ff; border: 1px solid #3b82f6; color: #1e40af; }

/* SEPARADOR COMPLEMENTARIAS */
.fila-separador-complementarias td {
    padding: 10px 14px !important;
    background: rgba(124,58,237,0.06);
    border-top: 2px solid rgba(124,58,237,0.25);
    border-bottom: none;
}

/* EMPTY STATE */
.empty-state { text-align: center; padding: 36px; color: var(--h-text-dim); }
.empty-state i { font-size: 2.5rem; margin-bottom: 10px; display: block; opacity: 0.3; }

/* NAV BUTTONS */
.step-nav {
    display: flex; justify-content: space-between;
    margin-top: 28px; padding-top: 18px;
    border-top: 1px solid var(--h-border);
}

/* EXPORT */
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px; margin: 20px 0;
}
.export-card {
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: 14px;
    padding: 24px; text-align: center;
    cursor: pointer; transition: all 0.2s;
    box-shadow: var(--h-v2-card-shadow-soft);
}
.export-card:hover { border-color: var(--h-primary); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.export-card i { font-size: 2.2rem; color: var(--h-primary); margin-bottom: 10px; display: block; }
.export-card h4 { font-size: 0.92rem; margin-bottom: 5px; color: var(--h-text); }
.export-card p { font-size: 0.78rem; color: var(--h-text-dim); }

/* LOADER */
.h-loader {
    position: fixed; inset: 0;
    background: var(--h-bg); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
}
.h-loader .spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(13,148,136,0.2);
    border-top-color: var(--h-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* RECREO CONFIG */
.recreo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--h-border);
    border-radius: 8px;
    margin-bottom: 8px;
}
.recreo-item select, .recreo-item input {
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid var(--h-border);
    border-radius: 6px;
    color: var(--h-text);
    font-family: var(--h-font);
    font-size: 0.85rem;
}

/* BLOQUES PREVIEW */
.bloques-preview-list {
    display: flex; flex-direction: column; gap: 4px;
}
.bloque-prev {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px; border-radius: 6px;
    font-size: 0.85rem;
}
.bloque-prev.es-clase { background: rgba(13,148,136,0.06); }
.bloque-prev.es-recreo { background: #fffbeb; color: var(--h-accent); font-weight: 700; }
.bloque-prev-num { font-weight: 800; color: var(--h-primary); min-width: 24px; }

/* PRINT HEADER */
.print-header { display: none; }

/* COMPLEMENTARIAS INPUTS */
.compl-input:focus {
    outline: none;
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
}
.compl-input::-webkit-inner-spin-button {
    opacity: 1;
}

/* Celda complementaria en vista profesor */
.compl-cell {
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MODAL PROFESOR: AREAS + SECCIONES ACCORDION */
.area-assign-block {
    border: 1px solid var(--h-border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.area-assign-block.area-checked {
    border-color: var(--h-primary);
}
.area-assign-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.area-assign-header:hover { background: #f1f5f9; }
.area-assign-block.area-checked .area-assign-header {
    background: rgba(13,148,136,0.06);
}
.area-assign-header input[type="checkbox"] {
    accent-color: var(--h-primary);
    width: 17px; height: 17px;
    cursor: pointer;
}
.area-assign-header .area-color-dot {
    width: 14px; height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.area-assign-header .area-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--h-text);
    flex: 1;
}
.area-assign-header .area-hours {
    font-size: 0.78rem;
    color: var(--h-text-dim);
    font-weight: 600;
}
.area-secciones-panel {
    padding: 10px 14px 12px;
    border-top: 1px solid var(--h-border);
    background: #ffffff;
}
.area-secciones-panel .secc-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}
.area-secciones-panel .secc-check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid var(--h-border);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--h-text);
    background: #f8fafc;
}
.area-secciones-panel .secc-check-label:hover {
    border-color: var(--h-primary);
    background: rgba(13,148,136,0.04);
}
.area-secciones-panel .secc-check-label:has(input:checked) {
    border-color: var(--h-primary);
    background: rgba(13,148,136,0.1);
    color: var(--h-primary);
}
.area-secciones-panel .secc-check-label:has(input.seccion-cb:disabled) {
    cursor: not-allowed;
    opacity: 0.65;
}
.area-secciones-panel .secc-check-label input {
    accent-color: var(--h-primary);
    cursor: pointer;
}
.area-secciones-panel .btn-sel-todas {
    background: none;
    border: none;
    color: var(--h-primary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--h-font);
    padding: 2px 0;
}
.area-secciones-panel .btn-sel-todas:hover { text-decoration: underline; }

/* MODAL PROFESOR: COMPLEMENTARIAS */
.modal-compl-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.modal-compl-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--h-text);
}
.modal-compl-item input {
    width: 48px;
    padding: 5px 6px;
    text-align: center;
    border: 1px solid var(--h-border);
    border-radius: 6px;
    font-family: var(--h-font);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--h-text);
    background: #ffffff;
}
.modal-compl-item input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124,58,237,0.25);
}

/* MODAL PROFESOR: RESUMEN HORAS */
.modal-resumen-horas {
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid var(--h-border);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--h-text);
}
.modal-resumen-horas .resumen-linea-principal {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 4px;
}
.modal-resumen-horas .resumen-linea-detalle {
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0.9;
}
.modal-resumen-horas.ok { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.modal-resumen-horas.warn { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.modal-resumen-horas.danger { border-color: #ef4444; background: #fef2f2; color: #991b1b; }

/* Opción que excede límite de horas */
.option-item.option-excede {
    border-color: rgba(220,38,38,0.3);
    background: rgba(220,38,38,0.04);
}
.option-item.option-excede:hover {
    border-color: #dc2626;
    background: rgba(220,38,38,0.08);
}

/* V2: conflictos, explicación y swap */
.conflict-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--h-border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    background: #fff;
}
.conflict-item:hover { border-color: var(--h-primary); background: rgba(13,148,136,0.05); }
.conflict-item.error { border-left: 4px solid #ef4444; }
.conflict-item.warning { border-left: 4px solid #f59e0b; }

.explain-box {
    border: 1px solid var(--h-border);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    font-size: 0.86rem;
    line-height: 1.45;
}

.swap-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--h-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    background: #fff;
}
.swap-item:hover { border-color: var(--h-primary); background: rgba(13,148,136,0.05); }

/* RESPONSIVE */
@media (max-width: 768px) {
    .h-header { padding: 0 12px; gap: 8px; }
    .h-header h1 { font-size: 0.85rem; }
    .h-header-left { gap: 10px; }
    .h-header-actions { gap: 6px; }
    .h-header-actions .btn-sm { padding: 5px 8px; font-size: 0.72rem; }

    .wizard-nav { padding: 0 8px; }
    .wizard-step .step-label { display: none; }
    .wizard-step { padding: 10px 10px; }
    .btn-tutorial { padding: 5px 10px; font-size: 0.72rem; margin: 6px 4px 6px 0; }
    .btn-tutorial i { font-size: 0.9rem; }

    .h-main { padding: 110px 12px 30px; }
    .step-title { font-size: 1.1rem; }
    .step-desc { font-size: 0.82rem; }
    .form-row { grid-template-columns: 1fr; }
    .h-card { padding: 16px; }

    .schedule-table { min-width: 500px; }
    .schedule-table td { height: 52px; min-width: 80px; }
    .schedule-cell { min-height: 52px; padding: 3px; }
    .schedule-cell .materia-nombre { font-size: 0.65rem; }
    .schedule-cell .profesor-nombre { font-size: 0.58rem; }
    .schedule-table .time-col { width: 60px; min-width: 60px; font-size: 0.65rem; }

    .btn-generate { padding: 14px 24px; font-size: 0.95rem; }
    .h-modal { padding: 18px; width: 96%; max-height: 90vh; max-width: 96%; }
    .area-assign-header { padding: 8px 10px; gap: 8px; }
    .area-secciones-panel { padding: 8px 10px; }
    .area-secciones-panel .secc-check-label { padding: 4px 8px; font-size: 0.78rem; }
    .modal-compl-row { gap: 6px; }
    .modal-compl-item { font-size: 0.78rem; }
    .modal-compl-item input { width: 42px; padding: 4px 4px; font-size: 0.8rem; }
    .export-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .stats-bar { gap: 8px; }
    .stat-box { padding: 10px 12px; flex: 1; min-width: 0; }
    .stat-label { font-size: 0.65rem; }
    .stat-value { font-size: 1rem; }

    .section-tab { padding: 6px 12px; font-size: 0.75rem; }
    .view-toggle button { padding: 8px 10px; font-size: 0.78rem; }

    .recreo-item { flex-wrap: wrap; gap: 8px; padding: 10px; }
    .recreo-item select, .recreo-item input { font-size: 0.8rem; padding: 5px 8px; }

    .prof-card { padding: 12px; }
    .prof-card-header { flex-wrap: wrap; gap: 8px; }
    .prof-card-name { font-size: 0.9rem; }

    .avail-table th { font-size: 0.6rem; padding: 4px 2px; }
    .avail-cell { padding: 6px 1px; font-size: 0.6rem; }

    .section-item .section-delete { opacity: 0.6; }

    .step-nav { gap: 8px; }
    .step-nav .btn { padding: 8px 14px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .h-header h1 { display: none; }
    .h-main { padding: 105px 10px 24px; }

    .export-grid { grid-template-columns: 1fr; }
    .section-list { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .section-item { padding: 10px 6px; }
    .section-item .section-name { font-size: 0.9rem; }

    .grid-secciones-cell label { width: 32px; height: 32px; }
    .grid-secciones .grid-secciones-label { font-size: 0.75rem; padding-right: 8px; }
    .grid-secciones th { font-size: 0.72rem; }

    .h-table th { padding: 8px 8px; font-size: 0.7rem; }
    .h-table td { padding: 8px 8px; font-size: 0.82rem; }

    .btn-generate { padding: 12px 20px; font-size: 0.88rem; letter-spacing: 0.5px; }

    .bloque-prev { padding: 6px 10px; font-size: 0.78rem; gap: 8px; }

    .option-item { padding: 10px; gap: 8px; font-size: 0.85rem; }

    .step-nav { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .step-nav .btn { flex: 1; justify-content: center; min-width: 0; }
}

@media (max-width: 360px) {
    .h-header-actions .btn-sm span { display: none; }
    .grid-secciones-cell label { width: 28px; height: 28px; }
    .grid-secciones-cell input:checked + label::after { font-size: 0.85rem; }
    .wizard-step { padding: 8px 8px; }
    .step-num { width: 20px; height: 20px; font-size: 0.6rem; }
}

/* PRINT */
@media print {
    body { background: white !important; color: black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .h-header, .wizard-nav, .step-nav, .btn, .h-loader,
    .view-toggle, .section-tabs, .stats-bar, .h-alert,
    #btn-generar, #btn-regenerar, #panel-conflictos, #panel-explicacion { display: none !important; }
    .h-main { padding: 0 !important; max-width: 100% !important; }
    .step-panel { display: none !important; }
    .step-panel.printing { display: block !important; }
    .schedule-container { border: 2px solid #333; }
    .schedule-table { min-width: unset !important; }
    .schedule-table th { background: #e5e7eb !important; color: #111 !important; border-color: #333 !important; }
    .schedule-table td { border-color: #333 !important; }
    .schedule-cell .materia-nombre { color: white !important; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
    .schedule-cell .profesor-nombre { color: rgba(255,255,255,0.9) !important; }
    .compl-cell .materia-nombre { text-shadow: none !important; font-weight: 600 !important; }
    .schedule-cell[style*="dashed"] .materia-nombre { text-shadow: none; }
    .schedule-cell[style*="dashed"] .profesor-nombre { text-shadow: none; }
    .recreo-row td { background: #f3f4f6 !important; color: #666 !important; }
    .print-header { display: block !important; text-align: center; margin-bottom: 16px; color: black; }
    .print-header h2 { font-size: 1.2rem; margin-bottom: 4px; }
    .print-header p { font-size: 0.85rem; color: #666; }
    .time-col { background: #f9fafb !important; color: #333 !important; }
}
