/**
 * TropiTrade UI — shared pill-toggle component
 *
 * Used by:
 *   - homepage country-filter (Popular / All / Regional)
 *   - product-page data-filter (Data / Unlimited)
 *   - my-account login tabs (Inloggen / Registreren)
 *
 * Markup pattern:
 *   <div class="tt-toggle" style="--tt-toggle-count:N">
 *     <div class="tt-toggle-slider"></div>
 *     <button class="tt-toggle-option active" data-filter="..."></button>
 *     ...
 *   </div>
 *
 * Slider position: set inline style="--tt-toggle-pos:I" on wrapper (I = active index, 0-based)
 * OR add legacy class .unlimited (count=2 only) for backwards compat with subcategory-products.php.
 *
 * Source of truth: inc/components/toggle.css. Do NOT duplicate in page-level CSS.
 */

.tt-toggle {
    --tt-toggle-count: 2;
    --tt-toggle-pos: 0;
    display: flex;
    background: linear-gradient(180deg, #fff 0%, #fafffe 100%);
    border-radius: 30px;
    padding: 4px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
    border: 1px solid rgba(226, 240, 220, .8);
    min-height: 48px;
}

.tt-toggle-slider {
    position: absolute;
    width: calc((100% - 8px) / var(--tt-toggle-count));
    height: calc(100% - 8px);
    background: linear-gradient(180deg, #ff8c1a 0%, #ff7a00 100%);
    border-radius: 26px;
    top: 4px;
    left: 4px;
    transition: transform 0.25s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 2px 8px rgba(255, 122, 0, .3),
                0 4px 12px rgba(255, 122, 0, .15),
                inset 0 -1px 2px rgba(0, 0, 0, .1);
    transform: translateX(calc(var(--tt-toggle-pos) * 100%));
    pointer-events: none;
}

/* Legacy compat: subcategory-products.php uses .unlimited class (count=2) */
.tt-toggle[style*="--tt-toggle-count:2"] .tt-toggle-slider.unlimited,
.tt-toggle:not([style*="--tt-toggle-count"]) .tt-toggle-slider.unlimited {
    transform: translateX(100%);
}

.tt-toggle-option {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 26px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    z-index: 1;
    transition: color .2s ease;
    text-align: center;
    position: relative;
}

.tt-toggle-option.active {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.tt-toggle-option:hover:not(.active) {
    color: #333;
}

@media (max-width: 480px) {
    .tt-toggle-option {
        font-size: 12px;
        padding: 10px 8px;
    }
}
