/* Network Analysis Module CSS */

.network-container {
    padding: 20px;
}

/* Redundant .header-card-network removed - handled by components.css */

.network-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-top: 20px;
}

.network-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.network-controls .control-group {
    flex: 1;
    min-width: 150px;
}

.network-controls label {
    display: block;
    font-size: var(--font-sm);
    /* 12px */
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.network-controls select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: var(--font-base);
    /* 14px */
    transition: all 0.2s ease;
    cursor: pointer;
}

.network-controls select:hover {
    border-color: var(--primary-color);
}

.network-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.view-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
    padding-bottom: 0;
}

.view-tab-btn {
    padding: 14px 28px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: var(--font-base);
    /* 14px */
    opacity: 0.7;
}

.view-tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
    opacity: 1;
}

.view-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-tertiary);
    opacity: 1;
}

/* Sankey Diagram Styles */
#sankeyChart {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.sankey-node rect {
    fill-opacity: 0.9;
    shape-rendering: crispEdges;
    stroke-width: 0;
}

.sankey-node text {
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    fill: var(--text-primary);
}

.sankey-link {
    fill: none;
    stroke-opacity: 0.2;
    transition: stroke-opacity 0.2s;
}

.sankey-link:hover {
    stroke-opacity: 0.5;
}

/* Tooltip Styles */
.network-tooltip {
    position: absolute;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    font-size: var(--font-sm);
    /* 12px */
    line-height: 1.4;
    min-width: 180px;
    backdrop-filter: blur(10px);
}

/* Timeline Slider Styling */
.timeline-container input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

.timeline-container input[type=range]:focus {
    outline: none;
}

.timeline-container input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: rgba(var(--primary-rgb, 0, 123, 255), 0.15);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.timeline-container input[type=range]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 3px solid white;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.timeline-container input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

.timeline-container input[type=range]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: rgba(var(--primary-rgb, 0, 123, 255), 0.15);
    border-radius: 4px;
}

.timeline-container input[type=range]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 3px solid white;
}

/* Matrix Table Styles */
.exposure-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
    /* 12px */
}

.exposure-matrix th,
.exposure-matrix td {
    padding: 12px;
    border: 1px solid var(--border-color);
    text-align: right;
}

.exposure-matrix th {
    background: var(--bg-secondary);
    font-weight: 600;
    text-align: left;
}

.exposure-matrix tr:hover {
    background: var(--bg-tertiary);
}

.intensity-cell {
    font-weight: 600;
}

/* Empty State & Loading */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* backdrop-filter removed — no blur overlay during fetch */
}

@media (max-width: 1100px) {
    .network-grid {
        grid-template-columns: 1fr;
    }
}

/* Intra-Group Layout */
.intra-group-layout {
    margin-top: 20px;
}

.chart-box {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 820px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    overflow: hidden;
}

#chordChart,
#groupSankeyChart {
    width: 100%;
    height: 100%;
}

/* Chord Diagram Styles */
#chordChart svg {
    display: block;
    margin: 0 auto;
}

.chord-label {
    font-family: inherit;
    font-weight: 400;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .chord-label {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.chord-ribbon {
    fill-opacity: 0.6;
    stroke-opacity: 0.1;
    transition: fill-opacity 0.2s, stroke-opacity 0.2s;
}

.chord-ribbon:hover {
    fill-opacity: 0.9;
    stroke-opacity: 0.5;
}

/* Compact Controls Enhancements */
.network-controls select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px !important;
    appearance: none;
    -webkit-appearance: none;
}

/* Banking Network Extended Styles */
.banking-view-btn {
    min-width: 100px;
}

.banking-view-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.banking-sub-tab.active {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* Matrix Heatmap Table */
.matrix-table {
    border-collapse: collapse;
    width: 100%;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid var(--border-color);
}

.matrix-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px;
    font-size: 10px;
    text-align: center;
}

/* Stick first column (Row Headers) */
.matrix-table tr>th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-tertiary);
    border-right: 2px solid var(--border-color);
}

.matrix-table td {
    transition: background 0.2s;
    cursor: crosshair;
}

/* Multi-Dimensional Analysis Styles */
.cp-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.cp-checkbox-label:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.cp-checkbox-label:has(input:checked) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.cp-checkbox-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    cursor: pointer;
}

.multidim-flow-btn.active {
    font-weight: 700;
    border-width: 2px;
}

.multidim-flow-btn[data-flow="claims"].active {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}

.multidim-flow-btn[data-flow="liabilities"].active {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.multidim-flow-btn[data-flow="net"].active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.multidim-measure-btn.active {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Waterfall Chart Styles */
#multidim-waterfall-chart .bar {
    transition: opacity 0.2s;
}

#multidim-waterfall-chart .bar:hover {
    opacity: 0.8;
}

/* ===== LBS Sub-Module Header Card ===== */
.lbs-module-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 1px 4px var(--shadow-color);
}

.lbs-module-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.lbs-module-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 3px 0;
}

.lbs-module-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 8px 0;
    max-width: 480px;
    line-height: 1.4;
}

.lbs-module-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.lbs-badge {
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lbs-badge-source {
    background: rgba(59,130,246,0.12);
    color: #3b82f6;
    border: 1px solid rgba(59,130,246,0.25);
}

.lbs-badge-period {
    background: rgba(16,185,129,0.12);
    color: #10b981;
    border: 1px solid rgba(16,185,129,0.25);
}

.lbs-badge-pos-C {
    background: rgba(99,102,241,0.12);
    color: #6366f1;
    border: 1px solid rgba(99,102,241,0.25);
}

.lbs-badge-pos-L {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.25);
}

.lbs-badge-pos-N {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.25);
}

.lbs-module-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.lbs-control-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lbs-control-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.lbs-period-select {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    min-width: 106px;
}

.lbs-period-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.lbs-position-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.lbs-pos-btn {
    padding: 5px 10px;
    background: var(--bg-primary);
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.lbs-pos-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.lbs-pos-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.lbs-pos-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.lbs-topn-select {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    min-width: 70px;
}

.lbs-export-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.lbs-export-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.lbs-method-note {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
}

.lbs-view-tabs {
    display: flex;
    gap: 1px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    padding: 1px;
}

.lbs-view-tab {
    padding: 4px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 5px;
    transition: all 0.15s ease;
}

.lbs-view-tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: 0 1px 3px var(--shadow-color);
}

/* Sortable table for bank type */
.lbs-sortable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.lbs-sortable-table th {
    text-align: right;
    padding: 8px 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.lbs-sortable-table th:first-child {
    text-align: left;
}

.lbs-sortable-table th:hover {
    color: var(--primary-color);
}

.lbs-sortable-table th.sort-active {
    color: var(--primary-color);
}

.lbs-sortable-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    color: var(--text-primary);
}

.lbs-sortable-table td:first-child {
    text-align: left;
}

.lbs-sortable-table tr:hover td {
    background: var(--bg-secondary);
}

.lbs-sortable-table tr.top-row td {
    font-weight: 700;
}

.lbs-iso-badge {
    display: inline-block;
    padding: 1px 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-secondary);
    margin-right: 5px;
}

/* Sortable column indicator */
.sort-arrow::after {
    content: ' ↕';
    opacity: 0.4;
    font-size: 10px;
}

.sort-arrow-asc::after {
    content: ' ↑';
    opacity: 1;
    color: var(--primary-color);
}

.sort-arrow-desc::after {
    content: ' ↓';
    opacity: 1;
    color: var(--primary-color);
}

/* Insight cards row */
.lbs-insight-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.lbs-insight-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
}

.lbs-insight-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.lbs-insight-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.lbs-insight-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.dimension-panel {
    transition: transform 0.2s, box-shadow 0.2s;
}

.dimension-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}