/* YGB Ofertas Popup */
.ygb-ofertas-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.popup-container {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation-duration: 0.4s;
    animation-fill-mode: both;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent !important;
    background-color: transparent !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    transition: color 0.3s ease;
    z-index: 10;
    line-height: 1;
    padding: 0;
}

.popup-close:hover {
    color: #ff0000;
    background: transparent !important;
    background-color: transparent !important;
}

.popup-close span {
    line-height: 1;
    display: block;
}

.popup-content {
    padding: 30px;
}

.popup-image {
    text-align: center;
    line-height: 0;
}

/* ------------------------------------------------------------------
   MODO PRODUCTO: marco de 300x300 px exactos en escritorio, pegado al
   borde superior del popup. Cero blanco arriba ni abajo.
   ------------------------------------------------------------------ */
.ygb-ofertas-popup.ygb-type-product .popup-image {
    width: 300px;
    height: 300px;
    margin: -30px auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
}

.ygb-ofertas-popup.ygb-type-product .popup-image img {
    display: block !important;
    width: 300px !important;
    height: 300px !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    border-radius: 0;
}

/* ------------------------------------------------------------------
   MODO IMAGEN: tamano natural, limitado al ancho en pixeles del popup.
   ------------------------------------------------------------------ */
.ygb-ofertas-popup.ygb-type-image .popup-image {
    margin: -30px -30px 20px -30px;
    line-height: 0;
    text-align: center;
}

.ygb-ofertas-popup.ygb-type-image .popup-image img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: var(--ygb-popup-width, 500px) !important;
    max-height: none !important;
    object-fit: contain !important;
    aspect-ratio: auto !important;
    margin: 0 auto !important;
    border-radius: 8px 8px 0 0;
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.popup-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: inherit;
}

.popup-discount-badge {
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 18px;
}

.popup-product {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
}

.product-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 500;
}

.product-description {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-sale {
    font-size: 24px;
    font-weight: bold;
    color: #ff0000;
}

.price-regular {
    font-size: 16px;
    text-decoration: line-through;
    color: #ff0000;
}

.popup-description {
    margin-bottom: 20px;
    text-align: center;
}

.popup-actions {
    text-align: center;
}

.popup-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.popup-button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.popup-footer {
    margin-top: 15px;
    text-align: center;
}

.popup-close-link {
    background: none;
    border: none;
    color: #999;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
}

.popup-close-link:hover {
    color: #666;
}

/* Animaciones */
@keyframes popupFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popupSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

@keyframes popupZoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.popup-fade .popup-container  { animation-name: popupFadeIn; }
.popup-slide .popup-container { animation-name: popupSlideIn; }
.popup-zoom .popup-container  { animation-name: popupZoomIn; }

/* Responsive */
@media (max-width: 768px) {
    .popup-content {
        padding: 20px;
    }

    .popup-title {
        font-size: 20px;
    }

    .price-sale {
        font-size: 20px;
    }

    .popup-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .popup-close {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 22px;
    }

    /* ------------------------------------------------------------------
       MODO PRODUCTO en movil:
       - Alto fijo de 250 px.
       - Ancho adaptado al hueco disponible del popup.
       - 5 px de aire arriba para que la imagen no quede pegada al borde
         superior (muchas fotos de producto no llevan margen propio).
       - La imagen se centra y mantiene su proporcion sin recortarse.
       ------------------------------------------------------------------ */
    .ygb-ofertas-popup.ygb-type-product .popup-image {
        width: 100%;
        height: 250px;
        margin: -20px 0 15px 0;
        padding-top: 5px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        background: #ffffff;
    }

    .ygb-ofertas-popup.ygb-type-product .popup-image img {
        display: block !important;
        width: auto !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
        border-radius: 0;
    }

    /* Modo imagen en movil: limitamos al hueco disponible. */
    .ygb-ofertas-popup.ygb-type-image .popup-image {
        margin: -20px -20px 15px -20px;
    }

    .ygb-ofertas-popup.ygb-type-image .popup-image img {
        max-width: calc(90vw - 40px) !important;
    }
}

/* ------------------------------------------------------------------
   Accesibilidad: respeto por "prefers-reduced-motion".
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .popup-container {
        animation: none !important;
    }

    .popup-close,
    .popup-close-link,
    .popup-button {
        transition: none !important;
    }

    .popup-button:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}