/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    height: 100vh;
    overflow: hidden;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Video de fondo */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

/* Overlay para mejorar legibilidad */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(30, 60, 114, 0.7) 0%,
        rgba(42, 82, 152, 0.6) 25%,
        rgba(78, 205, 196, 0.4) 50%,
        rgba(69, 183, 209, 0.5) 75%,
        rgba(30, 60, 114, 0.7) 100%
    );
    z-index: -1;
}

/* Prevenir scroll en el carrusel pero permitir en tarjetas */
.carousel-container {
    overflow: hidden;
}

.card-back {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.card-back::-webkit-scrollbar {
    width: 6px;
}

.card-back::-webkit-scrollbar-track {
    background: transparent;
}

.card-back::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.card-back::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Contenedor principal */
.carousel-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Título principal */
.main-title {
    font-size: 3rem;
    color: #ffffff;
    text-align: center;
    margin-bottom: 2rem;
    text-shadow:
        0 0 40px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(0, 0, 0, 0.8),
        2px 2px 8px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(78, 205, 196, 0.4);
    font-weight: bold;
    position: relative;
    z-index: 2;
    background: none;
    -webkit-text-fill-color: #ffffff;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow:
            0 0 40px rgba(0, 0, 0, 0.9),
            0 0 20px rgba(0, 0, 0, 0.8),
            2px 2px 8px rgba(0, 0, 0, 0.7),
            0 0 60px rgba(78, 205, 196, 0.4);
    }
    to {
        text-shadow:
            0 0 50px rgba(0, 0, 0, 0.9),
            0 0 30px rgba(0, 0, 0, 0.8),
            3px 3px 10px rgba(0, 0, 0, 0.7),
            0 0 80px rgba(78, 205, 196, 0.6);
    }
}

/* Subtítulo */
.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.5);
    font-weight: 300;
    position: relative;
    z-index: 2;
}

/* Carrusel 3D */
.carousel-3d {
    position: relative;
    width: 450px;
    height: 600px;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin: 2rem 0;
}

/* Tarjetas del carrusel */
.card {
    position: absolute;
    width: 420px;
    height: 580px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(25px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.6s ease;
    transform-style: preserve-3d;
}

.card.active {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 50px rgba(78, 205, 196, 0.3);
    border-color: rgba(78, 205, 196, 0.5);
}

/* Indicador de que la tarjeta es clickeable */
.card.active:not(.flipped)::after {
    content: "Haz clic para más información";
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-size: 0.8rem;
    opacity: 0;
    animation: fadeInOut 3s ease-in-out infinite;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.9; }
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

/* Interior de la tarjeta */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

/* Cara frontal y trasera */
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    overflow-y: auto;
}

.card-front {
    justify-content: center;
}

/* Área específica para hacer flip */
.flip-area {
    cursor: pointer;
    padding: 1rem;
    border-radius: 15px;
    transition: background 0.3s ease;
    width: 100%;
    text-align: center;
}

.flip-area:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Botón de cerrar en la cara trasera */
.close-area {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: white;
    transition: all 0.3s ease;
    z-index: 1000;
}

.close-area:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.9), rgba(69, 183, 209, 0.9));
}

/* Hacer que el botón esté más arriba visualmente */
.card-back .link-container {
    order: -1;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Iconos de las tarjetas */
.card-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Títulos de las tarjetas */
.card h2 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.card h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Párrafos */
.card p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

/* Listas en la cara trasera */
.card-back ul {
    list-style: none;
    margin: 1.5rem 0;
    width: 100%;
}

.card-back li {
    padding: 0.7rem 0;
    color: #fff;
    position: relative;
    padding-left: 1.8rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.card-back li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #4ecdc4;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Estadísticas de la tarjeta */
.card-stats {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-weight: bold;
    color: #fff;
    font-size: 1.1rem;
}

/* Descripción de la tarjeta */
.card-description {
    margin-top: 1rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid rgba(255, 255, 255, 0.5);
}

.card-description p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    margin: 0;
    font-style: italic;
}

/* Botón de enlace a la empresa */
.company-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 1.2rem 2.5rem;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white !important;
    text-decoration: none !important;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 1 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    width: 100%;
    text-align: center;
    min-height: 60px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-sizing: border-box;
}

.company-link:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.6);
    background: linear-gradient(135deg, #44a08d, #4ecdc4);
    color: white !important;
    border-color: rgba(255, 255, 255, 0.8);
}

.company-link:active {
    transform: translateY(0) scale(1.02);
}

.company-link:visited {
    color: white !important;
}

/* Asegurar que el botón sea completamente clickeable */
.company-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

/* Contenedor de enlaces */
.link-container {
    margin-top: 1.5rem;
    padding: 0.5rem;
    pointer-events: none;
    z-index: 1 !important;
    position: relative;
    background: rgba(78, 205, 196, 0.2);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(78, 205, 196, 0.5);
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
}

.link-container:hover {
    background: rgba(78, 205, 196, 0.3);
}

/* Asegurar que el enlace tenga prioridad */
.link-container .company-link {
    pointer-events: auto !important;
    z-index: 10 !important;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
    }
}

/* Área de protección alrededor del enlace */
.company-link::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    z-index: -1;
}

/* Controles de navegación */
.controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.control-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.control-btn span:first-child,
.control-btn span:last-child {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Contador de tarjetas */
.card-counter {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 25px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

/* Panel de información */
.info-panel {
    
    bottom: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .background-video {
        object-fit: cover;
        object-position: center;
    }

    .video-overlay {
        background: linear-gradient(
            135deg,
            rgba(30, 60, 114, 0.8) 0%,
            rgba(42, 82, 152, 0.7) 25%,
            rgba(78, 205, 196, 0.5) 50%,
            rgba(69, 183, 209, 0.6) 75%,
            rgba(30, 60, 114, 0.8) 100%
        );
    }

    .main-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .subtitle {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .carousel-3d {
        width: 350px;
        height: 500px;
    }

    .card {
        width: 320px;
        height: 480px;
    }
    
    .card-front, .card-back {
        padding: 1.5rem;
    }

    .company-link {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .card-icon {
        font-size: 3rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .control-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .info-panel {
        bottom: 1rem;
        padding: 0 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .background-video {
        object-fit: cover;
        object-position: center center;
    }

    .video-overlay {
        background: linear-gradient(
            135deg,
            rgba(30, 60, 114, 0.85) 0%,
            rgba(42, 82, 152, 0.75) 25%,
            rgba(78, 205, 196, 0.55) 50%,
            rgba(69, 183, 209, 0.65) 75%,
            rgba(30, 60, 114, 0.85) 100%
        );
    }

    .carousel-3d {
        width: 280px;
        height: 400px;
    }

    .card {
        width: 260px;
        height: 380px;
    }
    
    .card-front, .card-back {
        padding: 1rem;
    }

    .company-link {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        margin-top: 1rem;
    }

    .card.active:not(.flipped)::after {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
        bottom: -30px;
    }
    
    .card-icon {
        font-size: 2.5rem;
    }
    
    .card h2 {
        font-size: 1.3rem;
    }
    
    .card h3 {
        font-size: 1.2rem;
    }
    
    .main-title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
}
