/**
 * WooCommerce Category AJAX Slider - Frontend Styles
 */

/* CSS Custom Properties (set via inline styles from PHP) */
.wfn-slider {
    --wfn-text-color: #333333;
    --wfn-active-bg: #0073aa;
    --wfn-border-radius: 20px;
    --wfn-active-text: #ffffff;
    --wfn-bg: #ffffff;
    --wfn-border: #e0e0e0;
    --wfn-arrow-bg: rgba(255, 255, 255, 0.95);
    --wfn-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Main Slider Container */
.wfn-slider {
    position: -webkit-sticky; /* Safari support */
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--wfn-bg);
	border-radius: 40px;
    border-bottom: 1px solid var(--wfn-border);
    font-family: inherit;
    /* Ensure sticky works */
    width: auto;
    left: 0;
    right: 0;
}

/* Track Container - wraps arrows and items */
.wfn-slider__track {
    flex: 1;
    position: relative;
    margin-right: 8px;
    display: flex;
    align-items: center;
    min-width: 0; /* Allow flex item to shrink */
}

/* Items Container (Scrollable) */
.wfn-slider__items {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    padding: 4px 0; /* Prevent item shadows from being clipped */
	border-radius: 50px!important;

    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wfn-slider__items::-webkit-scrollbar {
    display: none;
}

/* Category Item */
.wfn-slider__item {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid var(--wfn-border);
    border-radius: var(--wfn-border-radius);
    background: transparent;
    color: var(--wfn-text-color);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly */
    display: flex;
    align-items: center;
    justify-content: center;
}

.wfn-slider__item:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--wfn-active-bg);
}

.wfn-slider__item:focus {
    outline: 2px solid var(--wfn-active-bg);
    outline-offset: 2px;
}

.wfn-slider__item--active,
.wfn-slider__item.active {
    background: var(--wfn-active-bg);
    border-color: var(--wfn-active-bg);
    color: var(--wfn-active-text);
}

/* Navigation Arrows - Overlapping style */
.wfn-slider__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 1px solid var(--wfn-border);
    border-radius: 50%;
    background: var(--wfn-arrow-bg);
    color: var(--wfn-text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.wfn-slider__arrow--left {
    left: 4px;
}

.wfn-slider__arrow--right {
    right: 4px;
}

.wfn-slider__arrow--visible {
    opacity: 1;
    pointer-events: auto;
}

.wfn-slider__arrow:hover {
    background: var(--wfn-active-bg);
    border-color: var(--wfn-active-bg);
    color: var(--wfn-active-text);
}

.wfn-slider__arrow:focus {
    outline: 2px solid var(--wfn-active-bg);
    outline-offset: 2px;
}

.wfn-slider__arrow svg {
    width: 20px;
    height: 20px;
}

/* Hamburger Menu Button */
.wfn-slider__hamburger {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 1px solid var(--wfn-border);
    border-radius: 50px;
    background: transparent;
    color: var(--wfn-text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.wfn-slider__hamburger:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--wfn-active-bg);
}

.wfn-slider__hamburger:focus {
    outline: 2px solid var(--wfn-active-bg);
    outline-offset: 2px;
}

.wfn-slider__hamburger[aria-expanded="true"] {
    background: var(--wfn-active-bg);
    border-color: var(--wfn-active-bg);
    color: var(--wfn-active-text);
}

.wfn-slider__hamburger svg {
    width: 20px;
    height: 20px;
}

/* Popup Overlay */
.wfn-slider__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wfn-slider__overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* Popup Menu */
.wfn-slider__popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 100000;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    background: var(--wfn-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wfn-slider__popup--visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Popup Header */
.wfn-slider__popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wfn-border);
}

.wfn-slider__popup-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--wfn-text-color);
}

.wfn-slider__popup-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--wfn-text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.wfn-slider__popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.wfn-slider__popup-close:focus {
    outline: 2px solid var(--wfn-active-bg);
    outline-offset: 2px;
}

/* Popup Grid - Single column list */
.wfn-slider__popup-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    overflow-y: auto;
}

/* Popup Item */
.wfn-slider__popup-item {
    padding: 12px 16px;
    border: 1px solid var(--wfn-border);
    border-radius: var(--wfn-border-radius);
    background: transparent;
    color: var(--wfn-text-color);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.wfn-slider__popup-item:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--wfn-active-bg);
}

.wfn-slider__popup-item:focus {
    outline: 2px solid var(--wfn-active-bg);
    outline-offset: 2px;
}

.wfn-slider__popup-item--active,
.wfn-slider__popup-item.active {
    background: var(--wfn-active-bg);
    border-color: var(--wfn-active-bg);
    color: var(--wfn-active-text);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .wfn-slider {
        padding: 10px 12px;
    }

    .wfn-slider__arrow {
        width: 28px;
        height: 28px;
    }

    .wfn-slider__arrow--left {
        left: 2px;
    }

    .wfn-slider__arrow--right {
        right: 2px;
    }

    .wfn-slider__arrow svg {
        width: 14px;
        height: 14px;
    }

    .wfn-slider__popup {
        width: 95%;
        max-height: 65vh;
    }

    .wfn-slider__popup-grid {
        padding: 12px 16px;
    }
}
