/* 需要登入的頁面共用：「驗證帳號與權限中…」全螢幕進度特效 */
.auth-progress {
    --ap-card: rgba(255, 255, 255, 0.92);
    --ap-ink: #1f2937;
    --ap-muted: #6b7280;
    --ap-track: rgba(99, 102, 241, 0.16);
    --ap-done: #16a34a;
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 16px;
    background: radial-gradient(circle at 30% 20%, rgba(129, 140, 248, 0.55), transparent 55%),
        radial-gradient(circle at 75% 80%, rgba(236, 72, 153, 0.45), transparent 55%),
        rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: auth-progress-in 0.25s ease-out;
    transition: opacity 0.25s;
}

.auth-progress[hidden] {
    display: none;
}

.auth-progress.is-leaving {
    opacity: 0;
}

@media (prefers-color-scheme: dark) {
    .auth-progress {
        --ap-card: rgba(15, 23, 42, 0.9);
        --ap-ink: #f1f5f9;
        --ap-muted: #cbd5e1;
        --ap-track: rgba(129, 140, 248, 0.25);
        --ap-done: #4ade80;
    }
}

body.auth-progress-open {
    overflow: hidden;
}

.auth-progress-card {
    width: min(400px, 100%);
    padding: 28px 24px 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 22px;
    background: var(--ap-card);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    color: var(--ap-ink);
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
    text-align: center;
}

/* 三顆繞行的光點 */
.auth-progress-orbit {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    animation: auth-progress-spin 1.6s linear infinite;
}

.auth-progress-orbit span {
    position: absolute;
    top: 0;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    transform-origin: 7px 32px;
}

.auth-progress-orbit span:nth-child(2) {
    opacity: 0.7;
    transform: rotate(120deg);
}

.auth-progress-orbit span:nth-child(3) {
    opacity: 0.45;
    transform: rotate(240deg);
}

.auth-progress-title {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.auth-progress-bar {
    position: relative;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--ap-track);
}

.auth-progress-fill {
    position: relative;
    display: block;
    width: 0;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    transition: width 0.45s ease-out;
}

/* 進度條上的流光 */
.auth-progress-fill::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: auth-progress-shine 1.2s linear infinite;
    content: '';
}

.auth-progress-percent {
    margin: 8px 0 14px;
    color: var(--ap-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.auth-progress-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.auth-progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ap-muted);
    font-size: 0.95rem;
}

.auth-progress-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--ap-track);
    border-radius: 50%;
    font-size: 0.75rem;
}

.auth-progress-step.is-active {
    color: var(--ap-ink);
    font-weight: 700;
}

.auth-progress-step.is-active .auth-progress-icon {
    border-color: var(--ap-track);
    border-top-color: #6366f1;
    animation: auth-progress-spin 0.8s linear infinite;
}

.auth-progress-step.is-done {
    color: var(--ap-ink);
}

.auth-progress-step.is-done .auth-progress-icon {
    border-color: var(--ap-done);
    background: var(--ap-done);
    color: white;
}

.auth-progress-step.is-done .auth-progress-icon::before {
    content: '✓';
}

@keyframes auth-progress-in {
    from {
        opacity: 0;
    }
}

@keyframes auth-progress-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes auth-progress-shine {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-progress,
    .auth-progress-orbit,
    .auth-progress-fill::after,
    .auth-progress-step.is-active .auth-progress-icon {
        animation: none;
    }

    .auth-progress,
    .auth-progress-fill {
        transition: none;
    }
}
