/* =====================
   BUDGET CALCULATOR CSS
   ===================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

.budget-wrapper {
    font-family: 'Poppins', sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

* { box-sizing: border-box; }

/* Header */
.budget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    color: white;
    margin-bottom: 25px;
}

.budget-header-icon { font-size: 48px; margin-bottom: 10px; }
.budget-header h1 { font-size: clamp(22px, 4vw, 32px); font-weight: 800; margin: 0 0 8px; }
.budget-header p { font-size: 15px; opacity: 0.85; margin: 0; }

/* Tabs */
.budget-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.budget-tab {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.budget-tab:hover { border-color: #667eea; color: #667eea; }
.budget-tab.active { background: linear-gradient(135deg, #667eea, #764ba2); color: white; border-color: transparent; }

/* Tab Content */
.budget-tab-content { display: none; }
.budget-tab-content.active { display: block; }

/* Two Column */
.budget-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .budget-two-col { grid-template-columns: 1fr; }
}

/* Sections */
.budget-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.budget-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 15px;
    color: white;
}

.budget-section-header.income { background: linear-gradient(135deg, #11998e, #38ef7d); }
.budget-section-header.fixed { background: linear-gradient(135deg, #f093fb, #f5576c); }
.budget-section-header.variable { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.budget-section-header.savings { background: linear-gradient(135deg, #667eea, #764ba2); }

.budget-add-btn {
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.budget-add-btn:hover { background: rgba(255,255,255,0.4); }

.budget-rows { padding: 15px; }

.budget-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.budget-input-text {
    flex: 2;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    transition: border 0.2s;
    outline: none;
}

.budget-input-text:focus { border-color: #667eea; }

.budget-input-num {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    transition: border 0.2s;
    outline: none;
}

.budget-input-num:focus { border-color: #667eea; }

.budget-del-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #ffe0e0;
    color: #f5576c;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.budget-del-btn:hover { background: #f5576c; color: white; }

.budget-section-total {
    padding: 12px 20px;
    background: #f8f9ff;
    font-weight: 700;
    font-size: 14px;
    color: #444;
    border-top: 1px solid #eee;
}

.budget-section-total span { color: #667eea; font-size: 16px; }

/* Summary Cards */
.budget-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .budget-summary-cards { grid-template-columns: repeat(2, 1fr); }
}

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

.budget-summary-card {
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    color: white;
}

.budget-summary-card.green { background: linear-gradient(135deg, #11998e, #38ef7d); }
.budget-summary-card.red { background: linear-gradient(135deg, #f093fb, #f5576c); }
.budget-summary-card.blue { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.budget-summary-card.purple { background: linear-gradient(135deg, #667eea, #764ba2); }

.bsc-icon { font-size: 28px; margin-bottom: 6px; }
.bsc-label { font-size: 12px; opacity: 0.85; margin-bottom: 4px; }
.bsc-value { font-size: 20px; font-weight: 800; }

/* Chart Box */
.budget-chart-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 25px;
}

.budget-chart-box h3 { font-size: 16px; font-weight: 700; margin: 0 0 20px; color: #333; }

#budgetDonut { max-height: 250px; }

/* Rule Box */
.budget-rule-box { margin-bottom: 20px; }

.budget-rule-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
}

.budget-rule-row > span:first-child { width: 110px; flex-shrink: 0; }
.budget-rule-row > span:last-child { width: 80px; text-align: right; flex-shrink: 0; }

.budget-rule-bar {
    flex: 1;
    height: 10px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.budget-rule-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.budget-rule-fill.needs { background: linear-gradient(90deg, #f093fb, #f5576c); }
.budget-rule-fill.wants { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.budget-rule-fill.savings { background: linear-gradient(90deg, #667eea, #764ba2); }

/* Health Meter */
.budget-health-meter {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.bhm-label { font-size: 12px; color: #999; margin-bottom: 4px; }
.bhm-status { font-size: 22px; font-weight: 800; color: #667eea; margin-bottom: 6px; }
.bhm-tip { font-size: 12px; color: #666; line-height: 1.5; }

/* Table */
.budget-table-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 25px;
    overflow-x: auto;
}

.budget-table-box h3 { font-size: 16px; font-weight: 700; margin: 0 0 20px; color: #333; }

.budget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.budget-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}

.budget-table th:first-child { border-radius: 8px 0 0 0; }
.budget-table th:last-child { border-radius: 0 8px 0 0; }

.budget-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}

.budget-table tr:nth-child(even) td { background: #f8f9ff; }
.budget-table tr:hover td { background: #eef0ff; }

/* Report Tab */
.budget-report-header {
    text-align: center;
    margin-bottom: 30px;
}

.budget-report-header h3 { font-size: 22px; font-weight: 800; color: #333; margin-bottom: 8px; }
.budget-report-header p { color: #666; font-size: 14px; }

.budget-export-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .budget-export-cards { grid-template-columns: 1fr; }
}

.budget-export-card {
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    color: white;
}

.budget-export-card.excel { background: linear-gradient(135deg, #11998e, #38ef7d); }
.budget-export-card.pdf { background: linear-gradient(135deg, #f5576c, #f093fb); }

.bec-icon { font-size: 48px; margin-bottom: 12px; }
.budget-export-card h4 { font-size: 20px; font-weight: 800; margin: 0 0 10px; }
.budget-export-card p { font-size: 13px; opacity: 0.9; margin-bottom: 16px; }

.budget-export-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    text-align: left;
}

.budget-export-card ul li {
    font-size: 13px;
    padding: 4px 0;
    opacity: 0.9;
}

.budget-export-btn {
    padding: 14px 30px;
    border-radius: 50px;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.excel-btn { background: white; color: #11998e; }
.excel-btn:hover { background: #f0fffe; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.pdf-btn { background: white; color: #f5576c; }
.pdf-btn:hover { background: #fff0f3; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

/* Preview Box */
.budget-preview-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 25px;
    overflow-x: auto;
}

.budget-preview-box h3 { font-size: 16px; font-weight: 700; margin: 0 0 20px; color: #333; }

.budget-preview-inner {
    border: 2px solid #e8e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.bpi-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.bpi-title { font-size: 18px; font-weight: 800; }
.bpi-date { font-size: 13px; opacity: 0.8; }

.bpi-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

@media (max-width: 600px) {
    .bpi-summary { grid-template-columns: repeat(2, 1fr); }
}

.bpi-card {
    padding: 16px;
    text-align: center;
    color: white;
    font-size: 13px;
}

.bpi-card div:last-child { font-size: 18px; font-weight: 800; margin-top: 4px; }

.bpi-card.green { background: #11998e; }
.bpi-card.red { background: #f5576c; }
.bpi-card.blue { background: #4facfe; }
.bpi-card.purple { background: #764ba2; }

#bpi-table-wrap { padding: 20px; }
#bpi-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
#bpi-table-wrap th { background: #667eea; color: white; padding: 10px 14px; text-align: left; }
#bpi-table-wrap td { padding: 9px 14px; border-bottom: 1px solid #eee; }
#bpi-table-wrap tr:nth-child(even) td { background: #f8f9ff; }
