/* ==========================================================================
   CSS FINAL - FILTRO Y MODAL DE COLUMNA ÚNICA
   ========================================================================== */

/* --- 1. Variables y Estilos Base --- */
:root {
    --primary-blue: #007AFF;
    --rescue-orange: #FF4D00;
    --background-light: #F4F7F9;
    --panel-white: #FFFFFF;
    --text-dark: #2c3e50;
    --text-light: #8a95a5;
    --border-color: #DDE4ED;
}
body.modal-open { overflow: hidden; }

/* --- 2. Filtros y Cuadrícula --- */
.team-flexbox { display: flex; gap: 40px; margin: 20px 0; }
.team-nav { flex: 0 0 240px; position: sticky; top: 100px; align-self: flex-start; }
.team-nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.team-nav li { padding: 12px 20px; cursor: pointer; font-weight: 500; color: var(--text-light); border-radius: 8px; transition: all 0.3s ease; }
.team-nav li:hover { background-color: #e9f5ff; color: var(--primary-blue); }
.team-nav li.active { background-color: var(--primary-blue); color: white; font-weight: 600; }
.team-nav li a { text-decoration: none; color: inherit; }
.team-wrap { flex: 1; min-width: 0; }
.members-group { display: none; }
.members-group.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.section-title { margin-top: 0; margin-bottom: 30px; font-size: 2.2em; font-weight: 600; color: var(--text-dark); }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 30px; }
.member .img-wrap { cursor: pointer; border-radius: 12px; overflow: hidden; box-shadow: 0 5px 20px rgba(44, 62, 80, 0.05); transition: all 0.3s ease; }
.member .img-wrap:hover { transform: translateY(-8px); box-shadow: 0 12px 25px rgba(44, 62, 80, 0.12); }
.member .img-wrap img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1.1; object-fit: cover; }
.member-desc { margin-top: 15px; text-align: left; }
.member-desc .title { font-size: 1.15em; font-weight: 600; color: var(--text-dark); margin: 0; }
.member-desc .position { font-size: 0.9em; color: var(--text-light); margin-top: 4px; }

/* --- 3. Contenedor de Modales y Overlay --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 999; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* --- 4. Estilos del Modal Full-Screen (CON ANIMACIÓN CORREGIDA) --- */
.preloaded-modal.member {  
    display: grid;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    grid-template-columns: 60% 40%;
    background: var(--background-light);
    z-index: 1000;
    overflow: hidden;
    
    /* Estado inicial: invisible */
    opacity: 0;
    visibility: hidden;
    
    /* Transición para el contenedor principal (el fondo) */
    transition: opacity 0.5s ease, visibility 0s linear 0.5s !important;
}

.preloaded-modal.member.active {
    /* Estado activo: visible */
    opacity: 1;
    visibility: visible;
    
    /* La transición de salida se define aquí */
    transition: opacity 0.5s ease 0.3s, visibility 0s linear 0s !important;
}

.modal-panel {
    height: 100%;
    position: relative;
}

.modal-panel-image {
    background-size: cover;
    background-position: center;
    /* Estado inicial */
    transform: scale(1.2);
    opacity: 0;
    /* Transición de entrada y salida para el panel de imagen */
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1) 0.1s, opacity 0.6s ease 0.1s !important;
}
.preloaded-modal.member.active .modal-panel-image {
    /* Estado activo */
    transform: scale(1);
    opacity: 1;
}

.modal-panel-content {
    background-color: var(--panel-white);
    overflow-y: auto;
    box-shadow: -10px 0px 40px rgba(0,0,0,0.1);
    /* Estado inicial */
    transform: translateX(100%);
    /* Transición de entrada y salida para el panel de contenido */
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1) !important;
}
.preloaded-modal.member.active .modal-panel-content {
    /* Estado activo */
    transform: translateX(0);
}

.content-wrapper { padding: 5vw; display: flex; flex-direction: column; align-items: center; text-align: center; }
.close-modal-button { position: absolute; top: 30px; right: 30px; background: rgba(255,255,255,0.7); border: 1px solid var(--border-color); border-radius: 50%; width: 45px; height: 45px; color: var(--text-dark); font-size: 2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 1010; transition: all 0.3s ease; line-height: 1; }
.close-modal-button:hover { background: var(--text-dark); color: white; transform: rotate(90deg); }
.profile-image-large { width: 300px; height: 400px; object-fit: cover; object-position: center top; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); margin: 0 auto 30px; }
.role-subtitle {  font-size: 1rem; font-weight: 700; text-transform: uppercase; color: var(--primary-blue); margin: 0 0 10px 0; letter-spacing: 1px; }
.main-name {  font-size: 2.5vw; font-weight: 800; margin: 0; line-height: 1.1; margin-bottom: 20px; color: var(--text-dark); }
.key-data-section { display: flex; justify-content: center; gap: 25px; margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid var(--border-color); width: 100%; max-width: 500px; }
.key-data-item { font-size: 0.9rem; color: var(--text-light); text-decoration: none; transition: color 0.2s ease; }
.key-data-item strong { display: block; color: var(--text-dark); margin-bottom: 5px; }
.key-data-item:hover { color: var(--primary-blue); }
.main-description { font-size: 1rem; line-height: 1.8; max-width: 65ch; margin-bottom: 40px; color: var(--text-light); text-align: left; }
.missions-section { border-top: 1px solid var(--border-color); padding-top: 30px; width: 100%; max-width: 65ch; }
.missions-title { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 20px 0; color: var(--text-dark); text-align: left; }
a.mission-card { display: flex; align-items: center; text-decoration: none; gap: 20px; background: var(--background-light); border: 1px solid var(--border-color); padding: 15px 20px; border-radius: 10px; margin-bottom: 15px; transition: all 0.3s ease; }
a.mission-card:hover { transform: scale(1.02); border-color: var(--primary-blue); box-shadow: 0 8px 20px rgba(0, 122, 255, 0.1); }
.mission-date { text-align: center; color: var(--primary-blue); background-color: #e9f5ff; border-radius: 8px; padding: 8px 10px; flex-shrink: 0; }
.mission-date span { display: block;  sans-serif; font-weight: 700; }
.mission-date .day { font-size: 1.8rem; line-height: 1; }
.mission-date .month { font-size: 0.8rem; text-transform: uppercase; }
.mission-info .title { font-weight: 700; margin: 0 0 5px 0; color: var(--text-dark); }
.mission-info .status { font-size: 0.9em; margin: 0; color: var(--text-light); }
.mission-info .status strong { color: var(--rescue-orange); }
.mission-arrow { margin-left: auto; font-size: 1.5rem; color: var(--border-color); }
@media (max-width: 768px) { .team-flexbox { flex-direction: column; } .team-nav { position: static; width: 100%; } .team-nav ul { flex-direction: row; flex-wrap: wrap; justify-content: center; } .preloaded-modal.member { grid-template-columns: 100%; grid-template-rows: 40% 60%; } .modal-panel-content { transform: translateY(100%); } .preloaded-modal.member.active .modal-panel-content { transform: translateY(0); } .content-wrapper { padding: 40px; } .profile-image-large { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 20px; } .main-name { font-size: 10vw; } }