/* ============================
   Basic Reset & Global Styles
   ============================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    line-height: 1.6;
}

/* ============================
   Dashboard Container Layout
   ============================ */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ============================
   Sidebar Styling
   ============================ */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    color: #27ae60;
    letter-spacing: 1px;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #bdc3c7;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-menu li a:hover {
    background-color: #34495e;
    color: white;
    border-left-color: #27ae60;
    padding-left: 25px;
}

.nav-menu li a.active {
    background-color: #34495e;
    color: white;
    border-left-color: #27ae60;
}

/* ============================
   Main Content Area
   ============================ */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: #f4f7fa;
}

/* ============================
   Main Header
   ============================ */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
}

.main-header h1 {
    font-size: 1.8em;
    color: #2c3e50;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.current-balance {
    font-weight: bold;
    font-size: 1.2em;
    color: #27ae60;
    padding: 8px 16px;
    background-color: rgba(39, 174, 96, 0.1);
    border-radius: 6px;
}

.user-profile {
    padding: 8px 16px;
    background-color: #2c3e50;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background-color: #34495e;
}

/* ============================
   Overview Cards
   ============================ */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.card p {
    color: #7f8c8d;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card h2 {
    font-size: 2em;
    margin-top: 5px;
    font-weight: 700;
}

/* Budget Color Coding */
.total-spent h2 {
    color: #e74c3c;
}

.total-income h2 {
    color: #27ae60;
}

.savings-rate h2 {
    color: #f39c12;
}

.top-category h2 {
    color: #3498db;
}

/* ============================
   Charts and Logs Grid
   ============================ */
.charts-logs-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

/* ============================
   Transaction Table Panel
   ============================ */
.table-panel {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table-panel h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3em;
}

.transaction-log table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.transaction-log th,
.transaction-log td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid #ecf0f1;
}

.transaction-log th {
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    font-size: 0.85em;
    background-color: #f8f9fa;
}

.transaction-log tbody tr {
    transition: background-color 0.2s ease;
}

.transaction-log tbody tr:hover {
    background-color: #f8f9fa;
}

.transaction-log .income {
    color: #27ae60;
    font-weight: bold;
}

.transaction-log .expense {
    color: #e74c3c;
    font-weight: bold;
}

/* ============================
   Spending Breakdown Chart
   ============================ */
.chart-panel {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chart-panel h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3em;
}

.category-bar {
    margin-bottom: 25px;
}

.category-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.category-info p {
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
}

.category-info span {
    font-weight: bold;
    color: #7f8c8d;
}

.bar-container {
    background-color: #ecf0f1;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    position: relative;
}

.bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}

/* Category-Specific Bar Colors */
.food .bar {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.transport .bar {
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
}

.bills .bar {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
}

.housing .bar {
    background: linear-gradient(90deg, #8e44ad 0%, #9b59b6 100%);
    /* Purple */
}

.shopping .bar {
    background: linear-gradient(90deg, #e84393 0%, #fd79a8 100%);
    /* Pink */
}

.medical .bar {
    background: linear-gradient(90deg, #00b894 0%, #55efc4 100%);
    /* Teal */
}

.loans .bar {
    background: linear-gradient(90deg, #2d3436 0%, #636e72 100%);
    /* Dark Grey */
}

/* ============================
   Responsive Design
   ============================ */
@media (max-width: 1200px) {
    .charts-logs-grid {
        grid-template-columns: 1fr;
    }

    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 10px 0;
    }

    .nav-menu ul {
        display: flex;
        justify-content: space-around;
    }

    .nav-menu li a {
        padding: 10px 15px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-menu li a:hover,
    .nav-menu li a.active {
        border-left: none;
        border-bottom-color: #27ae60;
        padding-left: 15px;
    }

    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-info {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .overview-cards {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 15px;
    }

    .card h2 {
        font-size: 1.5em;
    }

    .main-header h1 {
        font-size: 1.4em;
    }

    .current-balance {
        font-size: 1em;
    }

    .transaction-log th,
    .transaction-log td {
        padding: 8px 4px;
        font-size: 0.85em;
    }
}