/* BOTÓN DE DESPLIEGUE */
.flag-toggle-container {
    text-align: center;
    margin: 3rem 0;
    position: relative;
    z-index: 10;
}

.flag-toggle-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 100;
}

.flag-toggle-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.flag-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.flag-toggle-btn:hover::before {
    left: 100%;
}

/* ANIMACIÓN DEL ASTA DE BANDERA - CORREGIDA */
.flag-pole {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    width: 8px;
    height: 0;
    background: linear-gradient(to bottom, #8B4513, #A0522D, #8B4513);
    border-radius: 4px;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    transform-origin: center;
}

.flag-pole.active {
    height: 400px;
    transform: translateY(-50%) scaleX(1);
}

.flag-section {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 700px;
    min-height: 500px;
    background: linear-gradient(135deg, #5267D9 10%, #0f0f10 50%, #111321 100%);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.6),
        0 0 0 1000px rgba(0, 0, 0, 0.7); /* Overlay de fondo */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    max-height: 80vh;
}

.flag-section.active {
    left: calc(-50%, -50%); /* Se despliega hacia la derecha */
    opacity: 1;
    visibility: visible;
}

.flag-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;

}

.flag-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Efecto de tela ondeando - corregido para derecha */
.flag-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: -10px; /* Cambiado de left a right */
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    border-radius: 0 15px 15px 0; /* Cambiado el border-radius */
    animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% {
        transform: translateX(0) scaleY(1);
    }
    50% {
        transform: translateX(-5px) scaleY(0.95); /* Cambiado a negativo */
    }
}

.flag-content {
    position: relative;
    z-index: 2;
}

.flag-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

/* Grid de valores mejorado */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.value-item {
    background: rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #feca57;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.value-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.value-item h4 {
    color: #feca57;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.value-item h4::before {
    content: '✨';
    font-size: 1.3rem;
}

.value-item p {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* Misión y Visión mejoradas */
.mission-vision {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.mission-vision-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.mission-vision-item h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.mission-vision-item h4::before {
    content: '🎯';
    font-size: 1.5rem;
}

.vision h4::before {
    content: '🔭';
}

.mission-vision-item p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* Animación de entrada */
@keyframes flagReveal {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateX(-10deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateX(0);
    }
}

.flag-section.active {
    animation: flagReveal 0.6s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .flag-section {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
        min-height: auto;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .flag-content h3 {
        font-size: 1.8rem;
    }
    
    .mission-vision-item {
        padding: 1rem;
    }
}

/* Deshabilitar scroll del body cuando el flag está activo */
body.flag-active {
    overflow: hidden;
}