/* =========================================================================
   SLIDE TO CONFIRM - styling
   Colours arrive as custom properties set by slide_to_confirm.js, so one
   stylesheet covers the green submit slider and the blue verify slider.
   ========================================================================= */

.slide-confirm {
    --sc-track: #dcfce7;
    --sc-fill: #16a34a;
    --sc-handle: #15803d;
    --sc-text: #14532d;
    --sc-glow: rgba(22, 163, 74, .45);

    position: relative;
    display: block;
    width: 100%;
    height: 60px;
    border-radius: 999px;
    background: var(--sc-track);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, .12);
}

/* The coloured sweep that follows the handle. */
.slide-confirm .sc-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 56px;
    border-radius: 999px;
    background: linear-gradient(90deg,
                color-mix(in srgb, var(--sc-fill) 80%, white) 0%,
                var(--sc-fill) 100%);
    pointer-events: none;
}

/* Fallback for browsers without color-mix(). */
@supports not (background: color-mix(in srgb, red 50%, white)) {
    .slide-confirm .sc-fill { background: var(--sc-fill); }
}

.slide-confirm .sc-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 44px;
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sc-text);
    pointer-events: none;
    transition: opacity .18s linear;
}

/* A slow light sweep across the track, so the control reads as "do
   something to me" rather than as a disabled bar. */
.slide-confirm .sc-shimmer {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(90deg,
                transparent 0%,
                rgba(255, 255, 255, .55) 50%,
                transparent 100%);
    animation: sc-sweep 2.6s ease-in-out infinite;
}

@keyframes sc-sweep {
    0%   { left: -40%; }
    60%  { left: 100%; }
    100% { left: 100%; }
}

.slide-confirm .sc-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 0;
    border-radius: 50%;
    background: var(--sc-handle);
    color: #fff;
    cursor: grab;
    box-shadow: 0 4px 14px var(--sc-glow);
    transform: translateX(0);
    will-change: transform;
}

.slide-confirm .sc-handle:focus-visible {
    outline: 3px solid var(--sc-handle);
    outline-offset: 3px;
}

.slide-confirm.sc-dragging .sc-handle { cursor: grabbing; }
.slide-confirm.sc-dragging .sc-shimmer,
.slide-confirm.sc-confirmed .sc-shimmer { animation: none; opacity: 0; }

/* The three chevrons march to the right in sequence - the hint for what
   to do with the handle. They stop once dragging starts. */
.slide-confirm .sc-chev {
    font-size: .68rem;
    opacity: .35;
    animation: sc-march 1.4s ease-in-out infinite;
}
.slide-confirm .sc-chev-2 { animation-delay: .16s; }
.slide-confirm .sc-chev-3 { animation-delay: .32s; }

.slide-confirm.sc-dragging .sc-chev,
.slide-confirm.sc-confirmed .sc-chev { animation: none; opacity: .5; }

@keyframes sc-march {
    0%, 100% { opacity: .25; transform: translateX(-1px); }
    50%      { opacity: 1;   transform: translateX(2px); }
}

/* Past the two-thirds mark the handle pulses, so it is obvious the
   gesture is about to take. */
.slide-confirm.sc-near .sc-handle {
    animation: sc-pulse .7s ease-in-out infinite;
}

@keyframes sc-pulse {
    0%, 100% { box-shadow: 0 4px 14px var(--sc-glow); }
    50%      { box-shadow: 0 4px 26px var(--sc-glow), 0 0 0 7px color-mix(in srgb, var(--sc-fill) 18%, transparent); }
}

/* Confirmed: handle locks at the end, chevrons swap for a tick that pops. */
.slide-confirm .sc-tick {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    opacity: 0;
    transform: scale(.4);
    pointer-events: none;
}

.slide-confirm.sc-confirmed .sc-fill { width: 100% !important; }
.slide-confirm.sc-confirmed .sc-handle { opacity: 0; transition: opacity .2s linear .1s; }
.slide-confirm.sc-confirmed .sc-tick {
    opacity: 1;
    transform: scale(1);
    transition: opacity .18s linear .12s, transform .4s cubic-bezier(.34,1.56,.64,1) .12s;
}

.slide-confirm.sc-disabled {
    opacity: .5;
    pointer-events: none;
}

.slide-confirm.sc-disabled .sc-shimmer,
.slide-confirm.sc-disabled .sc-chev { animation: none; }

/* Dark mode: the track is the only piece that needs darkening - the fill
   and handle carry their own colour. */
.dark .slide-confirm {
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4);
}

.dark .slide-confirm .sc-label { color: #e2e8f0; }

/* Respect a reduced-motion preference: the control still works, it just
   stops advertising itself. */
@media (prefers-reduced-motion: reduce) {
    .slide-confirm .sc-shimmer,
    .slide-confirm .sc-chev,
    .slide-confirm.sc-near .sc-handle { animation: none; }
    .slide-confirm .sc-tick { transition: none; }
}
