/* Reseteo básico y variables corporativas */
:root {
    --cyan: #40C4D4;
    --pink: #FF4094;
    --bg-dark: #333333;
    --bg-light: #FDFDF4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Quicksand', sans-serif;
}

body {
    background-color: var(--bg-light); /* Fondo genérico para cuando se ve en móvil/tablet */
    overflow: hidden; /* Evita que la página principal haga scroll, el scroll ocurre DENTRO del iframe */
}

/* BARRA SUPERIOR */
.preview-header {
    height: 60px;
    background-color: var(--bg-dark); /* Color corporativo oscuro */
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 320px; /* Ancho fijo para centrar simétricamente el selector de dispositivos */
}

.header-right {
    justify-content: flex-end;
}

/* Logo Corporativo */
.logo-container { display: flex; align-items: center; }
.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cyan);
    letter-spacing: -1px;
    line-height: 1;
    display: flex;
    align-items: center;
}
.bouncing-ball {
    width: 14px; height: 14px;
    background: var(--pink);
    border-radius: 50%;
    position: absolute;
    top: -6px; left: 50%;
    transform: translateX(-50%);
    animation: breathe 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 64, 148, 0.6);
}
@keyframes breathe {
    0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 0 10px rgba(255, 64, 148, 0.6); }
    50%       { transform: translateX(-50%) scale(1.15); box-shadow: 0 0 15px rgba(255, 64, 148, 0.9); }
}

/* BOTONES Y LLAMADA A LA ACCIÓN */
a, button {
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    transition: all 0.3s ease;
}

.btn-back, .btn-close {
    color: white;
    opacity: 0.7;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back:hover, .btn-close:hover {
    color: var(--cyan);
    opacity: 1;
}

.btn-close {
    font-size: 1.2rem;
}

.btn-cta {
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    color: white;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 64, 148, 0.3);
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 64, 148, 0.5);
}

/* SELECTOR DE DISPOSITIVOS */
.device-switcher {
    display: flex;
    gap: 8px;
    background-color: #222;
    padding: 5px;
    border-radius: 10px;
}

.device-btn {
    width: 45px;
    height: 38px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 1.2rem;
}

.device-btn:hover {
    color: white;
}

.device-btn.active {
    background-color: #444;
    color: var(--cyan);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* CONTENEDOR DEL IFRAME */
.iframe-wrapper {
    height: calc(100vh - 60px); /* 100% menos la cabecera */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center; /* Asegura el centrado vertical del dispositivo */
    background: radial-gradient(circle, #e5e7eb 1px, var(--bg-light) 1px);
    background-size: 30px 30px;
}

.iframe-container {
    height: 100%;
    width: 100%;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* Animación suave */
    background-color: white;
    display: flex;
    flex-direction: column;
}

/* Tamaños de Dispositivos simulados */
.iframe-container.desktop { 
    width: 100%; 
    height: 100%;
}

.iframe-container.tablet { 
    width: 768px; 
    height: calc(100% - 60px); /* Deja margen arriba y abajo */
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15); 
    border: 12px solid #222; /* Borde de tablet oscura */
    overflow: hidden;
}

.iframe-container.mobile { 
    width: 375px; 
    height: calc(100% - 60px);
    border-radius: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25); 
    border: 16px solid #222; /* Borde de móvil */
    overflow: hidden;
}

/* RESPONSIVIDAD DE LA CABECERA */
@media (max-width: 1024px) {
    .header-left, .header-right {
        width: auto;
        flex: 1;
    }
    
    /* En Tablet, ocultamos los botones de Desktop y Tablet según la lógica: 
       "si estoy en tablet que aparezca solo el de móvil" */
    .device-btn[data-device="desktop"],
    .device-btn[data-device="tablet"] {
        display: none;
    }
}

@media (max-width: 768px) {
    .preview-header {
        padding: 0 10px;
        gap: 10px;
    }

    .header-left {
        gap: 10px;
    }

    .btn-back {
        font-size: 0; /* Oculta el texto, deja solo el icono */
    }
    
    .btn-back i {
        font-size: 1.2rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    /* En móvil ocultamos todo el menú de dispositivos */
    .device-switcher {
        display: none;
    }

    .btn-cta {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .header-right {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .btn-cta {
        display: none; /* Ocultamos el CTA en móviles muy pequeños para dar espacio al logo y cerrar */
    }
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white;
}
