/* ==========================================================================
   COMPONENTE: HERO PHONE INTERACTIVO
   ========================================================================== */

:root {
    --phone-bg: #fdfdfd;
    --primary: #6A38E3;
    --primary-light: rgba(106, 56, 227, 0.08);
    --text-dark: #2D2D2D;
    --text-muted: #777777;
    --border-color: #f2f2f2;
}

/* Contenedor Principal (Soporta los iconos flotando a los lados) */
.hero-phone-container {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Teléfono y Animación de Flotado */
.phone-mockup {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    transform-style: preserve-3d;
    overflow: visible;
    transform: perspective(800px) rotateX(10deg) rotateY(-16deg) rotateZ(10deg);
    animation: float 6s ease-in-out infinite;
}

/* Luz de brillo morado pulsante alrededor del cuerpo físico del teléfono */
.phone-glow {
    position: absolute;
    top: 13.8%;
    left: 24.6%;
    width: 50.4%;
    height: 70.8%;
    border-radius: 36px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(106, 56, 227, 0.35);
    animation: purpleGlow 2.5s ease-in-out infinite alternate;
}

/* Sombra proyectada dinámica */
.phone-shadow {
    position: absolute;
    bottom: 30px;
    left: 23%;
    width: 54%;
    height: 12px;
    background: rgba(106, 56, 227, 0.15); /* Sombra morada que complementa el brillo */
    border-radius: 50%;
    filter: blur(6px);
    z-index: 1;
    animation: shadowFloat 6s ease-in-out infinite;
    pointer-events: none;
    transform: rotate(10deg);
}

/* Marco del Teléfono (en la capa superior) */
.phone-frame-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 10;
    pointer-events: none; /* Permite clicks en la pantalla de abajo */
}

/* Pantalla del Teléfono (Detrás del marco, calzada exactamente en el corte transparente) */
.phone-screen {
    position: absolute;
    top: 14.5%;
    left: 25.4%;
    width: 49.2%;
    height: 69.6%;
    background-color: var(--phone-bg);
    border-radius: 24px;
    overflow: hidden;
    z-index: 5;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.03);
    font-family: 'Poppins', sans-serif;
}

/* ==========================================================================
   ELEMENTOS DE LA INTERFAZ
   ========================================================================== */

/* Barra Superior / Header de la App (Ajustado para respirar mejor y evitar el notch) */
.phone-app-header {
    height: 46px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end; /* Alinea los elementos al fondo del header */
    justify-content: space-between;
    padding: 0 0.7rem 8px 0.7rem; /* Mayor padding superior/inferior para respirar */
    flex: 0 0 auto;
    z-index: 8;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.back-arrow {
    font-size: 0.7rem;
    color: var(--text-dark);
    font-weight: bold;
    margin-bottom: 2px;
}

.phone-app-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
    display: block;
}

.phone-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    width: 13px;
    height: 9px;
    justify-content: space-between;
    margin-bottom: 6px; /* Lo alinea exactamente a la altura del logo */
}

.phone-menu-toggle span {
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: var(--text-dark);
    border-radius: 1px;
}

/* Vista Base del Producto */
.product-base-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    background: #fcfcfc;
    transition: opacity 0.25s ease-in-out; /* Transición suave para cambio de producto */
}

.product-base-view.fade-out {
    opacity: 0;
}

.product-image-container {
    height: 100px;
    flex: 0 0 100px;
    background: #fafaf8;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.active-product-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(1.15); /* Zoom suave para ocupar mejor el recuadro */
}

.product-details {
    padding: 0 2px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.product-status-tag {
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 5px;
    border-radius: 20px;
    margin-bottom: 2px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.product-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 2px 0;
    letter-spacing: -0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.product-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}

.product-stock {
    font-size: 0.55rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   CAPAS DE ESTADO (OVERLAYS)
   ========================================================================== */

.screen-layer {
    position: absolute;
    top: 46px; /* Justo debajo del nuevo header */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    
    /* Transiciones suaves y rápidas (250-350ms) */
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tarjetas base de los Overlays (Sombras más suaves y profundas) */
.ia-overlay-card,
.status-overlay-card,
.reserve-overlay-card,
.timer-overlay-card,
.shipped-overlay-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02); /* Sombras suavizadas */
    padding: 0.6rem;
    width: 100%;
    max-width: 130px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;

    /* Animación de Entrada del Contenido de la Tarjeta */
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Estado Activo en la pantalla */
.phone-screen[data-state="2"] #layer-state-2,
.phone-screen[data-state="3"] #layer-state-3,
.phone-screen[data-state="4"] #layer-state-4,
.phone-screen[data-state="5"] #layer-state-5,
.phone-screen[data-state="6"] #layer-state-6 {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Activa la animación interna de la tarjeta con un ligero desfase */
.phone-screen[data-state="2"] .ia-overlay-card,
.phone-screen[data-state="3"] .status-overlay-card,
.phone-screen[data-state="4"] .reserve-overlay-card,
.phone-screen[data-state="5"] .timer-overlay-card,
.phone-screen[data-state="6"] .shipped-overlay-card {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition-delay: 50ms;
}

/* Estado 2: IA Generando Catálogo */
.ia-card-header {
    display: flex;
    align-items: center;
    gap: 4px;
    text-align: left;
}

.ia-pulse-icon {
    font-size: 0.85rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.ia-card-title {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--text-dark);
}

.ia-progress-container {
    width: 100%;
    height: 3px;
    background: #eaeaea;
    border-radius: 10px;
    overflow: hidden;
}

.ia-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 10px;
}

.ia-bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.ia-bullet-item {
    font-size: 0.52rem;
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ia-bullet-item .check-icon {
    color: #2ecc71;
    font-weight: bold;
}

.ia-bullet-item.active {
    opacity: 1;
    transform: translateX(0);
}

/* Estado 3: Producto Publicado */
.status-overlay-card {
    text-align: center;
    align-items: center;
}

.success-circle {
    width: 28px;
    height: 28px;
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.status-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.status-subtitle {
    font-size: 0.52rem;
    color: var(--text-muted);
    margin: 0;
}

/* Estado 4: Cliente Apartó */
.customer-profile {
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
}

.customer-avatar-container {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.customer-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.45); /* Zoom en el rostro */
}

.customer-meta {
    display: flex;
    flex-direction: column;
}

.customer-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.customer-action {
    font-size: 0.5rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
}

.badge-container {
    display: flex;
    justify-content: flex-start;
}

.reserved-status-badge {
    background: #FFF0F0;
    color: #E74C3C;
    border: 1px solid rgba(231, 76, 60, 0.12);
    font-size: 0.48rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.2px;
    display: inline-block;
}

/* Estado 5: Tiempo Restante */
.timer-overlay-card {
    align-items: center;
}

.timer-card-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-dark);
}

.clock-icon {
    font-size: 0.7rem;
    color: #E74C3C;
}

.countdown-timer {
    font-size: 1.4rem;
    font-weight: 700;
    color: #E74C3C;
    font-family: monospace;
    letter-spacing: 0.3px;
    margin: 2px 0;
    animation: pulseGlow 1.2s ease-in-out infinite alternate;
}

.timer-instruction {
    font-size: 0.48rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.2;
}

/* Estado 6: Pedido Enviado */
.shipped-overlay-card {
    text-align: center;
    align-items: center;
}

.wa-success-circle {
    width: 28px;
    height: 28px;
    background: rgba(37, 211, 102, 0.08);
    color: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.shipped-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.wa-badge {
    background: #25D366;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.52rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wa-icon {
    font-size: 0.6rem;
}

/* ==========================================================================
   ICONOS FLOTANTES (ESTILO MAQUETA)
   ========================================================================== */

.floating-icon {
    position: absolute;
    z-index: 12;
    pointer-events: none;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
    user-select: none;
}

/* Estrella izquierda superior */
.icon-star-left {
    left: 10%;
    top: 25%;
    width: 36px;
    animation: floatStar 5.2s ease-in-out infinite;
}

/* Canasta de compras izquierda */
.icon-basket {
    left: 2%;
    top: 46%;
    width: 66px;
    animation: floatBasket 5.8s ease-in-out infinite;
}

/* Estrella derecha superior */
.icon-star-right {
    right: 12%;
    top: 13%;
    width: 30px;
    animation: floatStar 4.8s ease-in-out infinite alternate-reverse;
}

/* Estrella derecha chica */
.icon-star-right-small {
    right: 5%;
    top: 24%;
    width: 20px;
    animation: floatStar 6s ease-in-out infinite;
}

/* Globo de mensaje de corazón a la derecha */
.icon-bubble {
    right: 2%;
    top: 38%;
    width: 62px;
    animation: floatBubble 5.5s ease-in-out infinite;
}

/* ==========================================================================
   KEYFRAMES Y ANIMACIONES
   ========================================================================== */

/* Flotación física del teléfono con inclinación 3D (hacia el lado derecho) */
@keyframes float {
    0% {
        transform: perspective(800px) rotateX(10deg) rotateY(-16deg) rotateZ(10deg) translateY(0);
    }
    50% {
        transform: perspective(800px) rotateX(11deg) rotateY(-15deg) rotateZ(9.5deg) translateY(-8px);
    }
    100% {
        transform: perspective(800px) rotateX(10deg) rotateY(-16deg) rotateZ(10deg) translateY(0);
    }
}

/* Escala y opacidad dinámica de la sombra plana */
@keyframes shadowFloat {
    0% {
        transform: rotate(10deg) scale(1);
        opacity: 0.15;
    }
    50% {
        transform: rotate(10deg) scale(0.9);
        opacity: 0.08;
    }
    100% {
        transform: rotate(10deg) scale(1);
        opacity: 0.15;
    }
}

/* Brillo morado alrededor del teléfono */
@keyframes purpleGlow {
    0% {
        box-shadow: 0 0 10px rgba(106, 56, 227, 0.25), inset 0 0 5px rgba(106, 56, 227, 0.1);
        opacity: 0.8;
    }
    100% {
        box-shadow: 0 0 28px rgba(106, 56, 227, 0.8), inset 0 0 15px rgba(106, 56, 227, 0.25);
        opacity: 1;
    }
}

/* Animaciones de flotación individual de iconos */
@keyframes floatBasket {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(-4deg) scale(1.02); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes floatBubble {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-9px) rotate(3deg) scale(1.03); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes floatStar {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-6px) rotate(8deg) scale(1.06); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

/* Latido de iconos */
@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.15); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
    60% { transform: scale(1); }
    100% { transform: scale(1); }
}

/* Parpadeo sutil para el contador del cronómetro */
@keyframes pulseGlow {
    0% {
        opacity: 0.9;
        text-shadow: 0 0 1px rgba(231, 76, 60, 0.1);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 6px rgba(231, 76, 60, 0.25);
    }
}

/* Media query para móviles (Ajuste de tamaño e inclinación interna de iconos flotantes) */
@media (max-width: 768px) {
    .icon-star-left {
        width: 30px;
    }
    .icon-basket {
        width: 56px;
        left: 8% !important; /* Move inward to avoid clipping */
    }
    .icon-star-right {
        width: 25px;
        right: 14% !important; /* Move inward */
    }
    .icon-star-right-small {
        width: 17px;
        right: 8% !important; /* Move inward */
    }
    .icon-bubble {
        width: 52px;
        right: 8% !important; /* Move inward to avoid clipping (se corta el corazón) */
    }
}
