.sidebar {
    height: 100vh;
    background-color: #343a40;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #6c757d #343a40;
    position: fixed;
    z-index: 1000;
    width: 250px;
}

/* Add no-transition class to prevent animations */
.sidebar.no-transition {
    transition: none !important;
}

/* Only apply transitions when no-transition class is not present */
.sidebar:not(.no-transition) {
    transition: all 0.3s ease;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar.collapsed .sidebar-title-collapsed {
    display: inline-block !important;
}

.sidebar:not(.collapsed) .sidebar-title-collapsed {
    display: none;
}

.sidebar.collapsed .toggle-icon-expanded {
    display: none;
}

.sidebar:not(.collapsed) .toggle-icon-collapsed {
    display: none;
}

.sidebar.collapsed #sidebarToggle i {
    transform: rotate(180deg);
}

.sidebar:not(.collapsed) #sidebarToggle i {
    transform: rotate(180deg);
}

.sidebar .nav-link {
    font-size: 0.95rem;
    padding: 10px;
    color: #f8f9fa;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar .nav-link:hover {
    background-color: #495057;
    color: #ffffff;
}

.sidebar .nav-link.active {
    font-weight: bold;
    color: #f8f9fa;
    background-color: #495057;
}

.sidebar .nav-link i {
    margin-right: 8px;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #343a40;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #6c757d;
    border-radius: 10px;
    border: 1px solid #343a40;
}

/* Mobile sidebar styles */
.offcanvas-body .nav-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.offcanvas-body .nav-link:hover {
    background-color: #495057;
}

/* Toggle button styling */
#sidebarToggle {
    color: white;
    background-color: transparent;
    border: none;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

#sidebarToggle:focus {
    outline: none;
    box-shadow: none;
}

/* Main content adjustments */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
}

.main-content.no-transition {
    transition: none !important;
}

.main-content:not(.no-transition) {
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 60px;
    width: calc(100% - 60px);
}

/* Mobile header bar */
.mobile-header {
    background-color: #343a40;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.row-one-line {
    white-space: nowrap;
}

.row-one-line td, .row-one-line th {
    white-space: nowrap;
}

main.authorized {
    width: 83.3333%;
    overflow-y: auto;
}

.link-modal {
    cursor: pointer;
}

#modalInfo {
    min-width: 70%;
}

#modalInfo .modal-dialog {
    min-width: 70%;
}

.bg-pnl-positive {
    background-color: #d4edda;
}

.bg-pnl-negative {
    background-color: #f8d7da;
}

.bg-pnl-neutral {
    background-color: #f8f9fa;
}

.bi-alpha {
    display: inline-block;
    width: 1em;
    height: 1em;
    background-image: url("../icons/alpha.1d315adbcba0.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    vertical-align: -0.125em;
    fill: currentColor;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .sidebar {
        display: none;
    }

    .offcanvas {
        width: 75%;
        max-width: 300px;
    }
}

/* Fix DataTables responsive behavior */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 767.98px) {
    .dataTables_wrapper .row {
        margin: 0;
    }
}

.tooltip-wide {
    --bs-tooltip-max-width: 400px;
}

/* Portfolio backtesting styles */
.portfolio-backtesting {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.portfolio-backtesting .text-muted {
    font-style: italic;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    color: #6f42c1;
}

.selected-alphas-badge-container {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}
.selected-alphas-label {
    font-weight: 500;
    color: #333;
}

.selected-alphas-badge-offset {
    align-self: flex-end;
    margin-top: 40px;
}

/* ── Stress Tests ──────────────────────────────────────────────────────────── */

.stress-tests-section {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Risk Summary Cards ───────────────────────────────────────── */
.stress-risk-card {
    flex: 1 1 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left-width: 4px;
    border-radius: 8px;
    padding: 14px 18px;
    position: relative;
}

.stress-risk-card--success { border-left-color: #198754; }
.stress-risk-card--warning { border-left-color: #ffc107; }
.stress-risk-card--danger  { border-left-color: #dc3545; }
.stress-risk-card--muted   { border-left-color: #ced4da; }

.stress-risk-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 10px;
}

.stress-risk-generated {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 0.68rem;
    color: #adb5bd;
}

.stress-risk-values {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stress-risk-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stress-risk-item-label {
    font-size: 0.72rem;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stress-risk-item-value {
    font-size: 1.0rem;
    font-weight: 700;
    line-height: 1;
}

.stress-risk-divider {
    width: 1px;
    height: 36px;
    background: #dee2e6;
}

/* ── Table ────────────────────────────────────────────────────── */
.stress-table {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.stress-header-row {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #6c757d;
    text-transform: uppercase;
}

.stress-col-episode {
    flex: 1 1 50%;
    min-width: 0;
}

.stress-col-metric {
    flex: 0 0 10%;
    text-align: center;
}

.stress-col-chevron {
    flex: 0 0 32px;
    text-align: center;
}

/* ── Period rows ──────────────────────────────────────────────── */
.stress-period-card {
    border-bottom: 1px solid #e9ecef;
}

.stress-period-card:nth-child(even) > .stress-summary-row {
    background: #fafafa;
}

.stress-period-card:last-child {
    border-bottom: none;
}

.stress-summary-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
    color: #212529;
}

.stress-summary-row:hover {
    background: #f0f4ff !important;
}

.stress-episode-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #212529;
}

.stress-episode-meta {
    font-size: 0.78rem;
    color: #868e96;
    margin-top: 3px;
}

.stress-summary-row .stress-col-metric {
    font-size: 0.92rem;
    font-weight: 600;
}

.stress-chevron {
    transition: transform 0.25s ease;
    color: #adb5bd;
    font-size: 0.85rem;
}

.stress-summary-row:not(.collapsed) .stress-chevron {
    transform: rotate(180deg);
    color: #495057;
}

/* ── Detail panel ─────────────────────────────────────────────── */
.stress-detail-panel {
    padding: 20px 24px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.stress-detail-header {
    font-size: 0.9rem;
    color: #495057;
}

.stress-sub-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #868e96;
    text-transform: uppercase;
}

.stress-metal-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    height: 100%;
}

.stress-metal-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.stress-metal-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.stress-metal-vol {
    font-size: 0.72rem;
    margin-top: 2px;
}

.stress-metric-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    height: 100%;
}

.stress-metric-label {
    font-size: 0.72rem;
    color: #6c757d;
    margin-bottom: 4px;
}

.stress-metric-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.stress-metric-value-num {
    font-size: 1.05rem;
    font-weight: 700;
    color: #212529;
}

.stress-chart-container {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    min-height: 220px;
}

.stress-chart-placeholder {
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #ced4da;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}
