/**
 * UX Upgrade — Tiendas afiliación Hummingbird
 * 10 mejoras: sticky, back-top, breadcrumbs, hover, pagination,
 * smooth scroll, animaciones, búsqueda, mobile, transiciones
 */

/* ==========================================
   1. SMOOTH SCROLL GLOBAL
   ========================================== */
html {
    scroll-behavior: smooth;
}

/* ==========================================
   2. HEADER STICKY MEJORADO
   ========================================== */
.header.js-sticky-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
.header.js-sticky-header.is-scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

/* ==========================================
   3. BREADCRUMBS MEJORADOS
   ========================================== */
.breadcrumb {
    background: #f8f9fa;
    padding: 0.75rem 1.25rem !important;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem !important;
}
.breadcrumb li a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}
.breadcrumb li a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
.breadcrumb li:last-child {
    color: #6b7280;
    font-weight: 500;
}
.breadcrumb li::before {
    color: #9ca3af !important;
}

/* ==========================================
   4. HOVER EN TARJETAS DE PRODUCTO
   ========================================== */
.product-miniature {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}
.product-miniature:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}
.product-miniature__image-container {
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}
.product-miniature__image {
    transition: transform 0.4s ease;
}
.product-miniature:hover .product-miniature__image {
    transform: scale(1.05);
}
.product-miniature__link {
    text-decoration: none !important;
}
.product-miniature__link:hover .product-miniature__title {
    color: #2563eb !important;
}

/* ==========================================
   5. PAGINACIÓN MEJORADA
   ========================================== */
.pagination--custom {
    gap: 4px;
}
.pagination--custom .page-link {
    border-radius: 8px !important;
    padding: 0.6rem 1rem !important;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid #e5e7eb;
    color: #374151;
    transition: all 0.2s ease;
    min-width: 42px;
    text-align: center;
}
.pagination--custom .page-link:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    transform: translateY(-1px);
}
.pagination--custom .page-item.active .page-link,
.pagination--custom .page-item.current .page-link {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: white !important;
    font-weight: 700;
}
.pagination-number {
    color: #6b7280;
    font-size: 0.9rem;
    align-self: center;
}

/* ==========================================
   6. BARRA DE BÚSQUEDA MEJORADA
   ========================================== */
.search__container input[type="text"],
.search__container input[type="search"] {
    border-radius: 25px !important;
    padding: 0.7rem 1.2rem !important;
    border: 2px solid #e5e7eb !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-size: 0.95rem;
}
.search__container input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15) !important;
    outline: none;
}

/* ==========================================
   7. ANIMACIÓN FADE-IN PRODUCTOS
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.product-miniature {
    animation: fadeInUp 0.5s ease both;
}
.product-miniature:nth-child(1) { animation-delay: 0.05s; }
.product-miniature:nth-child(2) { animation-delay: 0.10s; }
.product-miniature:nth-child(3) { animation-delay: 0.15s; }
.product-miniature:nth-child(4) { animation-delay: 0.20s; }
.product-miniature:nth-child(5) { animation-delay: 0.25s; }
.product-miniature:nth-child(6) { animation-delay: 0.30s; }
.product-miniature:nth-child(7) { animation-delay: 0.35s; }
.product-miniature:nth-child(8) { animation-delay: 0.40s; }
.product-miniature:nth-child(9) { animation-delay: 0.45s; }

/* ==========================================
   8. BOTÓN VOLVER ARRIBA
   ========================================== */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4);
    z-index: 1000;
}
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#back-to-top:hover {
    background: #1d4ed8;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}

/* ==========================================
   9. MEJORAS MOBILE
   ========================================== */
@media (max-width: 767px) {
    .product-miniature:hover {
        transform: none;
        box-shadow: none;
    }
    .pagination--custom .page-link {
        padding: 0.5rem 0.8rem !important;
        min-width: 38px;
    }
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem !important;
    }
}

/* ==========================================
   10. TRANSICIONES GLOBALES + DETALLES
   ========================================== */
a {
    transition: color 0.2s ease;
}
img {
    transition: opacity 0.3s ease;
}
.btn {
    transition: all 0.2s ease;
}
.card, .block-category {
    border-radius: 12px;
}

/* Scrollbar personalizada (escritorio) */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==========================================
   OCULTAR ELEMENTOS VENTA DIRECTA (afiliación)
   ========================================== */
.product-actions__quantity,
.product-actions__button.add,
.product__minimal-quantity { display: none !important; }
.product__prices { display: none !important; }
#product-availability { display: none !important; }
.product__description-short {
    max-height: 150px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}
.product__description-short::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 40px;
    background: linear-gradient(transparent, white);
    pointer-events: none;
}
.product__additional-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #eee;
}
.product__infos .accordion-button:not(.collapsed) {
    background-color: #f8f9fa;
    font-weight: 600;
}
.product-miniature__prices,
.product-miniature__discount-price { display: none !important; }
.product-miniature__infos form { display: none !important; }
.product-miniature .product-flags { display: none !important; }
.product .product-flags { display: none !important; }
