/* Processing overlay styles - lightweight, SVG + CSS only, theme-aligned */

#processing-overlay {
    --overlay-bg: rgba(4, 8, 20, 0.88);
    --accent: #39ffb6;
    --accent-dim: #1bd89b;
    --glow: 0 0 18px rgba(57, 255, 182, 0.35);
    --text: #e8f5ff;
    --muted: #9bb3c6;
    --blinkDur: 2.8s;
    --blinkDelay: 1.2s;
    --scribbleDur: 1.8s;
    --tiltDur: 6s;
}

#processing-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(1200px 600px at 50% 20%, rgba(57, 255, 182, 0.08), transparent 60%),
        linear-gradient(180deg, rgba(10, 16, 28, 0.94), rgba(4, 8, 20, 0.94));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: var(--text);
    font-family: 'Orbitron', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif;
    backdrop-filter: blur(3px);
}

#processing-overlay.hidden {
    display: none;
}

@media print {
    #processing-overlay {
        display: none !important;
    }
}

.processing-wrap {
    width: min(860px, 92vw);
    display: grid;
    position: relative;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: center;
    justify-items: center;
    text-align: center;
}

/* Subtle grid scanlines for futuristic vibe */
.processing-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(transparent 31px, rgba(57, 255, 182, 0.06) 32px) top left / 100% 32px repeat-y,
        linear-gradient(90deg, transparent 31px, rgba(57, 255, 182, 0.06) 32px) top left / 32px 100% repeat-x;
    pointer-events: none;
    mask-image: radial-gradient(800px 300px at 50% 50%, rgba(0, 0, 0, 0.7), transparent 80%);
}

/* SVG container */
.robot-stage {
    width: min(560px, 86vw);
    aspect-ratio: 1.6 / 1;
    border: 1px solid rgba(57, 255, 182, 0.25);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--glow);
    background:
        radial-gradient(240px 140px at 70% 80%, rgba(57, 255, 182, 0.08), transparent 65%),
        linear-gradient(180deg, rgba(20, 30, 40, 0.35), rgba(10, 16, 28, 0.35));
}

/* Head tilt oscillation */
@keyframes tilt {
    0% {
        transform: rotate(0deg);
    }

    35% {
        transform: rotate(-3deg);
    }

    70% {
        transform: rotate(2.5deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Eye blink */
@keyframes blink {

    0%,
    90%,
    100% {
        transform: scaleY(1);
    }

    92% {
        transform: scaleY(0.22);
    }

    94% {
        transform: scaleY(1);
    }
}

/* Arm scribble (small arc motion) */
@keyframes scribble {
    0% {
        transform: rotate(-6deg) translateX(0px) translateY(0px);
    }

    30% {
        transform: rotate(-2deg) translateX(2px) translateY(0.5px);
    }

    60% {
        transform: rotate(-8deg) translateX(-1px) translateY(0.8px);
    }

    100% {
        transform: rotate(-6deg) translateX(0px) translateY(0px);
    }
}

/* Paper pulse glow */
@keyframes paperGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 0px rgba(57, 255, 182, 0.0));
    }

    50% {
        filter: drop-shadow(0 0 5px rgba(57, 255, 182, 0.35));
    }
}

/* SVG parts animated */
.robot-head {
    transform-origin: center;
    animation: tilt var(--tiltDur) ease-in-out infinite;
}

.robot-eye {
    transform-origin: center;
    animation: blink var(--blinkDur) linear infinite;
    animation-delay: var(--blinkDelay);
}

.robot-arm {
    transform-origin: 360px 210px;
    animation: scribble var(--scribbleDur) ease-in-out infinite;
}

.robot-paper {
    animation: paperGlow 3.6s ease-in-out infinite;
}

/* Messaging */
.processing-title {
    margin: 6px 0 2px 0;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text);
    text-shadow: 0 0 6px rgba(57, 255, 182, 0.25);
}

.processing-sub {
    margin: 0;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.processing-micro {
    margin: 8px 0 0 0;
    color: var(--accent);
    letter-spacing: 0.05em;
    font-size: 0.92rem;
    text-shadow: 0 0 8px rgba(57, 255, 182, 0.2);
}

.queue-pos {
    margin: 6px 0 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* Inline actions */
.overlay-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.overlay-btn {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 0 0 rgba(57, 255, 182, 0);
}

.overlay-btn:hover {
    background: rgba(57, 255, 182, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(57, 255, 182, 0.12);
}

.overlay-btn:active {
    transform: translateY(0);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .robot-head,
    .robot-eye,
    .robot-arm,
    .robot-paper {
        animation: none !important;
    }
}
