/**
 * OnlyF1 – Category Tabs Styles
 *
 * Styles pour les tabs de catégories avec infinite scroll
 */

/* Container principal */
.onlyf1-category-tabs-container {
    position: relative;
}

/* Barre de tabs */
.onlyf1-category-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
    border-bottom: none;
}

/* Tab individuelle */
.onlyf1-category-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--wp--preset--font-family--base, inherit);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    color: var(--wp--preset--color--ti-fg, #333);
    background: var(--wp--preset--color--custom-50, #f0f0f0);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-bottom: 0;
}

.onlyf1-category-tab:hover {
    background: var(--wp--preset--color--custom-200, #e0e0e0);
}

.onlyf1-category-tab.is-active {
    color: #fff;
    background: var(--wp--preset--color--primary, var(--onlyf1-ct-accent-color, #e10600));
}

/* Compteur de posts (optionnel) */
.onlyf1-category-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.5rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: #666;
    border-radius: 999px;
}

.onlyf1-category-tab.is-active .onlyf1-category-tab-count {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Zone de contenu */
.onlyf1-category-tabs-content {
    position: relative;
    min-height: 300px;
}

/* Message de chargement */
.onlyf1-is-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: #666;
}

.onlyf1-is-loading.is-visible {
    display: flex;
}

.onlyf1-is-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid #e5e5e5;
    border-top-color: var(--onlyf1-ct-accent-color, #e10600);
    border-radius: 50%;
    animation: onlyf1-spin 0.8s linear infinite;
}

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

/* Sentinel (invisible, pour IntersectionObserver) */
.onlyf1-is-sentinel {
    height: 1px;
    margin: 0;
    padding: 0;
    border: none;
    opacity: 0;
    pointer-events: none;
}

/* Message de fin (optionnel) */
.onlyf1-is-end-message {
    display: none;
    padding: 2rem;
    text-align: center;
    color: #999;
    font-size: 0.875rem;
}

.onlyf1-is-end-message.is-visible {
    display: block;
}

/* Responsive – scroll horizontal sur mobile */
@media (max-width: 782px) {

    /* Tabs : scroll horizontal, jamais de retour à la ligne */
    .onlyf1-category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        gap: 0.375rem;
    }

    /* Masquer la scrollbar — Chrome / Safari / Edge */
    .onlyf1-category-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Indicateur de scroll : fondu sur le bord droit */
    .onlyf1-category-tabs-container {
        --tabs-fade-bg: var(--wp--preset--color--base, #fff);
    }

    .onlyf1-category-tabs-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 2.5rem;
        /* Hauteur = padding vertical × 2 + hauteur de ligne approx. */
        height: 3rem;
        background: linear-gradient(to right, transparent, var(--tabs-fade-bg, #fff) 80%);
        pointer-events: none;
        z-index: 1;
    }

    .onlyf1-category-tab {
        flex-shrink: 0;
        padding: 0.65rem 1.1rem;
        font-size: 0.875rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .onlyf1-category-tab-count {
        min-width: 1.25rem;
        height: 1.25rem;
        font-size: 0.6875rem;
    }
}

/* Animation de transition lors du changement de catégorie */
@keyframes onlyf1-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onlyf1-category-tabs-content .wp-block-post {
    animation: onlyf1-fade-in 0.3s ease;
}