/* file => slider-captcha.css | versione => 1.0.0 | data => 03-04-2026 15:30
 * @changelog
 *   1.0.0 (03-04-2026) - Slider captcha anti-bot per form contatto */

/* Container */
.slider-captcha {
    position: relative;
    margin-bottom: 16px;
    user-select: none;
    -webkit-user-select: none;
}

.slider-captcha-label {
    font-size: 0.85em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    color: #555;
}

/* Track */
.slider-captcha-track {
    position: relative;
    height: 44px;
    background: #e9ecef;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    transition: border-color 0.3s;
}

.slider-captcha-track.verified {
    border-color: #28a745;
    background: #d1e7dd;
}

.slider-captcha-track.error {
    border-color: #dc3545;
}

/* Fill (barra di progresso) */
.slider-captcha-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(44, 146, 177, 0.15), rgba(44, 146, 177, 0.3));
    border-radius: 22px;
    transition: none;
    pointer-events: none;
}

.slider-captcha-track.verified .slider-captcha-fill {
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.15), rgba(40, 167, 69, 0.3));
    width: 100% !important;
    transition: width 0.3s ease;
}

/* Testo dentro la track */
.slider-captcha-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85em;
    color: #999;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.slider-captcha-track.dragging .slider-captcha-text,
.slider-captcha-track.verified .slider-captcha-text {
    opacity: 0;
}

/* Testo verificato */
.slider-captcha-verified-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85em;
    color: #0f5132;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.slider-captcha-track.verified .slider-captcha-verified-text {
    opacity: 1;
}

/* Handle (il pulsante da trascinare) */
.slider-captcha-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 40px;
    height: 40px;
    background: var(--adse-blue, #2c92b1);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    transition: background 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 2;
    touch-action: none;
}

.slider-captcha-handle:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.slider-captcha-handle:active,
.slider-captcha-handle.dragging {
    cursor: grabbing;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.slider-captcha-track.verified .slider-captcha-handle {
    background: #28a745;
    cursor: default;
    left: calc(100% - 42px) !important;
    transition: left 0.3s ease, background 0.3s;
}

/* Errore slider */
.slider-captcha-error {
    color: #dc3545;
    font-size: 0.85em;
    display: none;
    margin-top: 4px;
}

.slider-captcha-error.visible {
    display: block;
}

/* Animazione reset (quando non arriva in fondo) */
.slider-captcha-handle.resetting {
    transition: left 0.3s ease;
}

.slider-captcha-fill.resetting {
    transition: width 0.3s ease;
}

/* Responsive */
@media screen and (max-width: 576px) {
    .slider-captcha-track {
        height: 48px;
    }

    .slider-captcha-handle {
        width: 44px;
        height: 44px;
    }

    .slider-captcha-track.verified .slider-captcha-handle {
        left: calc(100% - 46px) !important;
    }
}
