/* =========================================================
   BudgetOne – Single-Budget Dashboard Styles
   ========================================================= */

/* ── Consistent panel headers ─────────────────────────── */
.dashboard-top-row .card-header,
.dashboard-bottom-row .card-header {
    font-size: 0.9rem;
}

.dashboard-top-row .card-header .fw-semibold,
.dashboard-bottom-row .card-header .fw-semibold {
    font-size: 0.9rem;
}

/* ── Forecast totals panel ─────────────────────────────── */
.forecast-card {
    border-left-width: 4px !important;
    border-left-style: solid !important;
    transition: box-shadow 0.15s ease;
}

.forecast-card:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1) !important;
}

.forecast-card.income  { border-left-color: #198754 !important; }
.forecast-card.expense { border-left-color: #dc3545 !important; }
.forecast-card.transfer-out { border-left-color: #0dcaf0 !important; }
.forecast-card.transfer-in  { border-left-color: #6f42c1 !important; }

/* ── Surplus / Deficit emphasis card ───────────────────── */
#surplusDeficitCard {
    border-width: 2px !important;
    border-style: solid !important;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

#surplusDeficitCard.surplus {
    border-color: #198754 !important;
    background-color: #f0fff4 !important;
}

#surplusDeficitCard.deficit {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

#surplusDeficitCard.tight {
    border-color: #ffc107 !important;
    background-color: #fffbf0 !important;
}

#surplusDeficitAmount {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ── Chart ─────────────────────────────────────────────── */
#chartContainer {
    min-height: 0;
    padding: 0.25rem !important;
}

/* ── Transactions grid – row colour coding ─────────────── */
.e-grid .row-income td {
    background-color: #d1e7dd !important;
}

.e-grid .row-expense td {
    background-color: #fff3cd !important;
}

/* ── Category breakdown panel ──────────────────────────── */
.category-item {
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.category-item:hover {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
    background-color: rgba(0,0,0,0.03) !important;
}

.category-item.income {
    border-left-color: #198754;
    background-color: #f0fff4;
}

.category-item.expense {
    border-left-color: #fd7e14;
    background-color: #fff8f0;
}

.category-item.transfer {
    border-left-color: #0dcaf0;
    background-color: #f0fdff;
}

.category-item .category-total {
    font-weight: 600;
    font-size: 0.95rem;
}

.category-item .category-count {
    font-size: 0.78rem;
    color: #6c757d;
}

/* Active (filtered) category gets a stronger highlight */
.category-item.active-filter {
    box-shadow: 0 0 0 2px #0d6efd inset;
}

/* ── Compact overview panel ──────────────────────────────
   Squeeze the Overview card so it only takes the height it
   needs, then the chart card matches via h-100.            */
.dashboard-top-row .overview-card .card-body {
    padding: 0.4rem 0.75rem !important;
}

.dashboard-top-row .forecast-card .card-body {
    padding: 0.15rem 0.5rem !important;
}

.dashboard-top-row #forecastTotals {
    gap: 0.15rem !important;
}

.dashboard-top-row #surplusDeficitCard .card-body {
    padding: 0.25rem !important;
}

.dashboard-top-row #surplusDeficitAmount {
    font-size: 1rem;
}

.dashboard-top-row .mb-3 {
    margin-bottom: 0.25rem !important;
}

.dashboard-top-row .overview-card .card-header {
    padding: 0.25rem 0.75rem !important;
}

/* ── Sticky categories column ────────────────────────────
   Categories panel sticks in place while user scrolls
   past the transactions grid.                              */
.dashboard-bottom-row .col-lg-4 {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
    z-index: 90;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 991.98px) {
    #chartContainer {
        min-height: 220px;
    }

    .category-item {
        padding: 0.5rem 0.75rem !important;
    }

    /* Disable sticky on mobile — stacking layout */
    .dashboard-top-row,
    .dashboard-bottom-row .col-lg-4 {
        position: static;
    }
}

@media (max-width: 767.98px) {
    #surplusDeficitAmount {
        font-size: 1.25rem;
    }
}
