/* blueprints/peak_flood/static/peak_flood/peak_flood.css */
/* Scoped styles for widgets with no direct Bootstrap equivalent (KPI card,
   stat rows, editable C-breakdown table, map overlays). Page chrome
   (navbar, hero, sidebar, cards) comes from base.html / style.css, same as
   the IDF/PMP/Frequency pages. */

:root {
    --primary:       #006994;
    --primary-h:     #005a80;
    --primary-dim:   rgba(0,105,148,.1);
    --trace:         #d97706;
    --trace-dim:     #fef3c7;
    --trace-h:       #b45309;
    --success:       #059669;
    --surface:       #ffffff;
    --sf2:           #f8fafc;
    --sf3:           #f1f5f9;
    --border:        #e2e8f0;
    --text:          #0f172a;
    --muted:         #64748b;
    --dim:           #94a3b8;
    --r:             10px;
    --r-sm:          6px;
    --sh-sm:         0 1px 4px rgba(0,0,0,.08);
    --sh-lg:         0 12px 40px rgba(0,0,0,.18);
    --ease:          cubic-bezier(.4,0,.2,1);
    --t:             .18s;
}

.hidden { display: none !important; }

/* Results card: show the empty-state placeholder until #results-panel.open
   is set (by the existing render/clear JS), then swap to the real content. */
#results-panel #resultsContent { display: none; }
#results-panel.open #resultsPlaceholder { display: none; }
#results-panel.open #resultsContent { display: block; }

/* ── Map card ────────────────────────────────────────────────────────── */
#mapWrapper { position: relative; }
#map {
    height: 550px;
    width: 100%;
    border-radius: 0.9rem;
    z-index: 1;
}

/* Snapped-outlet coordinate chip, overlaid on the map (bottom center) */
#actionBar {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.97);
    border: 1px solid var(--border);
    border-radius: 50px;
    box-shadow: var(--sh-lg);
    padding: 8px 16px;
    white-space: nowrap;
    max-width: calc(100% - 28px);
}
.action-bar-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .5px;
}
.action-bar-coords {
    font-family: monospace;
    font-weight: 600;
    color: var(--text);
    background: var(--sf3);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* Longest-flow-path legend, overlaid on the map (top left) */
.flow-path-legend {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    background: rgba(255,255,255,.97);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--sh-sm);
}
.flow-path-legend-line {
    width: 24px;
    height: 3px;
    background: #d97706;
    border-top: 2px dashed #d97706;
}

/* Inline run-button spinner */
.spinner-inline {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin .75s linear infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Peak Discharge Estimate KPI card ───────────────────────────────── */
.qest-card {
    background: linear-gradient(135deg, var(--primary-dim) 0%, rgba(255,255,255,0.7) 100%);
    border: 1px solid rgba(0, 105, 148, 0.2);
    border-radius: var(--r);
    padding: 16px;
    margin-bottom: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.qest-rp-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--trace-h);
    background: var(--trace-dim);
    border-radius: 20px;
    padding: 3px 10px;
    margin-bottom: 8px;
}
.qest-val {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -.5px;
}
.qest-formula {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-top: 10px;
}
.qest-substituted {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 11px;
    color: var(--primary-h);
    margin-top: 3px;
}
.qest-components { margin-bottom: 4px; }

/* Result section label + stat rows (flow path stats, Tc/C/I/A breakdown) */
.result-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dim);
    letter-spacing: .6px;
    margin-top: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--sf3);
    padding-bottom: 4px;
}
.result-section-label:first-child { margin-top: 0; }

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--sf3);
    font-size: 12px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row-lbl { color: var(--muted); font-weight: 500; }
.stat-row-val {
    color: var(--text);
    font-weight: 600;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 11.5px;
}

.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--r-sm);
    padding: 10px 12px;
    color: #92400e;
    font-size: 12px;
    margin-bottom: 14px;
    line-height: 1.4;
}

/* ── Assumptions & Methods text blocks ──────────────────────────────── */
.assumptions-intro {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    background: var(--sf2);
    border-radius: var(--r-sm);
    padding: 9px 10px;
    margin: 0 0 14px;
}
.assumptions-intro strong { color: var(--text); }

.assumption-caption {
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    margin: 2px 0 6px;
}

.assumption-block { margin-bottom: 16px; }
.assumption-block-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--dim);
    margin-bottom: 5px;
}
.assumption-text { font-size: 12px; line-height: 1.5; color: var(--text); }
.assumption-formula {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--sf2);
    border-radius: var(--r-sm);
    padding: 6px 9px;
    margin-bottom: 6px;
}
.assumption-list {
    margin: 0 0 4px;
    padding-left: 18px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
}
.assumption-list li { margin-bottom: 3px; }

/* Editable per-land-cover C breakdown table */
.c-breakdown-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}
.c-breakdown-row {
    display: grid;
    grid-template-columns: 1fr 44px 60px;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--sf3);
}
.c-breakdown-name {
    font-size: 11.5px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.c-breakdown-frac {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}
.c-breakdown-input {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background-color: var(--sf2);
    color: var(--text);
    width: 100%;
    text-align: center;
}
.c-breakdown-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 105, 148, 0.15);
}
.c-breakdown-input:disabled {
    background: var(--sf3);
    color: var(--dim);
    cursor: not-allowed;
}

.assumptions-recompute-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}
.recompute-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    min-height: 14px;
}

/* ── Fullscreen loading overlay (shown during delineation/recompute) ──── */
#loadingOverlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.loading-card {
    background: #fff; border-radius: 14px;
    padding: 24px 32px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    box-shadow: var(--sh-lg); min-width: 200px; text-align: center;
}
.spinner-large {
    width: 36px; height: 36px;
    border: 3px solid var(--primary-dim);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}
.loading-main { font-size: 13px; font-weight: 600; color: var(--text); }
.loading-sub  { font-size: 11px; color: var(--muted); }

@media (max-width: 640px) {
    #map { height: 420px; }
    #actionBar { font-size: 11px; padding: 6px 12px; }
}
