:root {
    --navy:        #0d1f35;
    --ocean:       #1a4a72;
    --aqua:        #0096b7;
    --aqua-light:  #b8e8f5;
    --surface:     #f4f7fb;
    --border:      #dde3ec;
    --muted:       #6b7a8d;
    --o2-color:    #5B9BD5;
    --he-color:    #D4A843;
    --n2-color:    #8A9BB0;
}

html { background: var(--surface); }
body { background: none; color: #1a2840; font-size: 0.9rem; }

/* ── Page background ─────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('diver.jpg') center center / cover no-repeat;
    filter: grayscale(50%) saturate(0.5) brightness(1.1);
    opacity: 0.3;
    z-index: -1;
}

/* ── Header ─────────────────────────────── */
.app-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--ocean) 100%);
    color: #fff;
    padding: 1.5rem 0;
    border-bottom: 3px solid var(--aqua);
}
.app-header h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.app-header .tagline { color: var(--aqua-light); font-size: 0.8rem; }

/* ── Cards ───────────────────────────────── */
.card {
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border);
    border-top: 3px solid var(--aqua);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(10,22,40,0.07);
}
.card-body { padding: 1rem; }
.card-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

/* ── Input groups ────────────────────────── */
.input-group-text {
    background: #eef2f8;
    border-color: var(--border);
    color: var(--muted);
    font-size: 0.78rem;
    min-width: 3.2rem;
    justify-content: center;
}
.input-group-sm .form-control {
    text-align: right;
    font-weight: 600;
    font-size: 0.88rem;
    border-color: var(--border);
}
.form-control:focus {
    border-color: var(--aqua);
    box-shadow: 0 0 0 0.18rem rgba(0,150,183,0.18);
}

/* ── Gas composition bar ─────────────────── */
.gas-bar {
    height: 7px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--border);
    margin-top: 0.8rem;
    display: flex;
}
.gas-bar-o2 { background: var(--o2-color); transition: width 0.25s ease; }
.gas-bar-he { background: var(--he-color); transition: width 0.25s ease; }
.gas-bar-n2 { background: var(--n2-color); transition: width 0.25s ease; }
.gas-legend {
    display: flex;
    gap: 0.9rem;
    margin-top: 0.4rem;
    font-size: 0.7rem;
    color: var(--muted);
}
.gas-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Accordion (Quick Presets / Best Mix) ── */
#targetAccordion { border-radius: 7px; overflow: hidden; }
#targetAccordion .accordion-item  { background: transparent; border-color: var(--border); }
#targetAccordion .accordion-button {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ocean);
    background: transparent;
    padding: 0.45rem 0.7rem;
}
#targetAccordion .accordion-button:not(.collapsed) {
    color: var(--ocean);
    background: #eef2f8;
    box-shadow: none;
}
#targetAccordion .accordion-button:focus { box-shadow: none; }
#targetAccordion .accordion-button::after { filter: hue-rotate(180deg) brightness(0.6); }
#targetAccordion .accordion-body { padding: 0.5rem 0.7rem 0.7rem; }

/* ── Info buttons ────────────────────────── */
.info-btn {
    background: none;
    border: none;
    padding: 0 0 0 0.25rem;
    color: var(--aqua);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
    vertical-align: middle;
}
.info-btn:hover { opacity: 1; }
.popover { max-width: 280px; font-size: 0.82rem; }
.popover-header { font-size: 0.82rem; font-weight: 700; }
.popover a { color: var(--aqua); }

/* ── Preset pills ────────────────────────── */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
}
.preset-btn {
    border-radius: 20px;
    font-size: 0.73rem;
    padding: 0.2rem 0;
    border: 1px solid var(--border);
    color: var(--ocean);
    background: rgba(255,255,255,0.7);
    font-weight: 600;
    transition: all 0.15s;
    text-align: center;
    width: 100%;
}
.preset-btn:hover { background: var(--ocean); border-color: var(--ocean); color: white; }

/* ── Best Mix panel ──────────────────────── */
.best-mix-panel {
    background: rgba(240,246,251,0.7);
    border: 1px solid #cde2f0;
    border-radius: 8px;
    padding: 0.85rem 0.9rem;
}
#bm_mix   { font-size: 2rem; font-weight: 800; color: var(--ocean); line-height: 1; }
#bm_stats { font-size: 0.75rem; }

/* ── Fill sequence steps ─────────────────── */
.step-card {
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--ocean);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-name { font-weight: 700; font-size: 0.88rem; }
.step-pressure { font-size: 0.75rem; color: var(--muted); }
.step-arrow { color: var(--aqua); margin: 0 2px; }
.delta-pos { color: #2a7a46; }
.delta-neg { color: #c0392b; }
.step-finish { font-size: 1.15rem; font-weight: 800; color: var(--navy); text-align: right; line-height: 1.3; white-space: nowrap; }
.step-finish-delta { font-size: 0.75rem; font-weight: 600; }
.step-result-mix { font-size: 0.72rem; color: var(--muted); text-align: right; white-space: nowrap; }

/* ── Analysis cards ──────────────────────── */
.analysis-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}
.analysis-row:last-child { border-bottom: none; }
.analysis-label { font-size: 0.76rem; color: var(--muted); }
.analysis-depth { font-weight: 700; font-size: 0.92rem; color: var(--navy); }

/* ── Loading ─────────────────────────────── */
#loading .spinner-border { color: var(--aqua); width: 1.8rem; height: 1.8rem; }
#loading .text-muted     { font-size: 0.8rem; }

/* ── Result section headings ─────────────── */
.result-heading {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--aqua);
    display: inline-block;
}

/* ── Apply button ────────────────────────── */
.btn-apply {
    background: var(--ocean);
    color: white;
    border-radius: 6px;
}
.btn-apply:hover { background: var(--navy); color: white; }

/* ── Footer disclaimer ───────────────────── */
.app-footer {
    background: rgba(13,31,53,0.82);
    color: #9bb4cc;
    font-size: 0.72rem;
    padding: 1.25rem 0;
    margin-top: 2rem;
    border-top: 1px solid rgba(0,150,183,0.3);
}
.app-footer strong { color: #c8dded; }
