/* assets/css/scan-progress.css
 * Scoped styles for the streaming scan progress indicator.
 * The container is .loading.scan-progress-host and shows the stage
 * breadcrumb bar, the active-stage phrase, the most recently located host
 * (discovery only) and the elapsed-time line, plus a hidden fallback note
 * that surfaces only if the Progress endpoint is unreachable.
 *
 * Hooks into theme variables (--accent-color, --contrast-color, --bs-primary)
 * already defined by main.css / Bootstrap.
 */

/* Suppress the legacy spinner pseudo-element when our progress bar is the
 * loading host; the animated bar itself is the live indicator now. */
.cx-form .loading.scan-progress-host:before {
    content: none;
    display: none;
    margin: 0;
    border: 0;
    width: 0;
    height: 0;
    -webkit-animation: none;
    animation: none;
}

/* Container layout */
.scan-progress-host .scan-progress-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Stage breadcrumb (filled by scanProgress.js): Discovery, Checks, Second
 * pass, Verification, Report. Each stage has its own track: finished stages are
 * full, the current one shows its percentage or moving stripes, later ones
 * are empty. Themed to the brand accent; green when the scan completes,
 * red on the stage where it stopped. */
.scan-progress-host .scan-stages {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.scan-progress-host .scan-stage-track {
    display: block;
    height: 10px;
    overflow: hidden;
    border-radius: 5px;
    background: color-mix(in srgb, var(--accent-color, #0d6efd), transparent 85%);
}
.scan-progress-host .scan-stage-fill {
    display: block;
    height: 100%;
    width: 0;
    background-color: var(--accent-color, var(--bs-primary, #0d6efd));
    transition: width 600ms ease, background-color 300ms ease;
}
.scan-progress-host .scan-stage.is-moving .scan-stage-fill {
    background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%,
        transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%);
    background-size: 1rem 1rem;
    animation: scan-stage-stripes 1s linear infinite;
    opacity: .75;
}
.scan-progress-host .scan-stage.is-complete .scan-stage-fill {
    background-color: #059652; /* matches .sent-message green from main.css */
}
.scan-progress-host .scan-stage.is-error .scan-stage-fill {
    background-color: #df1529; /* matches .error-message red from main.css */
}
.scan-progress-host .scan-stage-label {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
    opacity: .6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scan-progress-host .scan-stage.is-done .scan-stage-label { opacity: .85; }
.scan-progress-host .scan-stage.is-current .scan-stage-label { opacity: 1; font-weight: 600; }
@keyframes scan-stage-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* Active-stage line: primary text below the bar.
 * Reserve a baseline of vertical space so a brief empty-string state
 * during phrase rotation doesn't reflow the form. */
.scan-progress-host #scan-progress-phrase {
    min-height: 1.4em;
    font-weight: 500;
    color: inherit;
}

/* Elapsed time: monospace so the digits don't jiggle as the seconds
 * tick over, with a gentle fade so re-renders feel smooth rather than
 * abrupt. */
.scan-progress-host #scan-progress-elapsed {
    min-height: 1.25em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
    color: color-mix(in srgb, var(--accent-color, #0076d4), transparent 15%);
    transition: opacity 300ms ease;
    opacity: 1;
}

.scan-progress-host #scan-progress-elapsed:empty {
    opacity: 0;
}

/* Discovery detail: the most recently located host; empty outside
 * discovery. */
.scan-progress-host #scan-progress-activity {
    min-height: 1.25em;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
}
.scan-progress-host #scan-progress-activity:empty {
    display: none;
}

/* Muted "progress unavailable" fallback note: hidden by default,
 * shown by scanProgress.js after several polls without usable progress,
 * or when a scan nears the platform time limit. */
.scan-progress-host #scan-progress-unavailable {
    font-style: italic;
}
@media (prefers-reduced-motion: reduce) {
    .scan-progress-host .scan-stage-fill {
        transition: none;
    }
    .scan-progress-host .scan-stage.is-moving .scan-stage-fill {
        animation: none;
    }
}

/* Error banner: keep long messages readable and give it focus styling. */
.cx-form .error-message {
    font-weight: 400;
    line-height: 1.45;
}
.cx-form .error-message strong {
    font-weight: 700;
}
.cx-form .error-message:focus {
    outline: 3px solid rgba(223, 21, 41, .35);
    outline-offset: 2px;
}

/* Multi-domain scans (form/multiScan.js) */
.arc-multi { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; box-shadow: 0 6px 18px rgba(15, 35, 64, .06); }
.arc-multi-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.arc-multi-list { list-style: none; margin: 0; padding: 0; }
.arc-multi-row { display: grid; grid-template-columns: minmax(140px, 1.3fr) minmax(120px, 2fr) minmax(150px, auto); gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid #f0f2f5; }
.arc-multi-row:first-child { border-top: 0; }
.arc-multi-name { font-weight: 600; overflow-wrap: anywhere; }
.arc-multi-bar { height: 8px; border-radius: 999px; }
.arc-multi-state { display: flex; gap: 10px; align-items: center; justify-content: flex-end; text-align: right; }
.arc-multi-score { font-weight: 700; color: #0f2340; }
@media (max-width: 575.98px) {
    .arc-multi-row { grid-template-columns: 1fr; gap: 6px; }
    .arc-multi-state { justify-content: flex-start; text-align: left; }
}
