/**
 * noUiSlider Custom Styling for Zin Lab
 * Matches existing Bootstrap-based design
 */

/* ============================================
   SLIDER BASE STYLING
   ============================================ */

/*
 * The wrapper must use padding (not overflow:hidden) so the handle—which is
 * positioned -12px outside the track—is never clipped by parent containers
 * that have overflow-x:hidden for the mobile scroll fix.
 */
.nouislider-wrapper {
    flex: 1;
    min-width: 0;          /* allow flex shrink below content size */
    height: 40px;
    display: flex;
    align-items: center;
    /* Inset padding gives the handle room at both ends without clipping */
    padding: 0 14px;
    box-sizing: border-box;
    overflow: visible;
}

.noUi-target {
    background: #e9ecef;
    border-radius: 4px;
    border: 1px solid #ced4da;
    box-shadow: none;
    height: 8px;
    width: 100%;
    overflow: visible;     /* never clip the handle */
}

.noUi-base,
.noUi-connects {
    height: 8px;
    overflow: visible;
}

/* Filled portion of the slider - uses varietal color */
.noUi-connect {
    background: var(--slider-color, #78264C);
    transition: background 0.3s ease;
}

/* Slider handle (the draggable circle) */
.noUi-handle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--slider-color, #78264C);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: grab;
    right: -12px;
    top: -8px;
}

.noUi-handle:active {
    cursor: grabbing;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

/* Tooltip (shows percentage while dragging) */
.noUi-tooltip {
    display: none;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 12px;
    bottom: 150%;
}

.noUi-active .noUi-tooltip {
    display: block;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .nouislider-wrapper {
        height: 44px;
        padding: 0 18px;   /* wider inset for the larger 32px handle */
        overflow: visible;
        /* Reset any max-width/overflow rules from the global mobile fix */
        max-width: none;
    }

    .noUi-target {
        height: 10px;
        overflow: visible;
        /* Allow vertical scroll, prevent horizontal during drag */
        touch-action: pan-y;
    }

    .noUi-base,
    .noUi-connects {
        height: 10px;
        overflow: visible;
    }

    .noUi-handle {
        width: 32px;
        height: 32px;
        right: -16px;
        top: -11px;
    }

    /*
     * Override the blanket "* { max-width: 100% }" mobile rule in zinlab.css
     * for noUiSlider internals so they aren't clamped unexpectedly.
     */
    .noUi-target,
    .noUi-base,
    .noUi-connects,
    .noUi-connect,
    .noUi-origin,
    .noUi-handle {
        max-width: none;
    }
}

/* ============================================
   STATE STYLES
   ============================================ */

.noUi-target[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.noUi-target[disabled] .noUi-handle {
    cursor: not-allowed;
}

.noUi-handle:focus {
    outline: 2px solid #c9a046;
    outline-offset: 2px;
}
