/* ══════════════════════════════════════════════════════════════
   PATTERN — Loading overlay
   Full-screen overlay with spinner and a single status line.
   Use for long-running async operations (analysis, upload, processing).

   Markup (STRATEGIANALYS single-phase /analysera, 2026-05-30):
     <div class="loading-overlay" data-state="hidden"
          role="status" aria-live="polite">
       <div class="spinner" aria-hidden="true"></div>
       <p class="loading-text">Analyserar dokumentet</p>
       <p class="loading-elapsed">0:12</p>
     </div>

   The .loading-steps checklist was removed when the tvåstegs-flow
   was reverted — there is now nothing to progress through, just one
   server-side analysis pass. The .loading-step* CSS rules below are
   retained for any other STRATEGIOS app that still uses a checklist.

   Show/hide via JS: toggle .loading-overlay--visible or set
   data-state="visible". See shared/js/loading-overlay.js.
   ══════════════════════════════════════════════════════════════ */

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.92);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-overlay--visible,
.loading-overlay[data-state="visible"] {
    display: flex;
}

.loading-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--white);
    margin-top: var(--s-6);
    margin-bottom: var(--s-4);
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* a11y: honour OS-level reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.5);
    }
    .loading-step {
        transition: none;
    }
}

.loading-steps {
    list-style: none;
    padding: 0;
    margin: var(--s-4) 0 0 0;
    text-align: left;
    min-width: 18rem;
}

.loading-step {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.3);
    padding: var(--s-1) 0;
    padding-left: 1.5rem;
    position: relative;
    transition: color 0.3s;
}

/* Pending state: dim dot prefix */
.loading-step::before {
    content: "○";
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.25);
}

/* Active state: highlighted text + filled dot */
.loading-step--active {
    color: rgba(255, 255, 255, 1);
}
.loading-step--active::before {
    content: "●";
    color: rgba(255, 255, 255, 0.85);
}

/* Done state: checkmark prefix */
.loading-step--done {
    color: rgba(255, 255, 255, 0.65);
}
.loading-step--done::before {
    content: "✓";
    color: rgba(255, 255, 255, 0.85);
}

/* Legacy visible state — kept for back-compat with templates that still
   use the older naming (e.g. shared/css consumers in other apps) */
.loading-step--visible,
.loading-step[data-state="visible"] {
    color: rgba(255, 255, 255, 0.9);
}

.loading-elapsed {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: var(--s-4);
}

/* Adaptive hint when analysis runs past expected duration */
.loading-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: var(--s-2);
    max-width: 22rem;
    text-align: center;
}
