/* static/assets/css/otp-send-loader.css
   "Sending your code" panel on the verification step (restaurant + booking).
   Compact sibling of the final processing state: ring spinner + a horizontal
   3-stage track whose line fills as stages finish. Driven by otp-send-loader.js
   (--otp-progress 0..1, .is-active / .is-done / .is-failed on .otp-stage). */

.otp-sending {
    --otp-accent: var(--menu-primary-color, var(--primary-color, #0d6efd));
    --otp-success: #198754;
    --otp-danger: #dc3545;
    --otp-muted: #8a9099;
    --otp-progress: 0;

    margin: 0 0 1rem;
    padding: 1rem 1rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--otp-accent) 18%, #e9ecef);
    border-radius: 14px;
    background: color-mix(in srgb, var(--otp-accent) 5%, #fff);
    animation: otp-in 0.25s ease-out;
}

/* the stepper CSS gives these blocks a display value, which would beat [hidden] */
.otp-sending[hidden],
.verification-code-container[hidden] {
    display: none !important;
}

/* ---------- head: ring + title + where the code goes ------------------ */
.otp-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.otp-ring {
    position: relative;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    color: var(--otp-accent);
    transition: color 0.3s ease;
}

.otp-ring svg {
    width: 100%;
    height: 100%;
    animation: otp-rotate 1.3s linear infinite;
}

.otp-ring circle {
    fill: none;
    stroke-width: 4;
}

.otp-ring-track {
    stroke: color-mix(in srgb, currentColor 15%, transparent);
}

.otp-ring-arc {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-dasharray: 80 150;
}

.otp-ring i {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    animation: otp-float 1.6s ease-in-out infinite;
}

.otp-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.98rem;
    color: #212529;
    line-height: 1.4;
}

.otp-to {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--otp-muted);
    overflow-wrap: anywhere;
}

.otp-contact {
    font-weight: 600;
    color: #495057;
}

/* ---------- stage track ---------------------------------------------- */
.otp-stages {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

/* the line runs between the first and last dot centres */
.otp-stages::before,
.otp-stages::after {
    content: "";
    position: absolute;
    top: 8px;
    inset-inline-start: 16.666%;
    height: 2px;
    border-radius: 2px;
}

.otp-stages::before {
    width: 66.666%;
    background: #dde1e6;
}

.otp-stages::after {
    width: calc(66.666% * var(--otp-progress));
    background: var(--otp-success);
    transition: width 0.35s ease;
}

.otp-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.25rem;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--otp-muted);
    transition: color 0.3s ease;
}

.otp-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d0d5dc;
    background: #fff;
    transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

.otp-stage.is-active {
    color: #212529;
    font-weight: 600;
}

.otp-stage.is-active .otp-dot {
    border-color: var(--otp-accent);
    border-top-color: transparent;
    animation: otp-rotate 0.8s linear infinite;
}

.otp-stage.is-done {
    color: var(--otp-success);
}

.otp-stage.is-done .otp-dot {
    border-color: var(--otp-success);
    background: var(--otp-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.5' d='M4 8.5l2.5 2.5L12 5.5'/%3E%3C/svg%3E") center/12px no-repeat;
    animation: otp-pop 0.3s ease-out;
}

.otp-stage.is-failed {
    color: var(--otp-danger);
    font-weight: 600;
}

.otp-stage.is-failed .otp-dot {
    border-color: var(--otp-danger);
    background: var(--otp-danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.5' d='M5 5l6 6M11 5l-6 6'/%3E%3C/svg%3E") center/11px no-repeat;
}

/* ---------- end states ------------------------------------------------ */
.otp-sending.is-done .otp-ring {
    color: var(--otp-success);
}

.otp-sending.is-done .otp-ring svg,
.otp-sending.is-failed .otp-ring svg {
    animation: none;
}

.otp-sending.is-done .otp-ring-arc,
.otp-sending.is-failed .otp-ring-arc {
    stroke-dasharray: 150 0;
    transition: stroke-dasharray 0.4s ease;
}

.otp-sending.is-done .otp-ring i,
.otp-sending.is-failed .otp-ring i {
    animation: none;
}

.otp-sending.is-failed .otp-ring {
    color: var(--otp-danger);
}

@keyframes otp-rotate {
    to { transform: rotate(360deg); }
}

@keyframes otp-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes otp-pop {
    0% { transform: scale(0.7); }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes otp-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .otp-ring svg, .otp-stage.is-active .otp-dot { animation-duration: 3s; }
    .otp-ring i, .otp-stage.is-done .otp-dot, .otp-sending { animation: none; }
}
