/* ======================================================
   ARCHIVO: psicologia/alumnos.css
   VERSIÓN: FINAL CORREGIDA (3 Columnas + Selects Fix)
   ====================================================== */

/* --- Importación de Fuentes --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* --- Animaciones --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Estilos Base --- */
body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    line-height: 1.6;
}

#vista-alumnos {
    max-width: 98%; 
    margin: 10px auto;
    padding: 15px;
    animation: fadeIn 0.4s ease-out;
}

h2 {
    color: #ffffff;
    border-bottom: 2px solid #00bcd4;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* --- Barra de Herramientas --- */
.toolbar { margin-bottom: 20px; }

#buscar-alumno {
    width: 100%;
    padding: 12px;
    background-color: #2c2c2c;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1em;
    box-sizing: border-box;
    transition: 0.3s;
}

#buscar-alumno:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.3);
}

/* --- Estilo de Tabla --- */
#tabla-alumnos {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#tabla-alumnos th {
    background-color: #111;
    color: #00bcd4;
    padding: 15px;
    text-align: left;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 1px;
}

#tabla-alumnos td {
    padding: 12px 15px;
    border-bottom: 1px solid #333;
    font-size: 0.95em;
}

#tabla-alumnos tbody tr:hover {
    background-color: #2a2a2a;
}

/* --- Botones --- */
.btn-agregar-expediente, .btn-cyan {
    background-color: #00bcd4;
    color: #000;
    font-weight: bold;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.btn-agregar-expediente:hover, .btn-cyan:hover {
    background-color: #00e0eb;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.4);
}

.btn-ver-expediente {
    background-color: #333;
    color: #00bcd4;
    border: 1px solid #00bcd4;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.85em;
}

.btn-ver-expediente:hover {
    background-color: #00bcd4;
    color: #000;
}


/* ======================================================
   🚨 ESTILOS DEL MODAL (CENTRADO Y COMPACTO) 🚨
   ====================================================== */

/* 1. Contenedor Padre (Overlay) */
.modal {
    display: none; 
    /* Centrado Mágico Flexbox */
    align-items: center !important;     
    justify-content: center !important; 
    
    position: fixed !important; 
    z-index: 10000 !important; 
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(3px);
}

.modal.modal-show, .modal.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 2. La Caja del Modal */
.modal-content {
    position: relative !important; 
    margin: auto !important;
    background-color: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #333;
    
    /* ANCHO AMPLIO */
    width: 95% !important;
    max-width: 1100px !important; 
    
    /* ALTURA AJUSTADA AL CONTENIDO */
    max-height: 98vh;
    overflow-y: auto; /* Scroll solo si la pantalla es muy chica */
    
    padding: 20px 30px; 
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.9);
    
    animation: zoomIn 0.3s ease-out forwards;
}

/* Títulos internos */
.modal-content h3, .modal-content h4 {
    margin: 5px 0 15px 0;
    font-size: 1rem;
    color: #00bcd4;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Botón Cerrar (X) */
.closeBtn {
    top: 15px; right: 20px;
    font-size: 24px;
    position: absolute;
    cursor: pointer;
    color: #888;
    z-index: 10;
}
.closeBtn:hover { color: #fff; }


/* --- FORMULARIOS (GRID DE 3 COLUMNAS) --- */
.form-columns {
    display: grid;
    /* Forzamos 3 columnas exactas */
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 12px 20px; /* Espacio vertical y horizontal */
    align-items: end;
}

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: #aaa;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ESTILOS UNIFICADOS PARA INPUT Y SELECT */
.form-group input, 
.form-group select {
    width: 100%;
    height: 38px; /* Altura idéntica */
    padding: 6px 10px;
    
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

/* TRUCO PARA LOS SELECTS (Flecha Blanca) */
.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    
    padding-right: 35px;
    cursor: pointer;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: #00bcd4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.2);
}

/* Botones del formulario */
.form-nav-buttons {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* RESPONSIVIDAD: En celulares pasa a 1 columna */
@media (max-width: 900px) {
    .form-columns { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 600px) {
    .form-columns { grid-template-columns: 1fr !important; }
}


/* ======================================================
   --- EXPEDIENTE (Tabs y Switches) ---
   ====================================================== */
.expediente-header {
    display: flex; justify-content: space-between; align-items: center; margin-right: 40px;
}

.estado-toggle {
    display: flex; align-items: center; gap: 10px;
    font-weight: bold; background: #252525; padding: 5px 15px;
    border-radius: 20px; border: 1px solid #444;
}

/* Switch CSS */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #666; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #4CAF50; }
input:checked + .slider:before { transform: translateX(20px); }

/* Tabs */
.tabs { display: flex; gap: 15px; margin-bottom: 20px; border-bottom: 2px solid #333; }
.tab-btn { background: none; border: none; color: #888; padding: 10px 15px; cursor: pointer; font-size: 1em; font-weight: bold; border-bottom: 3px solid transparent; transition: all 0.3s; }
.tab-btn:hover { color: #ccc; }
.tab-btn.active { color: #00bcd4; border-bottom-color: #00bcd4; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s; }

.input-readonly { border: 1px solid transparent !important; background-color: transparent !important; padding-left: 0 !important; color: #fff !important; font-weight: bold; cursor: default; }
.input-editable { border: 1px solid #00bcd4 !important; background-color: #2c2c2c !important; }

/* Botones de acción del expediente */
.actions-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #333; }
.right-buttons { display: flex; gap: 10px; }
.btn-danger { background-color: #d32f2f; color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-weight: bold;}
.btn-success { background-color: #4CAF50; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold;}
.btn-secondary { background-color: #666; color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-weight: bold;}


/* ======================================================
                    SWEETALERT
   ====================================================== */

/* Contenedor general */
div:where(.swal2-container) .swal2-popup {
    background-color: #1e1e1e !important;
    border: 1px solid #333 !important;
    color: #e0e0e0 !important;
    width: 90% !important;
    max-width: 450px !important;
}

/* Títulos */
div:where(.swal2-container) .swal2-title { color: #fff !important; }

/* ⚠️ ARREGLO DEL SELECT FANTASMA: Se oculta por defecto ⚠️ */
div:where(.swal2-container) .swal2-select {
    display: none; 
    background-color: #2c2c2c; color: white;
    border: 1px solid #555; border-radius: 5px;
    padding: 0.5rem; margin: 1rem auto; width: 100%;
}
/* SweetAlert añade display:flex/block inline cuando lo usa, esto lo permite: */
div:where(.swal2-container) .swal2-select[style*="display: flex"] { display: flex !important; }
div:where(.swal2-container) .swal2-select[style*="display: block"] { display: block !important; }

/* Botones */
div:where(.swal2-container) .swal2-confirm {
    background-color: #00bcd4 !important; color: #000 !important; font-weight: bold !important;
}
div:where(.swal2-container) .swal2-cancel {
    background-color: #d33 !important; color: #fff !important;
}

/* Estilos para las tarjetas de observaciones */
.obs-card {
    background-color: #252525;
    border: 1px solid #333;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.obs-card:hover {
    border-color: #00bcd4;
}

/* Cabecera (Siempre visible) */
.obs-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c2c2c;
}

.obs-date {
    font-size: 0.8em;
    color: #00bcd4;
    font-weight: bold;
    min-width: 80px;
}

.obs-preview {
    color: #ccc;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 15px;
    flex-grow: 1;
    max-width: 400px; /* Ajusta según el ancho del modal */
}

/* Cuerpo (Oculto hasta expandir) */
.obs-body {
    padding: 15px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    display: none; /* Oculto por defecto */
    animation: slideDown 0.3s ease-out;
}

.obs-card.expanded .obs-body {
    display: block;
}

.obs-card.expanded .obs-header {
    background: #00bcd4;
}

.obs-card.expanded .obs-date { color: #000; }
.obs-card.expanded .obs-preview { color: #000; font-weight: bold; }

/* Animación suave */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}