/* GIAO DIỆN SOFT BRUTALISM - BUDGET PLANNER */
.tool-container {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 1000px; margin: 20px auto;
    border: 3px solid #111111; border-radius: 12px;
    box-shadow: 6px 6px 0px #111111; padding: 30px;
    background: #ffffff; color: #111111; box-sizing: border-box;
}

h2.tool-title {
    font-family: 'Montserrat', sans-serif; font-size: 2rem;
    text-align: center; text-transform: uppercase; margin-top: 0;
    margin-bottom: 25px; font-weight: 900;
}

/* Toggle Buttons */
.period-toggle { display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.period-label { font-weight: 800; font-size: 1.1rem; }
.toggle-buttons { display: flex; background: #f4f4f4; border: 3px solid #111111; border-radius: 8px; overflow: hidden; box-shadow: 3px 3px 0px #111111; }
.btn-period { padding: 10px 20px; font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 1rem; border: none; background: transparent; cursor: pointer; transition: background 0.2s; outline: none; }
.btn-period:first-child { border-right: 3px solid #111111; }
.btn-period.active { background: #111111; color: #fff; }

/* Dashboard Cards */
.dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.dash-card { border: 3px solid #111111; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 4px 4px 0px #111111; }
.dash-card h4 { margin: 0 0 10px 0; font-family: 'Montserrat', sans-serif; font-size: 1rem; text-transform: uppercase; }
.dash-card .amount { font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 900; word-break: break-word; }
.card-income { background-color: #e2f0cb; } 
.card-expense { background-color: #ffdac1; } 
.card-balance { background-color: #b5ead7; } 

/* Progress Bar 50/30/20 */
.analysis-box { background-color: #f9f9f9; border: 3px solid #111111; border-radius: 12px; padding: 20px; margin-bottom: 30px; }
.box-title { margin-top: 0; font-family: 'Montserrat', sans-serif; font-weight: 900; margin-bottom: 20px;}
.progress-group { margin-bottom: 15px; }
.progress-group:last-child { margin-bottom: 0; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.progress-labels strong { font-family: 'Montserrat', sans-serif; }
.progress-bar { width: 100%; height: 18px; background-color: #e0e0e0; border: 2px solid #111111; border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; transition: width 0.3s ease, background-color 0.3s ease; }
.fill-needs { background-color: #ffb7b2; }
.fill-wants { background-color: #fdfd96; }
.fill-savings { background-color: #cbaacb; }
.progress-fill.warning { background-color: #e05a47 !important; }

/* Budget Layout Columns */
.budget-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.category-section { margin-bottom: 30px; }
.section-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border: 3px solid #111111; border-radius: 8px; margin-bottom: 15px; box-shadow: 3px 3px 0px #111111; }
.section-header h4 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 1rem; }
.section-header .sub-total { font-weight: 900; font-family: 'Montserrat', sans-serif; }
.section-income .section-header { background-color: #e2f0cb; }
.section-needs .section-header { background-color: #ffb7b2; }
.section-wants .section-header { background-color: #fdfd96; }
.section-savings .section-header { background-color: #cbaacb; }

/* Item List */
.item-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 15px;}
.budget-item { display: flex; gap: 10px; align-items: center; }
.budget-item input[type="text"] { flex: 3; }
.budget-item input[type="number"] { flex: 2; }
.budget-item input { padding: 10px; font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; border: 2px solid #111111; border-radius: 6px; outline: none; }
.budget-item input:focus { background-color: #f0f0f0; }

.btn-remove {
    width: 38px; height: 38px; flex-shrink: 0; background-color: #e05a47; color: #fff; font-weight: bold; font-size: 1.2rem;
    border: 2px solid #111111; border-radius: 6px; cursor: pointer; display: flex; justify-content: center; align-items: center;
}
.btn-remove:active { transform: scale(0.95); }

.btn-add-item {
    width: 100%; padding: 10px; cursor: pointer; font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 0.95rem;
    background-color: transparent; border: 2px dashed #111111; border-radius: 8px; color: #111111; transition: background 0.2s;
}
.btn-add-item:hover { background-color: #f4f4f4; }

/* Footer Action Buttons */
.action-footer {
    display: flex; justify-content: space-between; align-items: center; margin-top: 25px;
    padding-top: 25px; border-top: 3px dashed #111111; flex-wrap: wrap; gap: 15px;
}
.export-group { display: flex; gap: 15px; }
.btn-export, .btn-reset {
    cursor: pointer; font-family: 'Montserrat', sans-serif; font-size: 1rem; font-weight: 900;
    padding: 12px 20px; border: 3px solid #111111; border-radius: 8px;
    box-shadow: 4px 4px 0px #111111; text-transform: uppercase; color: #111111;
    transition: transform 0.1s, box-shadow 0.1s;
}
.btn-export:active, .btn-reset:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #111111; }
.btn-pdf { background-color: #cbaacb; }
.btn-excel { background-color: #97c1a9; }
.btn-reset { background-color: #eceae4; }

@media (max-width: 800px) {
    .dashboard { grid-template-columns: 1fr; gap: 15px; }
    .budget-layout { grid-template-columns: 1fr; }
    .budget-item { flex-wrap: wrap; }
    .budget-item input[type="text"] { flex: 100%; }
    .budget-item input[type="number"] { flex: 1; }
    .action-footer { flex-direction: column; align-items: stretch; }
    .export-group { flex-direction: column; }
}

/* =========================================
   TỐI ƯU CSS KHI IN (XUẤT PDF TRÌNH DUYỆT)
   ========================================= */
@media print {
    body { background-color: #fff; margin: 0; padding: 0; }
    .tool-container { box-shadow: none; border: none; padding: 0; max-width: 100%; margin: 0; }
    
    /* Ẩn các nút thao tác không cần thiết khi in */
    .hide-on-print, .btn-remove, .period-toggle { display: none !important; }
    
    /* Chuyển ô Input thành chữ text phẳng */
    .budget-item input { border: none; padding: 5px 0; background: transparent; font-size: 1rem; box-shadow: none; }
    .budget-item input[type="text"] { font-weight: bold; }
    
    /* Ép trình duyệt in màu nền của các box (Chrome/Edge/Safari) */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    
    .section-header { box-shadow: none; border-width: 2px; }
    .dash-card { box-shadow: none; border-width: 2px; }
    .analysis-box { box-shadow: none; border-width: 2px; }
}