﻿/* css/pages/bank.css — Bank page styles (PriceHistory-style layout) */

/* ─── Body & layout ─────────────────────────────────────────────────────── */
body {
    font-family: system-ui, -apple-system, sans-serif;
    padding: 12px;
    background: #fafafa;
    color: #333;
}

body.withTopBar {
    padding-top: 72px;
}

/* On wide screens reserve space for the fixed side panel */
@media (min-width: 901px) {
    body {
        padding-right: 188px;
    }
}

/* Heading legible over fox.png background */
body.no-side-decor h1 {
    color: #fff;
}

/* ─── Content wrapper (max-width + centering, matches PriceHistory) ──────── */
#bankIntro,
#ewCircSection,
#issuanceSection,
#backingSection,
#storeNetWorthSection,
#metalAllocSection,
#wealthDistSection,
#infraSection,
#velInflSection {
    max-width: min(1400px, calc(100vw - 24px));
    margin-left: auto;
    margin-right: auto;
}

/* ─── Section cards (matches .chart-card in pricehistory.css) ───────────── */
.section {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

/* ─── Section header ────────────────────────────────────────────────────── */
.bank-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.bank-section-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #374151;
}

/* ─── Chart containers ──────────────────────────────────────────────────── */
.bank-chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 8px;
}

/* ─── Controls row ──────────────────────────────────────────────────────── */
.bank-chart-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    align-items: center;
}

/* ─── Toggle buttons ────────────────────────────────────────────────────── */
.bank-toggle-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.bank-toggle-btn:hover {
    background: #e5e7eb;
}

.bank-toggle-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* ─── Mode select dropdowns ─────────────────────────────────────────────── */
.bank-mode-select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: 13px;
    color: #374151;
}

/* ─── Info / more-info buttons ──────────────────────────────────────────── */
.infoBtn {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    font-weight: 700;
    color: #111827;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}

.infoBtn:hover {
    border-color: #cbd5e1;
}

/* ─── Intro currency block ──────────────────────────────────────────────── */
.bank-intro-currency {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.bank-intro-currency-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

/* ─── Page guide collapsible ────────────────────────────────────────────── */
.bank-intro-guide-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.bank-intro-guide-panel {
    margin-top: 8px;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.91em;
}

/* ─── Wealth legend ─────────────────────────────────────────────────────── */
.wealth-legend-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.wealth-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

/* ─── Velocity / inflation sub-block ────────────────────────────────────── */
.bank-vel-chart-block {
    border-top: 1px solid #eee;
    padding-top: 14px;
    margin-top: 14px;
}

.bank-vel-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88rem;
    color: #374151;
    cursor: pointer;
}

.bank-infl-item-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 260px;
}

.bank-infl-item-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.bank-infl-item-row button {
    flex-shrink: 0;
}

.bank-infl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
}

.bank-infl-apply-btn {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.bank-infl-apply-btn:hover {
    filter: brightness(1.1);
}

/* ─── Dark-mode overrides ───────────────────────────────────────────────── */


[data-theme="dark"] .helpExample {
    background: #111827;
    border-color: #374151;
}

[data-theme="dark"] .infoBtn {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

[data-theme="dark"] .chip {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .chipText {
    color: #e5e7eb;
}

/* ─── Infrastructure table ──────────────────────────────────────────────── */
.infra-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
    margin-bottom: 4px;
}

#infraTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

#infraTable th {
    text-align: left;
    padding: 8px 12px;
    background: #f3f4f6;
    border-bottom: 2px solid #d1d5db;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
}

#infraTable td {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    color: #111827;
}

#infraTable .infra-data-row:hover td {
    background: #f9fafb;
}

#infraTable .infra-data-row td:first-child {
    white-space: nowrap;
    color: #6b7280;
    font-size: 0.88em;
}

#infraTable .infra-data-row td:nth-child(3) {
    white-space: nowrap;
    font-weight: 600;
}

#infraTable .infra-data-row td:last-child {
    white-space: nowrap;
}

/* ─── Inline details row ─────────────────────────────────────────────────── */
.infra-details-row td {
    padding: 0;
    background: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
}

.infra-details-box {
    padding: 14px 18px;
    font-size: 0.91em;
    line-height: 1.6;
}

.infra-details-meta {
    color: #6b7280;
    font-size: 0.87em;
    margin-bottom: 6px;
}

.infra-details-title {
    margin: 0 0 6px 0;
    font-size: 1em;
    font-weight: 700;
    color: #1e3a5f;
}

.infra-details-long {
    white-space: pre-wrap;
    color: #374151;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 0.9em;
}

.infra-details-items-label {
    font-weight: 700;
    margin-bottom: 4px;
    color: #374151;
}

.infra-details-items {
    margin-bottom: 10px;
}

.infra-detail-item {
    padding: 2px 0;
    font-size: 0.9em;
    color: #374151;
}

.infra-detail-qty {
    font-weight: 700;
    color: #1d4ed8;
    margin-right: 4px;
}

.infra-details-total {
    font-size: 0.92em;
    color: #374151;
    border-top: 1px solid #bae6fd;
    padding-top: 8px;
    margin-top: 4px;
}

/* ─── Infra controls bar ────────────────────────────────────────────────── */
.bank-infra-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ─── Infra pager ────────────────────────────────────────────────────────── */
.bank-infra-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.bank-infra-pager button {
    padding: 5px 16px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.12s;
}

.bank-infra-pager button:hover:not(:disabled) {
    background: #e5e7eb;
}

.bank-infra-pager button:disabled {
    opacity: 0.45;
    cursor: default;
}

/* ─── Info modal ────────────────────────────────────────────────────────── */
.modalCard {
    width: min(720px, 95vw);
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.modalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.modalTitle {
    font-weight: 800;
    color: #111827;
    font-size: 1.1rem;
}

.modalClose {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
}

.helpExample {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: #f9fafb;
    border: 1px solid #eee;
}

.helpExampleTitle {
    font-weight: 800;
    margin-bottom: 0.25rem;
}

/* ─── Fixed Section Toggle Panel ────────────────────────────────────────── */
.bank-section-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    background: #fff;
    border-radius: 12px 0 0 12px;
    box-shadow: -2px 0 14px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    transition: transform 0.25s ease;
    /* Ensure it clears the topbar */
    max-height: calc(100vh - 80px);
    overflow: visible;
}

/* Collapsed: slide the panel off to the right, leaving only the toggle tab visible */
.bank-section-panel.collapsed {
    transform: translateY(-50%) translateX(calc(100% - 28px));
}

.bank-section-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 10px 12px 10px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

.bank-section-panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
    white-space: nowrap;
}

/* Section toggle buttons inside the panel */
.bank-section-panel .bank-section-toggle-btn {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Panel collapse handle (left-edge tab) */
.bank-panel-toggle {
    flex-shrink: 0;
    width: 22px;
    background: #f3f4f6;
    border: none;
    border-right: 1px solid #e5e7eb;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    font-size: 16px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.bank-panel-toggle:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ─── Mobile: panel hidden by default, floating open button ─────────────── */
.bank-panel-open-btn {
    display: none;
}

@media (max-width: 900px) {
    body {
        padding-right: 12px;
    }

    .bank-section-panel {
        /* On mobile start fully hidden off-screen */
        transform: translateY(-50%) translateX(100%);
        border-radius: 12px 0 0 12px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.18);
    }

    .bank-section-panel.mobile-open {
        transform: translateY(-50%) translateX(0);
    }

    .bank-section-panel.collapsed {
        transform: translateY(-50%) translateX(calc(100% - 28px));
    }

    /* Floating open button, bottom-right */
    .bank-panel-open-btn {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 16px;
        z-index: 199;
        background: #2563eb;
        color: #fff;
        border: none;
        border-radius: 24px;
        padding: 8px 16px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
        cursor: pointer;
    }

    .bank-panel-open-btn:hover {
        background: #1d4ed8;
    }
}

/* ─── small utility ─────────────────────────────────────────────────────── */
.small {
    font-size: 0.88em;
    color: #6b7280;
}

/* ─── Item chips (used by inflation item selector) ──────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #eee;
    border-radius: 999px;
    background: #fafafa;
}

.chipColor {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.chipText {
    font-size: 0.9rem;
    font-weight: 600;
}

.chipRemove {
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    color: #dc2626;
    font-weight: 900;
    cursor: pointer;
}

.chipRemove:hover {
    color: #b91c1c;
}

.dropdown-wrap {
    margin-right: 40px;
}