/* Launch status panel: in-page overlay on /applications/ and the full-page
   /applications/launching/ view. Extracted from applications.html. */

/* ============================================
   Launch Status Panel
   ============================================ */
.launch-status-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 32, 39, 0.6);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.launch-status-modal.show { opacity: 1; }

.launch-status-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(15, 32, 39, 0.3);
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.launch-status-modal.show .launch-status-content {
    transform: translateY(0) scale(1);
}

[data-theme="dark"] .launch-status-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Header: dark in both themes (.on-dark in the markup, launch-status.js) */
.launch-status-header {
    /* theme-fixed: always-dark header */
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    color: #e2e8f0;
    --heading-color: #e2e8f0;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.launch-status-header h3 {
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
}
.launch-status-header .app-label {
    font-size: 0.8rem;
    margin-top: 2px;
    color: var(--on-hero-muted);    /* solid: 70% opacity fell below 4.5:1 on the teal end */
}

/* Orbital Spinner */
.orbital-spinner {
    width: 44px;
    height: 44px;
    position: relative;
    flex-shrink: 0;
}
.orbital-spinner .orbit {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: 50%;
}
.orbital-spinner .orbit:nth-child(1) {
    border-top-color: #64b5f6;
    animation: orbit-spin 1.2s linear infinite;
}
.orbital-spinner .orbit:nth-child(2) {
    inset: 5px;
    border-right-color: #81d4fa;
    animation: orbit-spin 1.8s linear infinite reverse;
}
.orbital-spinner .orbit:nth-child(3) {
    inset: 10px;
    border-bottom-color: #b3e5fc;
    animation: orbit-spin 2.4s linear infinite;
}
@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

/* Completed state replaces spinner with checkmark */
.launch-status-header .completion-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--success-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.launch-status-header .completion-icon.is-error {
    background: #b91c1c;
}

/* Body */
.launch-status-body {
    padding: 1.5rem 1.75rem;
}

/* Progress Steps */
.launch-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.launch-steps li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    position: relative;
}
.launch-steps li:last-child { padding-bottom: 0; }

/* Vertical connector line */
.launch-steps li::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 26px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.launch-steps li:last-child::before { display: none; }
[data-theme="dark"] .launch-steps li::before { background: #334155; }

/* Step indicator dot */
.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Pending: an empty disc with a ring, so upcoming steps stay visible */
.launch-steps li[data-state="pending"] .step-dot {
    background: var(--bg-tertiary);
    box-shadow: inset 0 0 0 2px var(--border-secondary);
    color: var(--text-muted);
}

/* Active: teal disc with a white glyph in light, light-blue disc with a dark glyph in dark */
.launch-steps li[data-state="active"] .step-dot {
    background: var(--accent);
    color: var(--text-inverse);
    box-shadow: 0 0 0 4px var(--accent-border);
    animation: step-pulse 2s ease-in-out infinite;
}
@keyframes step-pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--accent-border); }
    50% { box-shadow: 0 0 0 8px var(--accent-soft); }
}

/* Completed */
.launch-steps li[data-state="completed"] .step-dot {
    background: var(--success-solid);
    color: var(--on-solid);
}
.launch-steps li[data-state="completed"]::before {
    background: var(--success-solid);
}

/* Failed */
.launch-steps li[data-state="failed"] .step-dot {
    background: var(--danger-solid);
    color: var(--on-solid);
}

.step-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #334155;
    padding-top: 2px;
}
.step-label .step-detail {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}
[data-theme="dark"] .step-label { color: #e2e8f0; }

/* Elapsed Timer */
.launch-elapsed {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #64748b;
}
[data-theme="dark"] .launch-elapsed {
    border-top-color: #334155;
    color: #94a3b8;
}

/* VICE URL link (shown when ready) */
.vice-url-link {
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    padding: 0.6rem 1rem;
    background: var(--success-solid);
    color: var(--on-solid);
    border-radius: 8px;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.vice-url-link:hover { background: #166534; color: var(--on-solid); }

/* Footer */
.launch-status-footer {
    padding: 1rem 1.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
[data-theme="dark"] .launch-status-footer { border-top-color: #334155; }

/* Buttons: in the footer, and as links in the error actions (launch-status.js showError) */
.launch-status-footer .btn-dismiss,
.launch-error-actions .btn-dismiss {
    padding: 0.45rem 1rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}
.launch-status-footer .btn-dismiss:hover,
.launch-error-actions .btn-dismiss:hover {
    border-color: #94a3b8;
    color: #334155;
}
[data-theme="dark"] .launch-status-footer .btn-dismiss,
[data-theme="dark"] .launch-error-actions .btn-dismiss {
    border-color: #475569;
    color: #94a3b8;
}
[data-theme="dark"] .launch-status-footer .btn-dismiss:hover,
[data-theme="dark"] .launch-error-actions .btn-dismiss:hover {
    border-color: #64748b;
    color: #e2e8f0;
}

/* Teal in light, light blue with dark text in dark */
.launch-status-footer .btn-analyses,
.launch-error-actions .btn-analyses {
    padding: 0.45rem 1rem;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
    transition: background 0.2s;
}
.launch-status-footer .btn-analyses { display: none; }
.launch-status-footer .btn-analyses:hover,
.launch-error-actions .btn-analyses:hover {
    background: var(--accent-hover);
    color: var(--text-inverse);
}
.launch-error-actions .btn-dismiss,
.launch-error-actions .btn-analyses {
    display: inline-flex;
    align-items: center;
}

/* ============================================
   Full-page variant (/applications/launching/)
   ============================================ */
.launch-status-page {
    min-height: calc(100vh - var(--header-height, 64px));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
}
.launch-status-page .launch-status-content {
    position: static;
    transform: none;
    width: 100%;
    max-width: 560px;
    animation: none;
}
/* In dark the panel and the page share #1e293b: an outline keeps the panel's edge */
[data-theme="dark"] .launch-status-page .launch-status-content {
    border: 1px solid var(--border-primary);
}
.launch-error-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.25rem;
}
.launch-error-actions a {
    text-decoration: none;
}
.launch-status-body .launch-error-message {
    color: var(--danger-text);
    text-align: center;
    margin: 0.5rem 0 0;
}
