/* ===== SISTEMA DE PESTAÑAS DE CATEGORÍAS ===== */

.category-tabs-section {
    background: #ffffff;
    padding: 20px 0 15px;
    margin-bottom: 15px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.category-tabs-section .container,
.products-grouped-section .container {
    padding: 0 8px;
    width: 100%;
    overflow-x: hidden;
}

/* Botones de navegación para desktop */
.category-nav-btn {
    display: none;
    position: absolute;
    top: calc(50% + 20px);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.category-nav-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.5);
}

.category-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.category-nav-btn.left {
    left: 10px;
}

.category-nav-btn.right {
    right: 10px;
}

.category-tabs-section.has-scroll .category-nav-btn {
    opacity: 1;
    pointer-events: auto;
}

.category-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

@media (min-width: 769px) {
    .category-nav-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.section-header {
    text-align: center;
    margin-bottom: 15px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 0.7rem;
    color: #718096;
    font-weight: 400;
}

/* Contenedor de pestañas - Scroll horizontal */
.category-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 12px 12px;
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
    
    /* Scroll suave */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
    
    /* Ocultar scrollbar en algunos navegadores pero mantener funcionalidad */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 53, 0.3) transparent;
}

/* Estilo de scrollbar personalizado (Webkit) */
.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.4);
    border-radius: 3px;
}

.category-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.6);
}

/* Indicadores de scroll (fade effect en los bordes) */
.category-tabs-section {
    position: relative;
}

.category-tabs-section::before,
.category-tabs-section::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 120px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-tabs-section::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

.category-tabs-section::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

.category-tabs-section.has-scroll::before,
.category-tabs-section.has-scroll::after {
    opacity: 1;
}

/* Botón de pestaña - Sin wrap, tamaño fijo mínimo */
.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 75px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.tab-btn > * {
    position: relative;
    z-index: 1;
}

.tab-btn:hover {
    transform: translateY(-2px); /* Reducido de -4px */
    box-shadow: 0 8px 16px rgba(255, 107, 53, 0.12); /* Reducido intensidad */
    border-color: #FF6B35;
}

.tab-btn:hover::before {
    opacity: 0.03; /* Reducido de 0.05 */
}

.tab-btn.active {
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border-color: #FF6B35;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.25); /* Reducido intensidad */
    transform: translateY(-1px); /* Reducido de -2px */
}

.tab-btn.active::before {
    opacity: 0;
}

.tab-icon {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.tab-btn:hover .tab-icon {
    transform: scale(1.08); /* Reducido de 1.1 */
}

.tab-btn.active .tab-icon {
    transform: scale(1.12); /* Reducido de 1.15 */
    filter: brightness(1.2);
}

.tab-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #2d3748;
    transition: color 0.3s ease;
    text-align: center;
    line-height: 1.2;
}

.tab-btn.active .tab-label {
    color: white;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 16px;
    padding: 0 4px;
    background: #edf2f7;
    color: #4a5568;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Contador de productos */
.products-count {
    text-align: center;
    margin-bottom: 30px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    border-left: 4px solid #FF6B35;
}

.products-count span {
    font-size: 0.95rem;
    color: #4a5568;
}

.products-count strong {
    color: #FF6B35;
    font-weight: 700;
}

/* Estado vacío de categoría */
.empty-category {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #a0aec0;
}

.empty-category i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-category p {
    font-size: 1rem;
    color: #718096;
}

/* ===== PRODUCTOS AGRUPADOS POR CATEGORÍA ===== */

.products-grouped-section {
    padding: 15px 0 30px;
    background: #ffffff;
}

.category-group {
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.category-group:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); /* Reducido intensidad */
}

.category-group-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.category-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.category-group-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.2);
}

.category-group-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    flex: 1;
}

.category-group-count {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #ffffff;
    color: #4a5568;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.category-group-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 0;
}

/* Ajustes para product-card dentro de grupos */
.category-group-products .product-card {
    margin: 0;
    height: 100%;
}

/* Optimización para móvil - 2 columnas perfectas */
@media (max-width: 480px) {
    .category-tabs-section .container,
    .products-grouped-section .container {
        padding: 0 4px;
    }
    
    .section-title {
        font-size: 0.95rem;
    }
    
    .section-subtitle {
        font-size: 0.65rem;
    }
    
    .category-tabs {
        gap: 6px;
        padding: 0 8px 10px 8px;
    }
    
    .tab-btn {
        min-width: 60px;
        padding: 6px 8px;
        gap: 3px;
    }
    
    .tab-icon {
        font-size: 0.9rem;
    }
    
    .tab-label {
        font-size: 0.6rem;
    }
    
    .category-group-products .product-card {
        padding: 8px;
        border-radius: 8px;
    }
    
    .category-group-products .product-card img {
        height: 140px;
        object-fit: cover;
        border-radius: 6px;
    }
    
    .category-group-products .product-card h3 {
        font-size: 0.75rem;
        line-height: 1.2;
        margin: 6px 0 4px 0;
        height: 2.4em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .category-group-products .product-card .product-category,
    .category-group-products .product-card .product-brand {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .category-group-products .product-card .product-price {
        font-size: 0.95rem;
        font-weight: 700;
        margin: 6px 0;
    }
    
    .category-group-products .product-card .product-rating {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }
    
    .category-group-products .product-card button,
    .category-group-products .product-card .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        border-radius: 6px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .products-grouped-section {
        padding: 20px 0 30px;
    }

    .category-group {
        padding: 14px;
        margin-bottom: 18px;
        border-radius: 12px;
    }

    .category-group-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .category-group-icon {
        width: 32px;
        height: 32px;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    .category-group-title h3 {
        font-size: 1rem;
    }

    .category-group-count {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .category-group-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .category-group {
        padding: 12px;
        border-radius: 10px;
    }

    .category-group-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .category-group-title {
        gap: 10px;
    }

    .category-group-title h3 {
        font-size: 0.9rem;
        width: 100%;
    }

    .category-group-count {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    .category-group-products {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .category-tabs-section {
        padding: 18px 0 12px;
    }

    .section-title {
        font-size: 1rem;
    }

    .section-subtitle {
        font-size: 0.68rem;
    }

    .category-tabs {
        gap: 6px;
        padding: 0 12px 10px 12px;
    }

    .tab-btn {
        min-width: 65px;
        padding: 6px 8px;
        gap: 3px;
    }

    .tab-icon {
        font-size: 1rem;
    }

    .tab-label {
        font-size: 0.68rem;
    }

    .tab-count {
        font-size: 0.62rem;
        min-width: 18px;
        height: 15px;
        padding: 0 4px;
    }
    
    /* Groups */
    .category-group {
        padding: 14px;
        margin-bottom: 16px;
        border-radius: 10px;
    }

    .category-group-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .category-group-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .category-group-title h3 {
        font-size: 0.95rem;
    }

    .category-group-count {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    
    /* Ajustar fade indicators en móvil */
    .category-tabs-section::before,
    .category-tabs-section::after {
        width: 25px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 0.95rem;
    }

    .category-tabs {
        gap: 5px;
        padding: 0 8px 8px 8px;
    }

    .tab-btn {
        min-width: 70px;
        padding: 6px 8px;
        border-radius: 8px;
    }

    .tab-icon {
        font-size: 1.1rem;
    }

    .tab-label {
        font-size: 0.68rem;
        white-space: nowrap;
    }

    .tab-count {
        font-size: 0.62rem;
        min-width: 18px;
        height: 14px;
    }
    
    /* Groups */
    .category-group {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 14px;
    }

    .category-group-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .category-group-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .category-group-title {
        gap: 8px;
    }

    .category-group-title h3 {
        font-size: 0.95rem;
        width: 100%;
    }

    .category-group-count {
        font-size: 0.72rem;
        padding: 4px 10px;
    }
    
    .category-group-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    /* Reducir fade indicators en móvil pequeño */
    .category-tabs-section::before,
    .category-tabs-section::after {
        width: 15px;
        height: 60px;
    }
}

/* Responsive para Desktop - mantener funcionalidad */
@media (min-width: 1024px) {
    .category-tabs-section {
        padding: 30px 0 20px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .category-tabs {
        gap: 12px;
        padding: 0 20px 16px 20px;
    }

    .tab-btn {
        min-width: 110px;
        padding: 12px 16px;
        gap: 6px;
    }

    .tab-icon {
        font-size: 1.5rem;
    }

    .tab-label {
        font-size: 0.85rem;
    }

    .tab-count {
        font-size: 0.75rem;
        min-width: 26px;
        height: 20px;
        padding: 0 6px;
    }

    .category-group {
        padding: 24px;
        margin-bottom: 30px;
        border-radius: 16px;
    }

    .category-group-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .category-group-icon {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }

    .category-group-title h3 {
        font-size: 1.5rem;
    }

    .category-group-count {
        font-size: 0.9rem;
        padding: 6px 14px;
    }

    .category-group-products {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 24px;
    }
}

/* Animaciones */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-btn {
    animation: slideInUp 0.4s ease backwards;
}

.tab-btn:nth-child(1) { animation-delay: 0.05s; }
.tab-btn:nth-child(2) { animation-delay: 0.1s; }
.tab-btn:nth-child(3) { animation-delay: 0.15s; }
.tab-btn:nth-child(4) { animation-delay: 0.2s; }
.tab-btn:nth-child(5) { animation-delay: 0.25s; }
.tab-btn:nth-child(6) { animation-delay: 0.3s; }
.tab-btn:nth-child(7) { animation-delay: 0.35s; }
.tab-btn:nth-child(8) { animation-delay: 0.4s; }

/* Mejora de accesibilidad */
.tab-btn:focus {
    outline: 3px solid rgba(255, 107, 53, 0.5);
    outline-offset: 2px;
}

.tab-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Optimización de rendimiento */
.category-tabs-section,
.tab-btn {
    will-change: transform;
}

/* ===== OPTIMIZACI�N DE GRID DE PRODUCTOS ===== */

.products-grid-section {
    min-height: 400px;
}

#productsGridSection .products-grid {
    max-width: 1400px;
    margin: 0 auto;
}

/* Ocultar paginaci�n en vista de pesta�as */
.products-grouped-section ~ .products-grid-section .pagination {
    display: none;
}

/* Animaci�n de entrada para grupos */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-group {
    animation: fadeInUp 0.5s ease backwards;
}

.category-group:nth-child(1) { animation-delay: 0.1s; }
.category-group:nth-child(2) { animation-delay: 0.2s; }
.category-group:nth-child(3) { animation-delay: 0.3s; }
.category-group:nth-child(4) { animation-delay: 0.4s; }
.category-group:nth-child(5) { animation-delay: 0.5s; }
.category-group:nth-child(6) { animation-delay: 0.6s; }

/* Botón para ver más (si se necesita en el futuro) */
.view-more-btn {
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #4a5568;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-more-btn:hover {
    background: #f7fafc;
    border-color: #FF6B35;
    color: #FF6B35;
}
