/**
 * Animated Banner Pro - Frontend Styles
 */

/* Banner Container Base */
.abp-banner-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    margin: 20px auto;
}

/* Contenedor principal cuando tiene texto */
.abp-banner-wrapper.has-overlay-text {
    display: flex;
    flex-direction: column;
}

/* Contenedor de imagen */
.abp-banner-image-container {
    position: relative;
}

/* Formas del banner */
.abp-shape-rectangular {
    border-radius: 0;
}

.abp-shape-rounded {
    border-radius: 15px;
}

.abp-shape-circular {
    border-radius: 50%;
}

/* Botón de cerrar */
.abp-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 20;
}

.abp-close-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Animaciones */
@keyframes swing {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes vibrate {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.abp-animation-swing {
    animation: swing 3s ease-in-out infinite;
    transform-origin: center top;
}

.abp-animation-vibrate {
    animation: vibrate 0.3s linear infinite;
}

.abp-animation-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.abp-animation-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Popup Container */
.abp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: none;
    animation: fadeIn 0.3s ease;
}

.abp-popup-container {
    position: fixed;
    z-index: 100000;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    animation: slideIn 0.5s ease;
    max-width: 90vw;
    max-height: 90vh;
}

/* Posiciones del popup */
.abp-popup-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.abp-popup-bottom-left {
    bottom: 20px;
    left: 20px;
}

.abp-popup-bottom-right {
    bottom: 20px;
    right: 20px;
}

.abp-popup-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.abp-popup-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Imagen responsiva dentro del popup */
.abp-popup-container .abp-banner-wrapper {
    position: relative;
    display: block;
}

.abp-popup-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Botón de cerrar popup */
.abp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.abp-popup-close:hover {
    background: rgba(255, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Texto Superpuesto Base */
.abp-overlay-text {
    padding: 15px 25px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 5;
    animation: fadeInText 0.8s ease;
    width: 100%;
    box-sizing: border-box;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Texto FUERA de la imagen (arriba o abajo) */
.abp-overlay-text.abp-text-outside {
    position: static;
    margin: 0;
    border-radius: 0;
}

/* Texto ARRIBA de la imagen */
.abp-overlay-text.abp-text-top {
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
}

/* Texto ABAJO de la imagen */
.abp-overlay-text.abp-text-bottom {
    margin-top: 0;
    border-radius: 0 0 8px 8px;
}

/* Texto en el CENTRO (superpuesto) */
.abp-overlay-text.abp-text-center {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
}

/* Ajustar bordes de imagen cuando hay texto */
.text-position-top .abp-banner-image-container img {
    border-radius: 0 0 8px 8px;
}

.text-position-bottom .abp-banner-image-container img {
    border-radius: 8px 8px 0 0;
}

/* Tamaños del texto */
.abp-text-small {
    font-size: 14px;
    padding: 10px 20px;
}

.abp-text-medium {
    font-size: 18px;
    padding: 15px 25px;
}

.abp-text-large {
    font-size: 24px;
    padding: 20px 30px;
}

.abp-text-xlarge {
    font-size: 32px;
    padding: 25px 35px;
}

/* Efectos hover */
.abp-banner-wrapper:hover .abp-overlay-text {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.abp-banner-wrapper:hover .abp-text-center {
    transform: translateY(-50%) scale(1.02);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para popups */
.abp-popup-container .abp-overlay-text.abp-text-outside {
    max-width: 100%;
}

/* Ajustes para formas específicas */
.abp-shape-circular .abp-overlay-text.abp-text-outside {
    display: none; /* Ocultar texto fuera en banners circulares */
}

.abp-shape-circular .abp-overlay-text.abp-text-center {
    display: block;
    border-radius: 50%;
    max-width: 80%;
    margin: 0 auto;
    left: 10%;
    right: 10%;
}

.abp-shape-rounded .abp-overlay-text {
    border-radius: 8px;
}

/* Cerrar con animación */
.abp-closing {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Efectos especiales para fechas (Navidad, San Valentín) */
.abp-snowflake,
.abp-heart {
    position: absolute;
    top: -20px;
    animation: fall 10s linear infinite;
    pointer-events: none;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

.abp-christmas-special {
    border: 2px solid #ff0000;
}

.abp-valentine-special {
    border: 2px solid #ff69b4;
}

/* Responsive */
@media (max-width: 768px) {
    .abp-banner-wrapper {
        max-width: 100%;
        height: auto;
    }
    
    .abp-banner-wrapper img {
        width: 100%;
        height: auto;
    }
    
    .abp-popup-container {
        max-width: 95vw;
        max-height: 80vh;
    }
    
    .abp-popup-bottom-left,
    .abp-popup-bottom-right {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
    }
    
    /* Texto responsive */
    .abp-text-small {
        font-size: 12px;
        padding: 8px 15px;
    }
    
    .abp-text-medium {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .abp-text-large {
        font-size: 18px;
        padding: 15px 25px;
    }
    
    .abp-text-xlarge {
        font-size: 24px;
        padding: 20px 30px;
    }
}

/* Estilos adicionales para mejorar compatibilidad */
.abp-banner-wrapper * {
    box-sizing: border-box;
}

/* Z-index para asegurar que el popup esté sobre todo */
.abp-popup-overlay,
.abp-popup-container {
    z-index: 999999 !important;
}

/* Prevenir scroll cuando el popup está abierto */
body.abp-popup-open {
    overflow: hidden;
}

/* Transiciones suaves */
.abp-banner-wrapper,
.abp-overlay-text,
.abp-close-button,
.abp-popup-close {
    transition: all 0.3s ease;
}

/* Asegurar que las imágenes no se deformen */
.abp-banner-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fix para IE11 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .abp-popup-center {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}