/* ── Product Grid with Tabs & Related Products ── */

/* ─────────────────────────────────────────────────────────────────
   Related Products
───────────────────────────────────────────────────────────────── */

.spf-related-products {
    width: 100%;
}


/* ─────────────────────────────────────────────────────────────────
   Tab Bar
───────────────────────────────────────────────────────────────── */

.spf-tabbed-grid {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spf-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.spf-tabs::-webkit-scrollbar {
    display: none;
}

.spf-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.spf-tab:hover,
.spf-tab:focus,
.spf-tab:active {
    background: none !important;
    background-color: transparent !important;
    color: #374151;
}

.spf-tab--active {
    color: #0d9488;
    border-bottom-color: #0d9488;
    border-radius: 0;
}

.spf-tab--active:hover,
.spf-tab--active:focus {
    color: #0d9488;
}

/* ─────────────────────────────────────────────────────────────────
   Grid Content
───────────────────────────────────────────────────────────────── */

.spf-tabbed-grid__content {
    position: relative;
    min-height: 200px;
}

.spf-tabbed-grid__products .products {
    display: grid !important;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.spf-tabbed-grid__products .products.columns-2 { grid-template-columns: repeat(2, 1fr) !important; }
.spf-tabbed-grid__products .products.columns-3 { grid-template-columns: repeat(3, 1fr) !important; }
.spf-tabbed-grid__products .products.columns-4 { grid-template-columns: repeat(4, 1fr) !important; }
.spf-tabbed-grid__products .products.columns-5 { grid-template-columns: repeat(5, 1fr) !important; }
.spf-tabbed-grid__products .products.columns-6 { grid-template-columns: repeat(6, 1fr) !important; }

/* Neutralize WooCommerce clearfix pseudo-elements that become ghost grid items */
.spf-tabbed-grid__products .products::before,
.spf-tabbed-grid__products .products::after {
    display: none !important;
    content: none !important;
}

/* Reset any theme first/last child overrides inside our grid */
.spf-tabbed-grid__products .products li.product,
.spf-tabbed-grid__products .products li.product:first-child,
.spf-tabbed-grid__products .products li.product:last-child,
.spf-tabbed-grid__products .products li.product.first,
.spf-tabbed-grid__products .products li.product.last {
    grid-column: auto !important;
    grid-row: auto !important;
    float: none !important;
    clear: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Product card styles are in spf-filters.css (shared base) */

/* Hide WooCommerce "Ver carrito" link */
.spf-card-actions .added_to_cart {
    display: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   Pagination (inherits from spf-filters.css via .woocommerce-pagination)
───────────────────────────────────────────────────────────────── */

.spf-tabbed-grid__pagination {
    margin-top: 32px;
}

.spf-tabbed-pagination {
    text-align: center;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.spf-tabbed-pagination ul.page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
}

.spf-tabbed-pagination ul.page-numbers li {
    list-style: none;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.spf-tabbed-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.spf-tabbed-pagination .page-numbers:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.spf-tabbed-pagination .page-numbers.current {
    background: #374151;
    border-color: #374151;
    color: #fff;
    cursor: default;
}

.spf-tabbed-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
    cursor: default;
    color: #9ca3af;
}

/* ─────────────────────────────────────────────────────────────────
   Loading
───────────────────────────────────────────────────────────────── */

.spf-tabbed-grid__content > .spf-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.spf-tabbed-grid__content > .spf-loading-overlay.spf-loading-active {
    opacity: 1;
    pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────────
   Responsive — Tablet (≤1024px)
───────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .spf-tabbed-grid__products .products.columns-tablet-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .spf-tabbed-grid__products .products.columns-tablet-3 { grid-template-columns: repeat(3, 1fr) !important; }
    .spf-tabbed-grid__products .products.columns-tablet-4 { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ─────────────────────────────────────────────────────────────────
   Responsive — Mobile (≤768px)
───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .spf-tabs {
        gap: 0;
        padding-bottom: 0;
    }

    .spf-tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    .spf-tabbed-grid__products .products.columns-mobile-1 { grid-template-columns: repeat(1, 1fr) !important; }
    .spf-tabbed-grid__products .products.columns-mobile-2 { grid-template-columns: repeat(2, 1fr) !important; }
    .spf-tabbed-grid__products .products.columns-mobile-3 { grid-template-columns: repeat(3, 1fr) !important; }

    .spf-tabbed-card img {
        height: 180px;
    }
}
