/* BUDGET PLANNER */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #4344ab;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-text-dark: #0f172a;
    --color-text-medium: #6b7280;
}

.bp-container{
  max-width: 1320px;
  margin: auto;
}

/* App Container and Main Grid */
.bp-app-container {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1rem;
    margin: 2rem auto;
    padding: 1rem;
    background: var(--card);
    color: var(--text);
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 1rem;
}

.bp-card{
  max-width: 100;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:1rem;
  transition:transform .15s ease, box-shadow .15s ease
}

.bp-card:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 30px rgba(0,0,0,.06)
}


.bp-main-content {
    overflow: auto;
    min-width: 0;
    padding: 1rem; /* Initial padding from .bp-main-content in CSS file */
}

.bp-step-header {
    margin-bottom: 1.5rem;
}

.bp-step-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0rem 16rem 1rem;
}

/* --- Stepper Navigation --- */
.bp-stepper-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bp-step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    cursor: pointer;
    padding: 0.2rem;
    user-select: none;
}

.bp-step-line {
    height: 2px;
    background: #eef2ff;
    flex: 1;
    border-radius: 3px;
    margin: 0 6px;
}

.bp-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-medium);
    transition: all .16s;
    box-shadow: 0 3px 8px rgba(2,6,23,0.04);
}

.bp-step-circle .material-symbols-rounded {
    font-size: 20px;
}

.bp-step-circle-active {
    background: var(--color-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(67,68,171,0.12);
}

.bp-step-circle-completed {
    background: var(--color-success);
    color: white;
}

.bp-step-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-medium);
}

.bp-step-text-active {
    color: var(--color-primary-dark);
}

.bp-card .bp-section-header-divider {
    border-bottom: 1px solid var(--color-border); 
    padding-bottom: 1.5rem; 
    margin-bottom: 0.5rem; 
}

/* --- Forms & Grids --- */
.bp-form-grid-section {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 0.9rem;
}

.bp-form-group {
    display: flex;
    flex-direction: column;
}

/* --- A. Input Fields (Universal) --- */
.bp-input-field,
.bp-expense-item input,
.bp-modal input,
.bp-modal select {
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border) !important;
    font-size: 1rem;
    background: #ffffff;
    color: var(--color-text-dark);
    transition: box-shadow .12s, border-color .12s;
}
.bp-input-field:focus,
.bp-expense-item input:focus,
.bp-modal input:focus,
.bp-modal select:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--ring);
}

.bp-input-field::placeholder {
    color: #94a3b8; /* Specific fallback color */
    color: var(--soft);
    opacity: 1;
}

.bp-input-label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.bp-input-subtext {
    font-size: 0.8rem;
    color: var(--color-text-medium);
    margin-top: 0.25rem;
}

/* Input with Icon */
.bp-input-with-icon {
    position: relative;
}

.bp-input-with-icon .material-symbols-rounded {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft);
    pointer-events: none;
    font-size: 1.25rem;
}

.bp-input-with-icon .bp-input-field {
    padding-left: 2.5rem;
}

/* --- B. Buttons --- */
.bp-button {
    padding: 0.65rem 1.05rem;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform .1s, box-shadow .1s;
}

.bp-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.bp-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.bp-button-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 8px 20px rgba(90,94,219,0.12);
}

.bp-button-secondary {
    background: #eef2ff;
    color: var(--color-primary);
}

.bp-button-success {
    background: var(--color-success);
    color: white;
}

.bp-button-danger {
    background: var(--color-danger);
    color: white;
}

.bp-button-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* --- C. Cards & Messages --- */
.bp-card {
    padding: 1.3rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 20px rgba(15,23,42,0.05);
}

.bp-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.bp-message-box {
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--muted); 
}

.bp-message-box.bp-success {
    border-color: var(--color-success);
    color: var(--color-success);
}

.bp-message-box.bp-info {
    border-color: var(--primary);
    color: var(--color-primary);
}

.bp-message-box.bp-danger {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.bp-form-grid-2col {
        grid-template-columns: repeat(3, 2fr);
}


/* === 4. Sidebar Styles === */
.bp-sidebar {
    border: 1px;
    border-right: 1px solid var(--border);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    backdrop-filter: blur(6px);
    background: var(--card);
    color: var(--text);
    position: sticky !important;
    top: 2rem !important;
    align-self: start !important;
}

/* Summary Items */
.bp-summary-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.bp-summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.45rem;
    font-size: 0.975rem;
}

.bp-summary-item-value {
    font-weight: 700;
}

.bp-income-value {
    color: var(--color-success);
}

.bp-expense-value {
    color
    : var(--color-danger);
}
.bp-savings-value {
    color: var(--color-primary);
}

/* Net Income Box */
.bp-net-income-box {
    margin-top: 0.75rem;
    padding: 1rem;
    border-radius: 0.75rem;
    color: #fff;
    text-align: center;
}

.bp-net-income-default {
    background: var(--primary);
}

.bp-net-income-surplus {
    background: var(--color-success);
}

.bp-net-income-deficit {
    background: var(--color-danger);
}

.bp-net-income-box .label {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.95;
}

.bp-net-income-box .value {
    font-size: 1.6rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

/* Chart and Breakdown */
.bp-sidebar-chart {
    margin-top: 0.6rem;
    border-radius: 0.85rem;
    padding: 0.65rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.58), rgba(255,255,255,0.15));
    box-shadow: 0 12px 30px rgba(67,68,171,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bp-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.bp-breakdown-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bp-breakdown-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.bp-breakdown-text {
    color: var(--color-text-medium);
}

/* === 5. Expense List & Items (Step 2) === */
#expense-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    padding-bottom: 1rem;
}

.bp-expense-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05),
    0 2px 4px -2px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}

.bp-expense-item:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07),
    0 4px 6px -4px rgba(0,0,0,0.07);
    transform: translateY(-2px);
}

.bp-expense-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 1rem;
}

.bp-expense-item-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bp-expense-item-info {
    flex-grow: 1;
    min-width: 0;
}

.bp-expense-item-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bp-expense-item-category {
    font-size: 0.8rem;
    color: var(--soft);
}

.bp-expense-item-header .delete-btn {
    margin-left: auto;
    flex-shrink: 0;
}

.bp-expense-item-input-wrapper {
    position: relative;
}

.bp-expense-item-input-wrapper .bp-currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--soft);
    font-weight: 600;
    pointer-events: none;
}

.bp-expense-item-input-wrapper .bp-input-field {
    width: 100%;
    text-align: left;
    padding-left: 2.25rem;
    font-weight: 400;
    font-size: 1.1rem;
}

/* === 6. Modal Styles === */
.bp-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 13, 0.55);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
}

.bp-modal-backdrop[style*="opacity:1"],
.bp-modal-backdrop[style*="opacity: 1"] {
    display: flex;
}

.bp-modal {
    max-width: 920px; 
    max-height: 90vh;
    overflow: auto;
    margin: 0 auto;
    position: relative;
    z-index: 1201;
    border-radius: 12px;
    padding: 1rem;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1),
    0 8px 10px -6px rgba(0,0,0,0.1);
}

.bp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.bp-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.bp-modal-grid {
    display: flex; 
    gap: 1rem;
    margin: 1rem auto 2rem;
}

.bp-modal-footer {
    text-align: right;
}

/* Modal Grid for Custom Expense (Desktop) */
@media(min-width:640px) {
    .bp-modal-grid {
        display: flex;
        grid-template-columns: 2fr 1fr 1.5fr; /* Proper single-line layout */
    }
    .bp-modal-grid > div:first-child {
        grid-column: span 1;
    }
}


/* === 7. Review Section (Step 4) === */

/* Review Layout Grid */
.bp-review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Review Statistics Cards (4-column grid) */
.bp-review-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    grid-column: 1 / -1;
}

.bp-review-stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
}
.bp-review-stat-card .label {
    font-size: 0.9rem;
    color: var(--soft);
    margin-bottom: 0.25rem;
}
.bp-review-stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Stat Card Gradients */
.bp-review-stat-card.income-grad {
    background: linear-gradient(135deg, #fff7ed, #fed7aa);
} /* Orange */
.bp-review-stat-card.expense-grad {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
} /* Red */
.bp-review-stat-card.savings-grad {
    background: linear-gradient(135deg, #fefce8, #fef08a);
} /* Yellow */
.bp-review-stat-card.net-grad {
    background: linear-gradient(135deg, #f5f3ff, #d8b4fe);
} /* Purple */

/* Lower Breakdown Cards (Top 3) */
.bp-review-grid .bp-card:nth-child(1) {
    background: linear-gradient(135deg, #e0f2fe, #bfdbfe);
}
.bp-review-grid .bp-card:nth-child(2) {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}
.bp-review-grid .bp-card:nth-child(3) {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
}

/* Old Card Color Styling with Gradient (Keeping for reference to replace) */
/* The above bp-review-grid .bp-card:nth-child(n) rules supersede these for the lower breakdown cards */
.bp-card-income {
    border-color: #3b82f6;
    background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.1);
}
.bp-card-expenses {
    border-color: #f97316;
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.1);
}
.bp-card-net {
    border-color: var(--color-success);
    background: linear-gradient(180deg, #f0fff4 0%, #ffffff 100%);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.1);
}
.bp-card-net.bp-deficit {
    border-color: var(--color-danger);
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.1);
}
.bp-card-income .value-row > div:first-child {
    color: var(--color-primary-dark);
}
.bp-card-expenses .value-row > div:first-child {
    color: #f97316;
}
.bp-card-net .value-row > div:first-child {
    color: var(--color-success);
}
.bp-card-net.bp-deficit .value-row > div:first-child {
    color: var(--color-danger);
}


/* Review Table */
.bp-review-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.6rem;
}
.bp-review-table th,
.bp-review-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--soft);
    color: #3b3b3b;
    font-size: 0.95rem;
}
.bp-review-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f6f7fb;
    color: color: #3b3b3b;;
    font-weight: 700;
}
.bp-review-table tfoot td {
    font-weight: 700;
    font-size: 1.1rem;
    color: #3b3b3b;
    border-top: 2px solid var(--soft);
    background: #f6f7fb;
}
.bp-review-table .bp-expense-category-row td {
    font-weight: 600;
    color: var(--text);
    background: var(--muted);
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}
.bp-review-table .bp-expense-item-row td {
    padding-left: 2rem;
}
.bp-review-table .amount {
    text-align: right;
    font-weight: 600;
}

/* Large Review Cards (Savings/Expenses) */
.bp-review-content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}
.bp-review-large.bp-savings-container {
    background: #f7f9fd;
    border-color: #c5d7fe;
}
.bp-review-large.bp-expense-container {
    background: #fffdf7;
    border-color: #fce6c5;
}
.bp-review-large > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}
.bp-review-large .value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: auto;
}
.bp-review-large .value-row > div:first-child {
    font-size: 1.4rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}
.bp-small-muted {
    font-size: 0.82rem;
    color: var(--color-text-medium);
}


/* Tablet (Max 900px) */
@media (max-width: 900px) {
    .bp-review-stat-grid {
        grid-template-columns: repeat(2, 1fr); /* 2x2 grid */
    }
}


/* === 9. Print Styles (for PDF/Hardcopy) === */
@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide everything by default */
    body > *:not(#print-content-container) {
        display: none !important;
    }

    /* Show only the print container and its contents */
    #print-content-container {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    /* Reset print container styles for printing */
    .bp-app-container {
        display: block;
        box-shadow: none;
        padding: 0;
    }

    /* Force single-column for main content cards ONLY */
    #print-content-container .bp-review-grid {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* Let the stat grid use its inline styles (or simply use the media query styles) */
    #print-content-container .bp-review-stat-grid {
        page-break-inside: avoid;
    }

    #print-content-container .bp-review-stat-card,
    #print-content-container .bp-card {
        display: block;
        width: 100%;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    /* Ensure tables print correctly */
    #print-content-container .bp-review-table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: auto;
    }
    #print-content-container .bp-review-table tr {
        page-break-inside: avoid;
    }
    .bp-message-box {
        background-color: #fef2f2;
        color: var(--color-danger);
        border: 1px solid var(--color-danger);
        padding: 0.75rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        font-size: 0.9rem;
        font-weight: 600;
    }
}


/* =========================================
   MOBILE (728px)
   ========================================= */

@media screen and (max-width: 728px) {

    .bp-container {
        padding: 0 0.8rem; 
    }

    .bp-app-container {
        display: flex;
        flex-direction: column; 
        margin: 1rem auto;
        padding: 0; 
        width: 100%;
        box-shadow: none; 
        border: none;
        background: transparent;
    }
    
    .bp-sidebar {
        display: none;
        }

    .bp-main-content {
        padding: 0.5rem; 
        overflow: visible; 
    }

    .bp-step-header h1 {
        font-size: 1.4rem; 
        margin: 0 0 1rem 0;
        text-align: center;
    }

    .bp-stepper-nav {
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .bp-step-item {
        flex: 0; 
    }

    .bp-step-text {
        display: none; 
    }

    .bp-step-line {
        min-width: 20px; 
    }

    .bp-step-circle {
        width: 36px; 
        height: 36px;
    }

    .bp-form-grid-2col, 
    .bp-form-grid-section {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .bp-card {
        padding: 1rem; 
        margin-bottom: 1rem;
    }

    .bp-input-field,
    .bp-expense-item input,
    .bp-modal input,
    .bp-modal select {
        font-size: 16px !important;
        padding: 0.8rem;
    }

    .bp-button-nav {
        flex-direction: column-reverse; 
        flex-direction: row; 
    }
    
    .bp-button {
        width: 100%; 
        justify-content: center;
        display: flex;
        padding: 0.8rem;
    }

    /* --- 7. Expense List Items --- */
    #expense-list-container {
        grid-template-columns: 1fr; 
        padding-bottom: 0;
    }

    .bp-expense-item {
        margin-bottom: 0.5rem;
    }
    
    .bp-expense-item-header {
        margin-bottom: 0.5rem;
    }

    /* --- 8. Modal Adjustments --- */
    .bp-modal {
        width: 80%;
        margin: 1rem auto;
        padding: 1rem;
        max-height: 85vh; 
    }

    .bp-modal-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .bp-modal-footer .bp-button {
        width: 40%; 
        margin: 0.5rem 5rem 0rem;
    }

    .bp-review-stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

    .bp-review-stat-card {
        padding: 1rem;
    }

    .bp-review-stat-card .value {
        font-size: 1.3rem; 
    }

    .bp-review-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .bp-review-table {
        display: block;
        overflow-x: auto; 
        white-space: nowrap;
    }
    
    .bp-review-content-grid {
        gap: 0.75rem;
    }

    .bp-review-large .value-row > div:first-child {
        font-size: 1.2rem !important;
    }

    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .card h2 {
      font-size: 1.15rem !important;
      text-align: center !important;
      margin-bottom: 0.5rem !important;
     }  

    .card p,
    .card li {
      font-size: 0.9rem !important;
    line-height: 1.5 !important;
    }

}