/* Estilos Base */
:root {
    --utn-blue: #005DA4;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --bg-light: #f8f9fa;
    --text-dark: #333;
    --border-color: #dee2e6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* Encabezado */
.header-container {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

h1 {
    color: var(--utn-blue);
    margin: 0;
    text-transform: uppercase;
    font-size: 1.8rem;
}

/* Tarjetas por Año */
.card-anio {
    background: white;
    border-radius: 8px;
    margin-bottom: 40px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

h2 {
    background: var(--utn-blue);
    color: white;
    margin: 0;
    padding: 15px 20px;
    font-size: 1.3rem;
    text-align: center;
}

/* Estilos de la Tabla */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid var(--border-color);
    text-align: center;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.95rem;
}

/* Columna de Materia (Alineada a la izquierda) */
.nombre-materia {
    text-align: left;
    font-weight: bold;
}

/* Tabla Original: Columnas de Correlativas */
#contenedor-tablas td:nth-child(4), #contenedor-tablas td:nth-child(5) {
    font-family: inherit;
    color: var(--text-dark);
    font-weight: 400;
    width: 15%;
}
#contenedor-tablas .nombre-materia { width: 25%; }

/* Tabla Proyección: Anchos fijos para que no se desalineen las columnas */
.tabla-proyeccion th:nth-child(1), .tabla-proyeccion td:nth-child(1) { width: 5%; }
.tabla-proyeccion th:nth-child(2), .tabla-proyeccion td:nth-child(2) { width: 45%; }
.tabla-proyeccion th:nth-child(3), .tabla-proyeccion td:nth-child(3) { width: 15%; }
.tabla-proyeccion th:nth-child(4), .tabla-proyeccion td:nth-child(4) { width: 15%; }
.tabla-proyeccion th:nth-child(5), .tabla-proyeccion td:nth-child(5) { width: 20%; }

/* Estados de Cursado */
.estado-cursado {
    font-weight: bold;
    border-radius: 4px;
    padding: 4px 8px;
}

.desbloqueado { color: var(--success-green); background-color: #e8f5e9; }
.bloqueado { color: var(--danger-red); background-color: #ffebee; }

select.condicion {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ccc;
    width: 100%;
    cursor: pointer;
}

/* Botón Patear (Naranja) */
.btn-postergar {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-postergar:hover { background-color: #e67e22; }

/* Botón Azul de Arrepentimiento (↩) integrado en el texto */
.btn-revertir {
    background-color: var(--utn-blue);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    margin-right: 10px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.btn-revertir:hover { background-color: #003d6b; }

.fila-postergada { background-color: #fdfdfd; }
.fila-postergada .nombre-materia { color: #6c757d; font-weight: normal; }

/* Globito de texto para Correlativas (Invisibles hasta el hover) */
.correlativa-hover {
    cursor: help;
    color: inherit; /* Mantiene el color normal del texto */
    font-weight: normal; /* Sin negritas */
    border-bottom: none; /* Sin subrayado feo */
    padding: 0 4px;
    transition: all 0.2s ease;
}

.correlativa-hover:hover {
    color: var(--utn-blue); /* Se pinta de azul recién al pasar el mouse */
    font-weight: bold;
    background-color: #e9ecef;
    border-radius: 4px;
}
/* --- COLORES PARA EL SELECTOR DE CONDICIÓN --- */
select.condicion {
    transition: all 0.2s ease;
}

select.condicion.bg-pendiente {
    background-color: #f8d7da; /* Rojo suave */
    color: #721c24;
    font-weight: 600;
    border-color: #f5c6cb;
}

select.condicion.bg-regular {
    background-color: #fff3cd; /* Amarillo suave */
    color: #856404;
    font-weight: 600;
    border-color: #ffeeba;
}

select.condicion.bg-aprobada {
    background-color: #d4edda; /* Verde suave */
    color: #155724;
    font-weight: 600;
    border-color: #c3e6cb;
}

/* --- ESTILOS AGREGADOS: MODAL Y CALENDARIO --- */

/* Botón flotante para abrir el calendario en las tarjetas de proyección */
.btn-calendario {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    float: right;
    margin-top: -3px;
    margin-right: -10px;
}
.btn-calendario:hover { transform: scale(1.1); }

/* Fondo oscuro del Modal */
.modal-oculto {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; top: 0; width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.6);
}

/* Contenedor principal del Modal */
.modal-contenido {
    background-color: var(--bg-light);
    margin: 2% auto; 
    padding: 0;
    border-radius: 8px;
    width: 90%; 
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Encabezado del Modal (Corregido para centrado y X a la derecha) */
.modal-header {
    background-color: var(--utn-blue);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { background: none; padding: 0; text-align: left; }
.controles-modal { display: flex; align-items: center; gap: 15px; }
.cerrar-modal { color: white; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 1; margin-bottom: 4px; }
.cerrar-modal:hover { color: #ccc; }

/* Cuerpo dividido del Modal */
.modal-cuerpo {
    display: flex; flex: 1; overflow: hidden;
}

/* Panel Izquierdo (Selección de Comisiones y Editor) */
.panel-materias {
    width: 300px;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
}
.item-materia-cal {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
}
.item-materia-cal label { font-size: 0.9rem; font-weight: bold; display: block; margin-bottom: 5px; color: var(--utn-blue); }
.item-materia-cal select, .item-materia-cal input { width: 100%; padding: 4px; margin-bottom: 5px; box-sizing: border-box;}

.btn-editar-horario {
    background-color: #6c757d; color: white; border: none; padding: 4px; border-radius: 4px; width: 100%; cursor: pointer; font-size: 0.8rem; margin-top: 5px;
}

/* Panel Derecho (Grilla) */
/* Panel Derecho (Grilla) */
.panel-grilla {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}
.tabla-calendario { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.tabla-calendario th { background: #e9ecef; border: 1px solid #ccc; padding: 5px; font-size: 0.9rem; }

/* --- ESTILO GRILLA GOOGLE CALENDAR --- */

/* Ajustamos el encabezado para que no tenga la columna "Hora" vacía estorbando */
.tabla-calendario th:first-child {
    width: 45px; 
    border: none;
    background: white; 
}

/* Las celdas de la grilla */
.tabla-calendario td { 
    border-bottom: 1px solid #e0e0e0; 
    border-right: 1px solid #f0f0f0; 
    height: 52px; 
    padding: 0; 
    position: relative; 
    box-sizing: border-box; 
}

/* La celda base de la hora se encoge al mínimo para no robar ancho a los días */
.hora-col { 
    width: 45px; 
    padding: 0;
    border: none !important; 
    position: relative;
}

/* El número de la hora flotante centrado en la línea */
.hora-label {
    position: absolute;
    top: -8px; 
    right: 8px; 
    font-size: 0.7rem; 
    color: #70757a; 
    font-weight: 500;
    line-height: 1;
    z-index: 5;
    background-color: white; 
    padding: 2px 0;
}

/* Escondemos la primera hora para que no choque con los días */
.tabla-calendario tr:first-child .hora-label {
    display: none;
}

/* Quitamos la primera línea vertical para que quede limpio el margen izquierdo */
.tabla-calendario td:nth-child(2) { 
    border-left: 1px solid #f0f0f0; 
}

/* Bloques de Materia en el Calendario */
.bloque-materia {
    position: absolute;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.75rem;
    color: white;
    overflow: visible; /* Para el globito flotante */
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.4); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 10;
    line-height: 1.15;
    transition: transform 0.15s, z-index 0.1s, box-shadow 0.15s;

    /* CENTRADO Y BALANCEO DE TEXTO (Chau a la "y" solitaria) */
    text-align: center;
    text-wrap: balance; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* El texto en negrita (Nombre de la materia) también se balancea */
.bloque-materia strong {
    text-wrap: balance;
    margin-bottom: 2px;
}

/* Al pasar el mouse: Conserva su ancho, se oscurece y resalta el texto */
.bloque-materia:hover {
    z-index: 100 !important; 
    transform: scale(1.04); /* Se agranda un poquito para resaltar */
    
    /* EL TRUCO DEL COLOR Y LA SOMBRA: 
    El primer 'inset' tiñe la tarjeta de un velo negro (oscureciendo el color base).
       El segundo proyecta una sombra fuerte hacia afuera. */
    box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.3), 
                0 6px 12px rgba(0,0,0,0.4);
    
    /* SOMBRA AL TEXTO: Para que se lea perfecto aunque haya letras de otra materia atrás */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.9), 0 0 5px rgba(0,0,0,0.7);
    
    /* Borde un poco más oscuro para delimitar bien */
    border: 1px solid rgba(0,0,0,0.4);
}


.bloque-conflicto {
    background-color: var(--danger-red) !important;
    animation: parpadeo 1.5s infinite;
}
@keyframes parpadeo { 50% { opacity: 0.7; border: 2px solid yellow; } }

/* --- NUEVOS ESTILOS: SELECT, EDITOR CENTRADO Y MULTIDÍA --- */
.estilo-select {
    background-color: #004a82; /* Azul sutilmente diferente al fondo */
    color: white;
    border: 1px solid #003d6b;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.estilo-select option { background-color: white; color: var(--text-dark); }

/* Estilo unificado para el botón PDF */
.estilo-btn-pdf {
    background-color: var(--success-green); 
    color: white;
    border: 1px solid #1e7e34; /* Un verde un poquito más oscuro para el borde */
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background-color 0.2s; /* Efecto suave al pasar el mouse */
}

.estilo-btn-pdf:hover {
    background-color: #218838; /* Verde más oscuro en hover */
}

.centrado-flex {
    display: none; /* Por defecto oculto, JS lo pasará a 'flex' */
    align-items: center;
    justify-content: center;
}
.centrado-flex .modal-contenido {
    margin: 0; /* Anula el margin superior que lo dejaba "allá arriba" */
}

.fila-dia-edit {
    display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-end; 
    background: #f8f9fa; padding: 10px; border-radius: 6px; border: 1px solid #dee2e6;
}
.fila-dia-edit label { font-size: 0.8rem; color: #555; }

/* --- NUEVO DISEÑO: GLOBO DE TEXTO TIPO CÓMIC --- */

.horario-flotante {
    display: block; /* Siempre está en el DOM */
    position: absolute;
    
    /* Posicionamiento: Justo encima de la materia con un pequeño aire */
    bottom: calc(100% + 8px); 
    left: 50%; /* Centrado simétrico inicial */
    transform: translateX(-50%) translateY(10px); /* Centrado perfecto y bajado para la animación */
    
    /* Estilo visual del globo */
    background-color: var(--text-dark); /* Fondo muy oscuro para contraste garantizado */
    color: white; /* Texto blanco */
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap; /* Evita que el texto se parta en dos líneas */
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    
    /* Estado inicial: Invisible y transparente */
    opacity: 0;
    visibility: hidden;
    
    /* Animación suave de aparición */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 200; /* Por encima de todo */
}

/* La "colita" o triángulo del globo de cómic */
.horario-flotante::after {
    content: '';
    position: absolute;
    top: 100%; /* Enganchado abajo del globo */
    left: 50%;
    transform: translateX(-50%);
    
    /* Triángulo dibujado con bordes CSS */
    border-width: 6px;
    border-style: solid;
    border-color: var(--text-dark) transparent transparent transparent; /* Mismo color oscuro del globo */
}

/* --- EFECTO HOVER: MOSTRAR EL GLOBO --- */

/* Cuando pasas el mouse por la materia (.bloque-materia), afectamos al globo (.horario-flotante) */
.bloque-materia:hover .horario-flotante {
    opacity: 1; /* Se hace visible */
    visibility: visible;
    
    /* Sube suavemente a su posición final (translateY 0) combinándose con el efecto de levantado de la materia */
    transform: translateX(-50%) translateY(0px); 
}
/* --- ESTILOS: AUTO-ARMAR HORARIO --- */
.btn-auto-armar {
    width: 100%; 
    background: linear-gradient(135deg, #005DA4, #00a8e8);
    color: white; border: none; padding: 12px; border-radius: 6px;
    font-weight: bold; font-size: 1rem; cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-auto-armar:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 10px rgba(0,0,0,0.2); 
}

/* Lista Arrastrable (Drag & Drop) */
.lista-sortable {
    border: 1px solid #ddd; border-radius: 6px; background: #f8f9fa;
    min-height: 100px; padding: 6px; max-height: 250px; overflow-y: auto;
}
.item-prioridad {
    background: white; border: 1px solid #ccc; padding: 10px; margin-bottom: 6px;
    border-radius: 4px; cursor: grab; font-size: 0.85rem; font-weight: bold; color: var(--utn-blue);
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.item-prioridad:active { cursor: grabbing; background: #e9ecef; }
.sortable-ghost { opacity: 0.4; background: #d1ecf1; border: 1px dashed #17a2b8; }

/* El nuevo selector de comisión fija */
.select-fijar {
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: var(--text-dark);
    cursor: pointer;
    max-width: 110px;
}

/* Controles de paginación del generador */
.btn-paginacion {
    background: white; border: 1px solid #ccc; padding: 6px 12px;
    border-radius: 4px; cursor: pointer; font-weight: bold; color: var(--text-dark);
}
.btn-paginacion:hover { background: #e9ecef; }

/* --- BOTÓN FLOTANTE: BORRAR PROGRESO --- */
/* --- BOTÓN FLOTANTE: BORRAR PROGRESO --- */
/* --- BOTÓN FLOTANTE: BORRAR PROGRESO (Gemelo del de Reportar) --- */
#btn-borrar-progreso {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Este va a la derecha */
    background-color: var(--danger-red); /* O #c0392b si los querés del mismo rojo exacto */
    color: white;
    border: none;
    padding: 10px 16px; /* MISMO PADDING */
    border-radius: 50px; /* MISMO REDONDEO */
    cursor: pointer;
    font-family: "system-ui", -apple-system, sans-serif; /* MISMA FUENTE */
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* MISMA SOMBRA */
    z-index: 9998; /* MISMO NIVEL */
    transition: transform 0.2s ease; /* MISMA TRANSICIÓN */
}

#btn-borrar-progreso:hover {
    transform: scale(1.05); /* MISMO EFECTO AL PASAR EL MOUSE */
}

#btn-borrar-progreso:hover {
    transform: scale(1.05);
    background-color: #bd2130;
}

#btn-borrar-progreso:hover {
    background-color: #bd2130; /* Un rojo más oscuro */
    transform: scale(1.05);
}

/* --- ESTILOS: PANTALLA DE INICIO (PREDOMINIO AZUL UTN) --- */

/* Contenedor que ocupa toda la pantalla para centrar */
#pantalla-inicio {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: #f8f9fa; /* Fondo clarito como el resto de la app */
    z-index: 2000; 
    display: flex; 
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s, visibility 0.4s;
}

/* El cuadro centrado en sí - AHORA PREDOMINANTE AZUL UTN */
.contenedor-inicio {
    width: 450px;
    padding: 30px;
    background-color: #005DA4; /* AZUL UTN INSTITUCIONAL */
    border: 1px solid #004c86; /* Borde un poco más oscuro */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- TEXTOS DE LA PANTALLA DE INICIO --- */

/* 1. Textos DENTRO del recuadro blanco superior */
.contenedor-inicio .header-container h1 {
    color: var(--utn-blue) !important; /* Azul UTN */
}
.contenedor-inicio .header-container p {
    color: var(--text-dark) !important; /* Gris oscuro para el subtítulo */
}

/* 2. Textos SOBRE el fondo azul (Label del selector y texto de abajo) */
.contenedor-inicio > label,
.contenedor-inicio > p {
    color: #FFFFFF !important; /* Blanco puro para contrastar con el fondo azul */
}
/* El selector de la landing - AHORA BLANCO CON BORDES AZULES */
.select-carrera-landing {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: 6px;
    font-weight: bold;
    color: #005DA4; /* Texto Azul UTN */
    background-color: #fff;
    cursor: pointer;
    border: 2px solid #FFFFFF; /* Borde blanco de la tarjeta */
    transition: box-shadow 0.2s;
}
.select-carrera-landing:hover {
    box-shadow: 0 0 10px rgba(0,93,164, 0.5);
}

/* --- CLASES PARA MOSTRAR/OCULTAR LA APP --- */
.vista-oculta {
    opacity: 0;
    visibility: hidden;
    height: 0; overflow: hidden;
    transition: opacity 0.4s;
}

.vista-revelada {
    opacity: 1;
    visibility: visible;
    height: auto;
}