/* ------------------------------------------------------------------
   progress.css — long-job overlay (model load / solve progress bar).

   Rendered by js/progress-ui.js. Uses the same CSS custom properties
   as the rest of the app so it follows the light / sepia themes.
   ------------------------------------------------------------------ */

.job-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 18, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: job-fade 120ms ease-out;
}
@keyframes job-fade { from { opacity: 0; } to { opacity: 1; } }

.job-card {
    width: min(460px, 92vw);
    padding: 20px 22px 16px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    color: var(--text);
}

.job-head { margin-bottom: 14px; }
.job-title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 0.2px;
}
.job-sub {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--text2);
}

/* ---- the bar ------------------------------------------------------ */
.job-bar { margin: 0 0 12px; }
.job-track {
    position: relative;
    height: 9px;
    border-radius: 999px;
    background: var(--panel2);
    border: 1px solid var(--border);
    overflow: hidden;
}
.job-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    border-radius: 999px;
    /* The fill carries a soft glow of its own so the bar reads as
       "energy" rather than a flat progress rectangle. */
    background: linear-gradient(90deg,
        var(--accent) 0%,
        var(--accent2) 100%);
    box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent),
                0 0 22px color-mix(in srgb, var(--accent2) 30%, transparent);
    transition: width 120ms linear;
}

/* Indeterminate sweep for the window before the first real fraction
   arrives (the first assembly step cannot yield to the browser). */
.job-sheen {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38%;
    border-radius: 999px;
    background: linear-gradient(90deg,
        transparent,
        color-mix(in srgb, var(--accent) 45%, transparent),
        transparent);
    opacity: 0;
}
.job-overlay.is-indeterminate .job-sheen {
    opacity: 1;
    animation: job-sweep 1.15s ease-in-out infinite;
}
.job-overlay.is-indeterminate .job-fill { width: 100% !important; opacity: 0.10; }
@keyframes job-sweep {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* ---- phase / detail ------------------------------------------------ */
.job-phase {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    min-height: 17px;
}
.job-detail {
    margin-top: 3px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text2);
    min-height: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- meta chips ---------------------------------------------------- */
.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.job-meta:empty { display: none; }
.job-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--panel2);
    border: 1px solid var(--border);
    font-size: 11px;
}
.job-chip b { color: var(--accent); font-weight: 650; }
.job-chip i { color: var(--text2); font-style: normal; }

/* ---- footer -------------------------------------------------------- */
.job-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.job-time {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text2);
}
.job-cancel {
    font-family: var(--font);
    font-size: 11.5px;
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--text);
    background: var(--panel2);
    border: 1px solid var(--border);
    cursor: pointer;
}
.job-cancel:hover { border-color: var(--danger); color: var(--danger); }
.job-cancel:active { transform: translateY(1px); }

/* Light / sepia: the dark scrim is too heavy over a pale background. */
html[data-theme="light"] .job-overlay { background: rgba(60, 56, 46, 0.34); }
html[data-theme="sepia"] .job-overlay { background: rgba(80, 66, 42, 0.34); }

/* ---- Notifications (toasts) -------------------------------------------
   Replacements for the blocking alert() calls on the model-load and
   analysis paths. Sits ABOVE the job overlay (z-index 9500 > 9000) so a
   message raised while a job is running is never hidden behind it. */
.toast-host {
    position: fixed;
    right: 14px;
    bottom: 34px;              /* clear of the status bar */
    z-index: 9500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, 80vw);
    padding: 9px 10px 9px 13px;
    border-radius: 8px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.35;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    animation: toast-in 180ms ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.toast-out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.toast-msg { white-space: pre-wrap; word-break: break-word; }
.toast-x {
    flex: 0 0 auto;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--text2);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}
.toast-x:hover { color: var(--text); border-color: var(--border); }

/* The dismiss control measured 24x21 - under 44, and it is the one control
   that must be reachable one-handed to clear a notification covering the
   screen. Grown to 44 on touch devices. */
@media (pointer: coarse) {
    .toast-x {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* The measured 24x14 remove control reappears inside a toast's action row;
       sized here too rather than relying on the panel rule, which is scoped to
       `.data-table`. */
    .toast .remove-btn {
        min-width: 34px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

.toast-success { border-left-color: var(--success); }
.toast-warn    { border-left-color: var(--warning); }
.toast-error   { border-left-color: var(--danger); }
.toast-warn .toast-msg   { color: var(--warning); }
.toast-error .toast-msg  { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
    .toast-out { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
    .job-overlay { animation: none; }
    .job-fill { transition: none; }
    .job-overlay.is-indeterminate .job-sheen { animation: none; opacity: 0.35; left: 30%; }
}
