/* Carousel Container - Widget Look */
.provider-carousel-container {
    padding: 25px;
    position: relative;
    margin: 30px auto;
    /* Centered with vertical margin */
    max-width: 1400px;
    /* Expanded width for better screen usage */
    width: 95%;
    /* Use 95% of available width */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Outer shadow for widget feel */
    border: 1px solid #f0f4f8;
}

/* Header & Title */
.provider-carousel-header {
    text-align: center;
    margin-bottom: 25px;
}




.provider-carousel-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1a202c;
    margin: 0;
    display: inline-block;
    position: relative;
    padding-bottom: 10px;
}

.provider-carousel-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 4px;
    background-color: #3182ce;
    border-radius: 2px;
}

.swiper-provider {
    width: 100%;
    padding: 10px 5px 40px 5px;
}

/* Product Card - Professional White on Grey */
.provider-carousel-item {
    background: #ffffff;
    /* Blanco puro para tarjeta flotante */
    border: 1px solid #e2e8f0;
    /* Borde sutil */
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 50px;
    /* Reducido de 390px para ser más compacto verticalmente */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.provider-carousel-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e0;
    /* Borde un poco más oscuro en hover */
}

/* Image */
.carousel-product-image {
    margin-bottom: 8px;
    height: 130px;
    /* Reducido de 150px */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 5px;
}

.carousel-product-image img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.provider-carousel-item:hover .carousel-product-image img {
    transform: scale(1.08);
}

/* Info Container */
.carousel-product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.carousel-product-title {
    font-size: 0.95rem;
    /* Un poco más grande para mejor legibilidad */
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #4a5568;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* Aumentado a 3 líneas */
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.2em;
    /* Espacio reservado para 3 líneas */
}

.carousel-product-title a {
    color: #2d3748;
    font-size: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* Aumentado a 3 líneas */
    line-clamp: 3;
    /* Added for standard compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
    text-decoration: none;
    font-weight: 600;
}

.carousel-product-title a:hover {
    color: #3182ce;
}

/* Price */
.carousel-product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #2b6cb0;
    margin-bottom: 10px;
}

.carousel-product-price del {
    color: #cbd5e0;
    font-size: 0.8em;
}

/* Button - Compact & Centered */
.carousel-add-to-cart {
    margin-top: auto;
    width: 100%;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.carousel-add-to-cart .button {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    background-color: #3182ce !important;
    color: white !important;
    padding: 8px 9px !important;
    /* Ligeramente más padding para que se vea lleno */
    border-radius: 25px !important;
    text-decoration: none !important;
    font-size: 0.83rem !important;
    /* Regresando a un tamaño más legible */
    font-weight: 600 !important;
    transition: all 0.2s !important;
    border: none !important;
    line-height: 1.2 !important;
    height: auto !important;
    box-shadow: none !important;
    text-align: center !important;
    margin: 0 !important;
    /* Reset all possible theme margins */
    box-sizing: border-box !important;
}

.carousel-add-to-cart .button:hover {
    background-color: #2c5282 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

/* Footer & View All Button */
.provider-carousel-footer {
    text-align: center;
    margin-top: 10px;
}

.provider-carousel-view-all-btn {
    display: inline-block;
    padding: 10px 30px;
    background-color: transparent;
    color: #3182ce;
    border: 2px solid #3182ce;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.provider-carousel-view-all-btn:hover {
    background-color: #3182ce;
    color: white;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.4);
}

/* Swiper Navigation */
.swiper-button-next,
.swiper-button-prev {
    color: #2d3748;
    background: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    /* Hidden by default, shown on hover of container */
    transition: opacity 0.3s ease;
}

.provider-carousel-container:hover .swiper-button-next,
.provider-carousel-container:hover .swiper-button-prev {
    opacity: 1;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 18px;
    font-weight: bold;
}


/* ------------------------
   Tabbed Interface Styles
   ------------------------ */

.provider-tabbed-container {
    padding: 30px 40px;
    /* Reducido de 50px 60px para mayor compacidad */
    position: relative;
    margin: 30px auto;
    max-width: 1450px;
    width: 96%;
    background: #e2e8f0 !important;
    /* Slate 200: Gris medio para contraste claro sobre fondo blanco/claro */
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid #cbd5e0;
}

/* Nav Header */
.provider-tabs-header {
    text-align: center;
    margin-bottom: 25px;
}

/* Tab Navigation - Pill Style for High Presence */
.provider-tabs-nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    background: #ffffff;
    /* Fondo blanco para las pestañas sobre el fondo gris */
    padding: 10px;
    border-radius: 50px;
    display: inline-flex;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.provider-tab-btn {
    padding: 14px 32px;
    background: transparent;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem !important;
    color: #140d11;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.provider-tab-btn:hover {
    background: #edf2f7;
    color: #3182ce;
}

.provider-tab-btn.active {
    background: #3182ce !important;
    /* Fondo sólido azul en activo */
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(49, 130, 206, 0.4);
}

/* Tab Content */
.provider-tab-content {
    display: none;
    /* Hidden by default */
    animation: fadeIn 0.4s ease;
}

.provider-tab-content.active {
    display: block;
    /* Shown when active */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------------
   Provider Info Grid (1x2 Layout)
   ------------------------ */

/* Grid Container */
.provider-info-grid {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 30px;
    align-items: start;
}

/* Reversed Grid (Carousel Left, Info Right) */
.provider-info-grid.reversed {
    grid-template-columns: 70% 30%;
}

.provider-info-grid.reversed .provider-info-sidebar {
    order: 2;
}

.provider-info-grid.reversed .provider-carousel-column {
    order: 1;
}

/* Left Sidebar: Provider Info - Refined Hierarchy */
.provider-info-sidebar {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Provider Logo */
.provider-info-logo {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.provider-info-logo img {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

/* Category specific styling - deeper rounded/pill */
.category-image img {
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.category-image:hover img {
    transform: scale(1.05);
}

/* Provider Name */
.provider-info-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
    line-height: 1.3;
}

/* Provider Description */
.provider-info-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4a5568;
    text-align: left;
    margin: 0;
}

/* Brand Selector Dropdown */
.brand-selector-wrapper {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
    text-align: left;
}

.brand-selector-wrapper label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #718096;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.brand-carousel-filter {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background-color: #fff;
    font-size: 0.9rem;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.brand-carousel-filter:hover {
    border-color: #3182ce;
}

.brand-carousel-filter:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* AJAX Loading State */
.ajax-carousel-container {
    transition: opacity 0.3s ease;
    position: relative;
}

.ajax-carousel-container.loading {
    opacity: 0.4;
    pointer-events: none;
}

.ajax-carousel-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(49, 130, 206, 0.2);
    border-top-color: #3182ce;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Right Column: Carousel (takes remaining 70% space from grid) */

/* Responsive: Tablet (Stack at 992px) */
@media (max-width: 992px) {
    .provider-info-grid {
        grid-template-columns: 1fr;
        /* Force vertical stack on tablets and below */
        gap: 25px;
        display: block;
        /* Use block to ensure perfect stacking without grid edge cases */
    }

    /* Reversed Grid Mobile: Ensure natural DOM order (Carousel first, then Info) prevails in block mode */
    .provider-info-grid.reversed {
        display: block;
    }

    .provider-info-grid.reversed .provider-info-sidebar,
    .provider-info-grid.reversed .provider-carousel-column {
        order: unset;
        /* Reset order for vertical stack */
    }

    .provider-info-sidebar {
        width: 100%;
        height: auto;
        /* Reset height */
        margin-bottom: 25px;
        min-width: 0;
        /* Prevent overflow */
    }

    .provider-carousel-column {
        width: 100%;
        min-width: 0;
        /* Prevent Swiper overflow */
        display: block;
    }

    .provider-tabbed-container,
    .provider-carousel-container {
        width: 98%;
        /* Use more width on smaller screens */
        padding: 20px;
        margin: 20px auto;
    }
}

/* Responsive: Mobile (Optimized for phones) */
@media (max-width: 768px) {
    .provider-info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .provider-info-sidebar {
        padding: 20px;
        margin-bottom: 10px;
    }

    .provider-info-logo {
        min-height: 80px;
    }

    .provider-info-logo img {
        max-height: 80px;
    }

    .provider-info-name {
        font-size: 1.1rem;
    }

    .provider-info-description {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .provider-tabbed-container,
    .provider-carousel-container {
        width: 100%;
        padding: 15px;
        margin: 15px auto;
        border-radius: 12px;
    }

    .provider-tabs-nav {
        gap: 8px;
        padding: 6px;
        border-radius: 30px;
    }

    .provider-tab-btn {
        padding: 10px 20px;
        font-size: 1rem !important;
        /* Más presencia en móvil */
        border-radius: 25px;
    }

    .swiper-provider {
        padding: 10px 0 30px 0;
    }

    /* Product Cards on Mobile */
    .provider-carousel-item {
        height: auto;
        /* Allow flexible height on mobile */
        min-height: 330px;
        /* Reducido en móvil para evitar que se vea estirado */
    }

    .carousel-product-image {
        height: 100px;
        /* Más pequeño en móvil para ganar espacio */
        margin-bottom: 8px;
    }

    .carousel-product-title {
        font-size: 0.9rem;
        min-height: 3.9em;
        /* Espacio para 3 líneas en móvil */
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    .carousel-product-price {
        font-size: 1rem;
    }

    .carousel-add-to-cart .button {
        padding: 10px 12px !important;
        font-size: 13px !important;
        /* Restaurando tamaño en móvil para que no se vea vacío */
        letter-spacing: -0.1px;
    }

    /* Swiper Navigation on Mobile */
    .swiper-button-next,
    .swiper-button-prev {
        width: 35px;
        height: 35px;
        opacity: 1;
        /* Always visible on mobile */
    }

    .swiper-button-next::after,
    .swiper-button-prev::after {
        font-size: 16px;
    }
}

/* Extra Small Mobile (< 480px) */
@media (max-width: 480px) {

    .provider-tabbed-container,
    .provider-carousel-container {
        width: 100%;
        padding: 12px;
        margin: 10px auto;
    }

    .provider-tab-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .provider-info-description {
        font-size: 0.8rem;
    }
}

/* Hide inner container padding when using grid layout */
.provider-tabbed-container.with-provider-info .provider-carousel-container {
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border: none;
}

/* Hide the individual container styling when inside tabs to avoid double padding/shadow */

/* ------------------------
   Provider Grid Styles (Storefront)
   ------------------------ */

.provider-grid-container {
    padding: 25px;
    max-width: 1400px;
    /* Match carousel width */
    width: 95%;
    /* Use 95% of available width */
    margin: 0 auto;
}

.provider-grid-header {
    text-align: center;
    margin-bottom: 40px;
}

.provider-grid-title {
    font-size: 2rem;
    color: #2d3748;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.provider-grid-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: #3182ce;
    border-radius: 2px;
}

.provider-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
}

/* Reuse existing card styles but ensure height consistency in grid */
.provider-grid-layout .provider-carousel-item {
    height: 100%;
    /* Fill grid cell height */
    width: 100%;
}