/* 🎨 Sistema de Banners Inteligentes - CSS de Integración
   Fecha: 2025-01-30
   Descripción: Estilos para banners dinámicos en páginas del cliente
*/

/* Variables CSS para consistencia con el tema de Bonafide */
:root {
    --bonafide-primary: #ab182d;
    --bonafide-secondary: #2C3E50;
    --bonafide-accent: #E74C3C;
    --bonafide-light: #F8F9FA;
    --bonafide-dark: #495057;
    --banner-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --banner-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --banner-radius: 15px;
    --banner-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Contenedores base para banners */
.banner-container {
    margin: 20px 0;
    position: relative;
    z-index: 10;
}

.banner-item {
    border-radius: var(--banner-radius);
    overflow: hidden;
    box-shadow: var(--banner-shadow);
    transition: var(--banner-transition);
    cursor: pointer;
    position: relative;
    margin-bottom: 20px;
    background: white;
}

.banner-item--image-only {
    background: transparent !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
}

.banner-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--banner-shadow-hover);
    z-index: 20;
}

/* Contenido del banner */
.banner-content {
    padding: 25px;
    display: flex;
    align-items: center;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.banner-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--bonafide-primary), var(--bonafide-accent));
    z-index: 1;
}

/* Imagen del banner */
.banner-image {
    max-width: 200px;
    max-height: 120px;
    object-fit: contain;
    margin-right: 25px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--banner-transition);
}

.banner-image:hover {
    transform: scale(1.05);
}

/* Contenido de texto */
.banner-text {
    flex: 1;
    z-index: 2;
    position: relative;
}

.banner-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.4rem;
    line-height: 1.3;
    color: inherit;
    font-family: 'Roboto', sans-serif;
}

.banner-subtitle {
    opacity: 0.85;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    color: inherit;
}

.banner-description {
    opacity: 0.75;
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.5;
    color: inherit;
}

.banner-custom-text {
    font-style: italic;
    margin: 15px 0;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 3px solid currentColor;
}

/* Precios */
.banner-price {
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 10px;
}

.banner-price-original {
    text-decoration: line-through;
    opacity: 0.6;
    margin-right: 10px;
    font-size: 1rem;
}

.banner-price-special {
    color: var(--bonafide-accent);
    font-size: 1.3rem;
    font-weight: 800;
}

/* Posiciones específicas */
.banner-superior {
    margin-bottom: 35px;
}

.banner-medio {
    margin: 35px 0;
}

.banner-inferior {
    margin-top: 35px;
}

/* Banner flotante */
.banner-floating {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
    max-width: 350px;
    animation: slideInRight 0.6s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.banner-floating .banner-content {
    padding: 20px;
    min-height: auto;
}

.banner-floating .banner-image {
    max-width: 80px;
    max-height: 80px;
    margin-right: 15px;
}

.banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--banner-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

/* Estilos por tipo de banner */
.banner-tipo-index {
    background: linear-gradient(135deg, var(--bonafide-primary) 0%, #c41e3a 100%);
    color: white;
}

.banner-tipo-categoria {
    background: linear-gradient(135deg, var(--bonafide-secondary) 0%, #34495e 100%);
    color: white;
}

.banner-tipo-promocional {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.banner-tipo-novedad {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.banner-tipo-producto_destacado {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

/* Efectos y animaciones */
.banner-fade {
    animation: fadeInBanner 1s ease-in-out;
}

.banner-slide {
    animation: slideInBanner 0.6s ease-out;
}

.banner-zoom {
    animation: zoomInBanner 0.6s ease-out;
}

.banner-pulse {
    animation: pulseBanner 2.5s infinite;
}

.banner-bounce {
    animation: bounceBanner 1s ease-out;
}

/* Keyframes para animaciones */
@keyframes fadeInBanner {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInBanner {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes zoomInBanner {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulseBanner {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes bounceBanner {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-12px); }
    60% { transform: translateY(-6px); }
}

/* Integración específica con Bonafide */
.banner-bonafide-theme {
    border: 2px solid var(--bonafide-primary);
    background: white;
    color: var(--bonafide-dark);
}

.banner-bonafide-theme .banner-title {
    color: var(--bonafide-primary);
}

.banner-bonafide-theme .banner-subtitle {
    color: var(--bonafide-secondary);
}

/* Responsive Design */
@media (max-width: 992px) {
    .banner-content {
        padding: 20px;
        min-height: 100px;
    }
    
    .banner-image {
        max-width: 150px;
        max-height: 100px;
        margin-right: 20px;
    }
    
    .banner-title {
        font-size: 1.25rem;
    }
    
    .banner-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .banner-content {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    
    .banner-image {
        margin-right: 0;
        margin-bottom: 15px;
        max-width: 120px;
        max-height: 80px;
    }
    
    .banner-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .banner-subtitle {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .banner-description {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .banner-floating {
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
    }
    
    .banner-floating .banner-content {
        padding: 15px;
        flex-direction: row;
        text-align: left;
    }
    
    .banner-floating .banner-image {
        margin-bottom: 0;
        margin-right: 15px;
    }
}

@media (max-width: 576px) {
    .banner-container {
        margin: 15px 0;
    }
    
    .banner-content {
        padding: 15px;
        min-height: 80px;
    }
    
    .banner-image {
        max-width: 80px;
        max-height: 60px;
        margin-bottom: 10px;
    }
    
    .banner-title {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .banner-subtitle {
        font-size: 0.9rem;
    }
    
    .banner-description {
        font-size: 0.8rem;
    }
    
    .banner-price {
        font-size: 1rem;
    }
    
    .banner-price-special {
        font-size: 1.1rem;
    }
    
    .banner-floating {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
}

/* Estados especiales */
.banner-loading {
    opacity: 0.7;
    pointer-events: none;
}

.banner-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: var(--bonafide-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Compatibilidad con dark mode (futuro) */
@media (prefers-color-scheme: dark) {
    .banner-item {
        box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    }
    
    .banner-item:hover {
        box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
    }
}

/* Accesibilidad */
.banner-item:focus {
    outline: 3px solid var(--bonafide-primary);
    outline-offset: 2px;
}

.banner-item:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles */
@media print {
    .banner-floating {
        display: none;
    }
    
    .banner-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Mejoras de performance */
.banner-image {
    will-change: transform;
}

.banner-item {
    will-change: transform, box-shadow;
}

/* Integración con sistema existente de Bonafide */
.container .banner-container,
.container-fluid .banner-container {
    max-width: none;
}

/* Ajustes específicos para páginas de categorías */
.categorias-grid + .banner-container {
    margin-top: 40px;
}

.banner-container + .categorias-grid {
    margin-top: 40px;
}

/* Ajustes para index */
.jumbotron + .banner-container,
.hero-section + .banner-container {
    margin-top: 50px;
}

/* Evitar conflictos con modales existentes */
.modal-backdrop + .banner-floating {
    z-index: 1040;
}

/* 🏠 Estilos específicos para banners del INDEX */
.banners-index-wrapper {
    width: 100%;
    margin: 0;
    background: transparent !important;
}

/* Cuando el wrapper contiene solo banners de imagen, eliminar padding */
.banners-index-wrapper--full-width {
    padding: 0;
}

.banners-index-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(24px, 6vw, 56px);
    background: transparent !important;
}

.banners-index-section .banner-item {
    width: 100%;
    padding: clamp(32px, 7vw, 96px) 0;
    transition: var(--banner-transition);
}

.banners-index-section .banner-item-inner {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: clamp(20px, 5vw, 72px);
}

.banners-index-section .banner-media {
    flex: 0 0 clamp(280px, 36%, 480px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banners-index-section .banner-image {
    width: 100%;
    height: auto;
    max-height: clamp(240px, 45vw, 520px);
    object-fit: contain;
}

.banner-item--image-only {
    padding: 0 !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative !important;
    max-width: 100vw !important;
}

/* Eliminar padding del wrapper cuando contiene banners de solo imagen */
.banners-index-wrapper--full-width {
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

/* Asegurar que el contenedor de banners también se extienda */
.banners-index-wrapper--full-width .banners-index-section {
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

/* Forzar ancho completo para banners de solo imagen */
.banners-index-wrapper .banner-item--image-only {
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    max-width: 100vw !important;
}

.banner-item--image-only .banner-image-full {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    max-height: none !important;
    object-fit: cover !important;
    max-width: 100vw !important;
}

.banners-index-section .banner-content {
    flex: 1;
    padding: clamp(24px, 5vw, 52px) clamp(20px, 6vw, 64px);
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2.4vw, 28px);
}

.banners-index-section .banner-title {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.banners-index-section .banner-subtitle {
    margin: 0;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: rgba(15, 23, 42, 0.72);
}

.banners-index-section .banner-description {
    margin: 0;
    color: rgba(15, 23, 42, 0.75);
    line-height: 1.65;
}

.banners-index-section .banner-extra {
    color: rgba(15, 23, 42, 0.6);
    font-style: italic;
}

.banners-index-section .banner-pricing {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.banners-index-section .banner-price-regular {
    font-size: 1rem;
    color: rgba(15, 23, 42, 0.45);
    text-decoration: line-through;
}

.banners-index-section .banner-price-highlight {
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    font-weight: 700;
}

.banners-index-section .banner-cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: var(--banner-transition);
}

.banners-index-section .banner-cta:hover {
    transform: translateY(-2px);
    color: #fff;
}

@media (max-width: 992px) {
    .banners-index-section .banner-item {
        padding: clamp(20px, 12vw, 40px) 0;
    }

    .banners-index-section .banner-item-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: clamp(16px, 6vw, 32px);
    }

    .banners-index-section .banner-media {
        width: 100%;
        justify-content: flex-start;
    }

    .banners-index-section .banner-content {
        padding: clamp(20px, 8vw, 40px) clamp(18px, 6vw, 32px);
    }

    .banners-index-section .banner-cta {
        align-self: stretch;
        justify-content: center;
    }

    /* Estilos específicos para banners de solo imagen en móviles */
    .banner-item--image-only {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding: 10px 0 !important;
    }
}
