/* ═══════════════════════════════════════════════════════════════
   Website Roast — Audit Loading Overlay
   Matches the existing SaaS design system (--wr-primary: #2563eb)
═══════════════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────────────── */
@keyframes wr-spin {
    to { transform: rotate(360deg); }
}

@keyframes wr-pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.25); }
    50%       { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
}

@keyframes wr-bar-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes wr-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes wr-step-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Backdrop ─────────────────────────────────────────────── */
#wr-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#wr-loader[hidden] { display: none !important; }

.wr-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ── Panel ────────────────────────────────────────────────── */
.wr-loader-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2rem 2rem 1.5rem;
    box-shadow:
        0 24px 64px rgba(15, 23, 42, 0.18),
        0 4px 16px rgba(15, 23, 42, 0.08);
    animation: wr-fade-up 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Brand row ────────────────────────────────────────────── */
.wr-loader-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.wr-loader-icon-ring {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    animation: wr-pulse-ring 2.4s ease-in-out infinite;
}

.wr-loader-brand span {
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: #0f172a;
}

/* ── Headline ─────────────────────────────────────────────── */
.wr-loader-headline {
    margin-bottom: 1.5rem;
}

.wr-loader-headline h2 {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
    margin: 0 0 0.25rem;
    line-height: 1.2;
}

.wr-loader-url {
    font-size: 0.825rem;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* ── Progress bar ─────────────────────────────────────────── */
.wr-loader-progress-wrap {
    margin-bottom: 1.5rem;
}

.wr-loader-progress-track {
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.wr-loader-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        #2563eb 0%,
        #3b82f6 40%,
        #60a5fa 60%,
        #2563eb 100%
    );
    background-size: 200% 100%;
    animation: wr-bar-shimmer 2s linear infinite;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.wr-loader-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wr-loader-pct {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2563eb;
    font-family: 'Inter', -apple-system, sans-serif;
}

.wr-loader-step-lbl {
    font-size: 0.75rem;
    color: #64748b;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* ── Steps list ───────────────────────────────────────────── */
.wr-loader-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.wr-loader-step {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 0.875rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    transition:
        background 0.25s ease,
        border-color 0.25s ease;
}

/* ── Step icon ────────────────────────────────────────────── */
.wr-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ── Step text ────────────────────────────────────────────── */
.wr-step-content {
    flex: 1;
    min-width: 0;
}

.wr-step-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #94a3b8;
    font-family: 'Inter', -apple-system, sans-serif;
    transition: color 0.25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wr-step-sub {
    display: block;
    font-size: 0.75rem;
    color: #cbd5e1;
    font-family: 'Inter', -apple-system, sans-serif;
    margin-top: 1px;
    transition: color 0.25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Step state (spinner / check) ────────────────────────── */
.wr-step-state {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wr-step-spinner {
    display: none;
    width: 18px;
    height: 18px;
}

.wr-step-spinner > div {
    width: 100%;
    height: 100%;
    border: 2px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: wr-spin 0.7s linear infinite;
}

.wr-step-check {
    display: none;
    font-size: 0.9rem;
    color: #059669;
    font-weight: 700;
}

/* ── Active step ──────────────────────────────────────────── */
.wr-loader-step.is-active {
    background: #eff6ff;
    border-color: #bfdbfe;
    animation: wr-step-in 0.3s ease both;
}

.wr-loader-step.is-active .wr-step-icon {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.wr-loader-step.is-active .wr-step-label {
    color: #1e40af;
}

.wr-loader-step.is-active .wr-step-sub {
    color: #3b82f6;
}

.wr-loader-step.is-active .wr-step-spinner {
    display: flex;
}

/* ── Done step ────────────────────────────────────────────── */
.wr-loader-step.is-done {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.wr-loader-step.is-done .wr-step-icon {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #059669;
}

.wr-loader-step.is-done .wr-step-label {
    color: #15803d;
}

.wr-loader-step.is-done .wr-step-sub {
    color: #4ade80;
}

.wr-loader-step.is-done .wr-step-check {
    display: block;
}

/* ── Footer note ──────────────────────────────────────────── */
.wr-loader-note {
    font-size: 0.775rem;
    color: #94a3b8;
    margin: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    font-family: 'Inter', -apple-system, sans-serif;
}

.wr-loader-note i {
    color: #059669;
    font-size: 0.85rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .wr-loader-panel {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 16px;
        max-width: 100%;
    }

    .wr-loader-headline h2 {
        font-size: 1.1rem;
    }

    .wr-step-sub {
        display: none;
    }

    .wr-loader-step {
        padding: 0.65rem 0.75rem;
    }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wr-loader-progress-fill {
        animation: none;
        background: #2563eb;
    }

    .wr-loader-panel {
        animation: none;
    }

    .wr-step-spinner > div {
        animation: none;
        border-color: #2563eb;
    }

    .wr-loader-icon-ring {
        animation: none;
    }
}
