/* =========================================================================
 * ESTILOS PARA EL MODAL SALÓN DE PREMIOS (VERSIÓN FINAL)
 * MODIFICADO: Añadida una regla para estabilizar la barra de scroll en el
 * contenedor de premios, evitando que aparezca innecesariamente.
 * MODIFICADO: Reestructurado para implementar la animación de enfoque y botones flotantes.
 * MODIFICADO: Posicionado "OBJETIVO FIJADO" en la parte superior.
 * MODIFICADO: Cambiado el texto del letrero a "ARTICULO SELECCIONADO".
 * ========================================================================= */

/* --- 1. Contenedor Principal --- */
.modal--prize-hall-rebuilt .modal__content {
    background: #1a202c;
    border: 2px solid #c0a062;
    box-shadow: 0 0 30px rgba(192, 160, 98, 0.5);
    padding: 0;
    overflow: hidden;
    position: relative;
    width: 90vw;
    max-width: 480px;
    height: 85vh;
    max-height: 600px;
}

/* --- 2. Lógica de Pasos (Superposición) --- */
.ph-step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out, visibility 0.4s;
    visibility: hidden;
}
.ph-step.is-active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* =========================================================================
 * PASO 1: Estilos de layout con Grid
 * ========================================================================= */
#budi-prize-hall-step-1 {
    background: radial-gradient(ellipse at center, #4a3a22, #1a1502);
    padding: clamp(15px, 3vh, 25px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: clamp(10px, 2vh, 15px);
}
.ph-s1-visual {
    grid-row: 1; display: flex; align-items: center; justify-content: center; min-height: 0;
}
.ph-s1-image {
    width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 0 20px #f0c540);
}
.ph-s1-text {
    grid-row: 2; color: #f0e6d2; text-align: center; display: flex;
    flex-direction: column; justify-content: center; overflow: auto;
}
.ph-s1-title {
    color: #ecc94b; font-size: clamp(1.5rem, 5vh, 2.2rem); margin-bottom: 1.5vh;
}
.ph-s1-body {
    font-size: clamp(0.9rem, 2.5vh, 1.1rem); max-width: 45ch; margin: 0 auto; line-height: 1.6;
}
.ph-s1-action {
    grid-row: 3; display: flex; justify-content: center;
}


/* =========================================================================
 * --- INICIO DE LA MODIFICACIÓN ---
 * PASO 2: Layout de 4 Filas con Grid (Reestructurado)
 * ========================================================================= */
#budi-prize-hall-step-2 {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: clamp(15px, 3vh, 30px) clamp(15px, 3vh, 30px) 0;
    background-color: #1a202c;
    gap: 1.5vh;
}

.ph-s2-header {
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

.ph-s2-title {
    text-align: center;
    color: #ecc94b;
    font-size: clamp(1rem, 3vh, 1.2rem);
    text-transform: uppercase;
    line-height: 1.4;
}

/* --- Estilos del Carrusel --- */
.ph-carousel-wrapper {
    position: relative;
    width: 100%;
    flex-grow: 1;
    display: flex;
    align-items: center;
    min-height: 0;
}

.ph-s2-grid-container {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc(25% - (clamp(10px, 2vh, 15px) * 3 / 4));
    gap: clamp(10px, 2vh, 15px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
    height: 100%;
    align-items: center;
    padding: 0 10px;
}
.ph-s2-grid-container::-webkit-scrollbar { display: none; }

.ph-carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(45, 25, 80, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background-color 0.2s, opacity 0.3s, transform 0.3s;
}
.ph-carousel-nav-btn:hover { background-color: rgba(45, 25, 80, 1); }
.ph-carousel-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.ph-carousel-nav-btn svg { width: 24px; height: 24px; }
#budi-ph-carousel-prev-btn { left: -15px; }
#budi-ph-carousel-next-btn { right: -15px; }


/* --- Estilos de las tarjetas de premio --- */
.ph-s2-grid-container .ph-product-card {
    border: 2px solid rgba(192, 160, 98, 0.4); 
    background: rgba(0,0,0,0.2); 
    border-radius: 8px;
    padding: 8px; 
    text-align: center; 
    cursor: pointer; 
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease, opacity 0.4s ease;
    display: flex; 
    flex-direction: column; 
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
    scroll-snap-align: start;
    flex-shrink: 0;
}
.ph-s2-grid-container .ph-product-card:hover { transform: translateY(-5px); border-color: #f0c540; }

.ph-s2-grid-container .ph-product-card img {
    width: 100%;
    flex-grow: 1;
    object-fit: contain;
    margin-bottom: 5px;
    min-height: 0;
}

/* --- Estilos de los Botones Flotantes --- */
.ph-floating-actions-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    padding-bottom: 20px;
    background: linear-gradient(to top, rgba(26, 21, 2, 1) 0%, rgba(26, 21, 2, 0.8) 50%, transparent 100%);
    display: flex;
    gap: 15px;
    justify-content: center;
    z-index: 30;
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* --- Animación de Enfoque y Estados --- */
#budi-prize-hall-step-2.selection-in-progress .ph-carousel-nav-btn,
#budi-prize-hall-step-2.selection-in-progress .ph-s2-header {
    opacity: 0;
    pointer-events: none;
}
#budi-prize-hall-step-2.actions-visible .ph-floating-actions-container {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
#budi-prize-hall-step-2.selection-in-progress .ph-product-card:not(.focused) {
    opacity: 0.2;
    filter: blur(2px);
    pointer-events: none;
}
.ph-product-card.focused {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40%;
    transform: translate(-50%, -50%) scale(1.5);
    border-color: #f0c540;
    z-index: 10;
    cursor: default;
    animation: pulsating-box-shadow 2s infinite ease-in-out;
}
.ph-product-card.focused img {
    animation: pulsating-image 2s infinite ease-in-out;
}
.ph-product-card.focused::after {
    /* --- INICIO DE LA MODIFICACIÓN --- */
    content: 'ARTICULO SELECCIONADO';
    /* --- FIN DE LA MODIFICACIÓN --- */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(236, 201, 75, 0.9);
    color: #150d21;
    font-size: 0.5em;
    font-weight: bold;
    text-align: center;
    padding: 4px 0;
    animation: fadeIn 0.4s;
    z-index: 2;
}
/* --- FIN DE LA MODIFICACIÓN --- */

/* --- Botones --- */
#budi-prize-hall-goto-step2, #budi-prize-hall-confirm-btn {
    width: auto; padding: 1.5vh 3vh; font-size: clamp(0.9rem, 2.5vh, 1.2rem);
    animation: button-pulse-yellow 2s infinite ease-in-out;
}
.ph-floating-actions-container .btn {
    flex-grow: 1;
    max-width: 300px;
}


/* =========================================================================
 * VISTA HORIZONTAL
 * ========================================================================= */
@media (orientation: landscape) {
    .modal--prize-hall-rebuilt .modal__content {
        width: 90vw;
        max-width: 850px;
        height: 80vh; 
        max-height: 550px; 
    }
    #budi-prize-hall-step-1 {
        grid-template-columns: 45% 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas: "visual text" "visual action";
        align-items: center;
    }
    .ph-s1-visual { grid-area: visual; height: 100%; }
    .ph-s1-text   { grid-area: text; }
    .ph-s1-action { grid-area: action; }
    
    .ph-product-card.focused {
        width: 25%;
        transform: translate(-50%, -50%) scale(1.8);
    }
}

/* --- Animaciones (Keyframes) --- */
@keyframes button-pulse-yellow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(236, 201, 75, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(236, 201, 75, 0.8); }
}

/* --- INICIO DE LA MODIFICACIÓN --- */
@keyframes pulsating-box-shadow {
    0%, 100% { box-shadow: 0 0 20px rgba(240, 197, 64, 0.7); }
    50% { box-shadow: 0 0 35px rgba(240, 197, 64, 1); }
}
@keyframes pulsating-image {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* --- FIN DE LA MODIFICACIÓN --- */