/*
 * Run-mode styles
 * Matches the overall black-and-white aesthetic of the rest of the UI.
 */

/* ---- Experimental badge ---- */
.run-experimental-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    line-height: 1.4;
    vertical-align: middle;
}

/* ---- Progress overlay on the viewer ---- */
#run-overlay {
    z-index: 25;
    pointer-events: none;
}

.run-overlay-inner {
    width: 90%;
    max-width: 400px;
    pointer-events: auto;
}

.run-progress-track {
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-bottom: 6px;
    overflow: hidden;
}

.run-progress-fill {
    height: 100%;
    width: 0%;
    background: #000;
    border-radius: 2px;
    transition: width 0.2s ease;
}

/* ---- Run panel button tweaks ---- */
#run-left .btn-black:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#run-left .btn-black:disabled:hover {
    background: #111827;
}

/* ---- Calculation type button grid ---- */
.run-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.run-calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 6px;
    min-height: 34px;
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.run-calc-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}
.run-calc-btn.active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.run-calc-btn.active svg {
    stroke: #fff;
}
.run-calc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Model select styling ---- */
#run-model-select {
    background: #fff;
    border: 1px solid var(--border-strong, #cbd5e1);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 11px;
    color: #111827;
}

#run-model-select:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

/* ---- Results panel ---- */
.run-results-empty {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    padding: 24px 0;
}

/* ---- Error card ---- */
.run-error-card {
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    padding: 10px 12px;
}
.run-error-title {
    font-size: 11px;
    font-weight: 600;
    color: #b91c1c;
    margin-bottom: 4px;
}
.run-error-msg {
    font-size: 11px;
    color: #dc2626;
}

/* ---- SPE result cards ---- */
.run-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
}
.run-result-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
}
.run-result-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 4px;
}
.run-result-value {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
}
.run-result-unit {
    font-size: 10px;
    font-weight: 400;
    color: #64748b;
}

/* ---- Force list ---- */
.run-forces-section {
    margin-top: 12px;
}
.run-forces-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 6px;
}
.run-forces-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.run-force-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}
.run-force-atom {
    color: #475569;
}
.run-force-value {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 11px;
    color: #0f172a;
}

/* ---- Optimisation canvas ---- */
.run-opt-canvas,
.run-plot-container {
    display: block;
    width: 100%;
    height: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

/* Fullscreen: make the plot fill the available panel height */
:fullscreen .run-plot-container,
:fullscreen .run-opt-canvas {
    height: calc(100vh - 120px);
    max-height: none;
}
:fullscreen [id^="plotly-"],
:fullscreen [id="tsgeo-energy-plot"] {
    height: calc(100vh - 120px) !important;
    max-height: none;
}
:fullscreen {
    overflow-y: auto;
    background: #fff;
    padding: 16px;
}

/* ---- Plot toolbar (Image / CSV / Fullscreen) ---- */
.run-plot-toolbar {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}
/* Show toolbar on hover over the plot's parent container */
.card-surface:hover .run-plot-toolbar,
.run-plot-toolbar:hover {
    opacity: 1;
    pointer-events: auto;
}
.plot-toolbar-btn {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    backdrop-filter: blur(3px);
    transition: background .15s, color .15s;
}
.plot-toolbar-btn:hover {
    background: #ffffff;
    color: #0f172a;
}

.run-opt-info {
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
    text-align: center;
}
.run-opt-converged {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #15803d;
}
.run-opt-not-converged {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #b45309;
}
.run-opt-energy {
    display: block;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 11px;
    color: #0f172a;
    margin-top: 2px;
}
.run-opt-hint {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ---- Vibration frequency list ---- */
.run-vib-summary {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}
.run-vib-ok {
    color: #15803d;
}
.run-vib-warn {
    color: #b45309;
}
.run-vib-hint {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    margin-top: 8px;
}
