/* --- TOKENS DE DISEÑO CENTRALIZADOS --- */
:root {
    --bg-principal: #f8fafc;
    --bg-tarjeta: #ffffff;
    --texto-principal: #1e293b;
    --texto-secundario: #64748b;
    
    /* Identidad de marca */
    --azul-primario: #0081c2;
    --azul-hover: #006fa7;
    --azul-claro: #e0f2fe;
    
    /* Bordes y estados */
    --borde: #e2e8f0;
    --borde-input: #cbd5e1;
    --borde-rosa: #f472b6;
    --borde-azul: #38bdf8;
    
    /* Material Design / MIUI Spec */
    --radio-medium: 12px;
    --radio-large: 16px;
    --radio-pill: 25px;
    --sombra: 0 10px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    --sombra-soft: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

/* --- RESET GLOBAL --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- FONDO ANIMADO MESH GRADIENT COMPARTIDO --- */
body {
    font-family: 'Inter', sans-serif;
    color: var(--texto-principal);
    line-height: 1.5;
    min-height: 100vh;
    background-color: var(--bg-principal);
    background-image: 
        radial-gradient(at 0% 0%, rgb(245, 235, 255) 0px, transparent 55%),
        radial-gradient(at 100% 0%, rgb(224, 242, 254) 0px, transparent 55%),
        radial-gradient(at 100% 100%, rgb(253, 230, 243) 0px, transparent 55%),
        radial-gradient(at 0% 100%, rgb(200, 235, 254) 0px, transparent 55%);
    background-size: 140% 140%;
    animation: movimientoFondo 20s ease infinite alternate;
    background-attachment: fixed;
}

@keyframes movimientoFondo {
    0% { background-position: 0% 0%; }
    50% { background-position: 20% 15%; }
    100% { background-position: 10% 30%; }
}

/* --- COMPONENTE MATERIAL: ENTORNO PREMIUM CON DOBLE BRILLO EN CONTRASTE --- */
.material-glow-card {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: var(--radio-large);
    overflow: hidden; /* Recorta el brillo sobrante de la capa giratoria */
    z-index: 1;
}

/* Capa trasera: Dos destellos que giran a 180 grados de distancia */
.material-glow-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent 0deg,
        var(--azul-primario) 45deg,    /* Primer destello: Azul */
        transparent 90deg,
        transparent 180deg,
        var(--borde-rosa) 225deg,     /* Segundo destello: Rosa (En el extremo opuesto) */
        transparent 270deg,
        transparent 360deg
    );
    animation: girarDobleBrillo 10s linear infinite;
    z-index: -2;
}

/* Capa central: Máscara interna para definir el grosor del borde (2px) */
.material-glow-card::after {
    content: '';
    position: absolute;
    inset: 2px; /* Define el grosor exacto del contorno brillante */
    background: rgba(255, 255, 255, 0.94); /* Fondo opaco interior para que el texto sea legible */
    border-radius: calc(var(--radio-large) - 2px);
    z-index: -1;
}

/* Animación de rotación continua */
@keyframes girarDobleBrillo {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* --- COMPONENTE MATERIAL: PNG FLIP CARD (EFECTO INTERACTIVO 3D) --- */
.material-flip-container {
    background-color: transparent;
    width: 100%;
    min-height: 250px; /* Ajusta la altura según necesites para tus PNGs */
    perspective: 1000px; /* Determina el efecto de profundidad 3D */
}

/* La tarjeta interna que realmente gira */
.material-flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d; /* Permite que los hijos hereden el entorno 3D */
}

/* Activador: Gira al pasar el cursor (Hover) */
.material-flip-container:hover .material-flip-card {
    transform: rotateY(180deg);
}

/* Activador alternativo: Por si prefieres girarla haciendo CLIC usando JS */
.material-flip-container.flipped .material-flip-card {
    transform: rotateY(180deg);
}

/* Estilo común para ambas caras (Frontal y Trasera) */
.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Soporte para Safari */
    backface-visibility: hidden;         /* Oculta la cara cuando gira */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radio-large);
}

/* Cara Frontal */
.flip-front {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--sombra);
    z-index: 2; /* Va adelante por defecto */
}

/* Cara Trasera */
.flip-back {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--sombra);
    transform: rotateY(180deg); /* Ya inicia volteada para que al girar la tarjeta quede al derecho */
}

/* Ajuste automático para tus imágenes PNG */
.material-flip-card img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}

/* --- ADAPTACIÓN ESPECÍFICA DEL FLIP AUTOMÁTICO PARA LOS LOGOS --- */

.brand-logos.material-flip-container {
    width: 100%;
    height: 128px;
    min-height: 128px;
    margin-bottom: 2.5rem;
    background: transparent;
    perspective: 1000px; /* Profundidad 3D */
}

.brand-logos .material-flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transform-style: preserve-3d;
    
    /* Ejecuta la animación infinitamente cada 10 segundos */
    animation: flipAutomatico 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Quitamos los estilos de tarjeta para que el PNG flote de forma transparente */
.brand-logos .flip-front, 
.brand-logos .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
}

.brand-logos .flip-back {
    transform: rotateY(180deg);
}

.brand-logos .material-flip-card img {
    height: 100%;
    width: auto;
    object-fit: contain;
    max-height: 128px;
}

/* --- LÓGICA DE TIEMPOS DE LA ANIMACIÓN (Ciclo de 10s) --- */
@keyframes flipAutomatico {
    0%, 40% {
        transform: rotateY(0deg); /* 0 a 4s: Se muestra el Logo Frontal estático */
    }
    45%, 90% {
        transform: rotateY(180deg); /* 4.5s a 9s: Da la vuelta y se muestra el Logo Trasero estático */
    }
    95%, 100% {
        transform: rotateY(360deg); /* 9.5s a 10s: Da la vuelta completa para reiniciar el ciclo */
    }
}