body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #fafafa;
    color: #333;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}
  
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 30px;
}

h1 {
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1.5rem;
}

.input-section {
    margin-bottom: 20px;
    background-color: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .input-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-section label {
        margin-bottom: 8px;
    }
}

.budget-row {
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
    cursor: pointer;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .budget-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.text-wrapper {
    flex: 1;
    min-width: 200px;
    max-width: 100%;
}

.bar-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
}

@media (min-width: 768px) {
    .bar-wrapper {
        width: 60%;
    }
}

.budget-title {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0;
}

.budget-description {
    color: #666;
    margin: 5px 0;
    font-size: 0.9em;
}

.budget-bar {
    position: relative;
    height: 40px;
    border-radius: 4px;
    margin-top: 0;
    overflow: hidden;
}

.budget-amount {
    white-space: nowrap;
    font-weight: 500;
    color: #666;
    min-width: 120px;
    text-align: right;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    position: relative;
    margin: 20px;
}

.budget-item-modal {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.expandable-content {
    padding: 15px;
    background-color: #f8f8f8;
    margin-top: 10px;
    border-radius: 4px;
    width: 100%;
}

.item-bar-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 768px) {
    .item-bar-container {
        max-width: 50%;
        margin-left: auto;
    }
}

.item-bar-wrapper {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 15px;
}

.item-bar {
    height: 30px;
    transition: width 0.3s ease;
}

.item-amount-text {
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 120px;
    text-align: right;
    color: #666;
}

#incomeInput {
    flex: 1;
    min-width: 120px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#calculateBtn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
}

#calculateBtn:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    box-shadow: 0 4px 12px rgba(0,123,255,0.4);
    transform: translateY(-1px);
}

#taxInfo {
    margin: 20px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.amount-display {
    font-weight: bold;
    color: #333;
}

.budget-item {
    margin-bottom: 15px;
}

.budget-item h2 {
    font-size: 16px;
    margin: 0;
    font-weight: bold;
}

.budget-item p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #666;
}

.info-button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    transition: transform 0.2s;
}

.info-button:hover {
    transform: scale(1.1);
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    opacity: 0.7;
}

.budget-container {
    margin-bottom: 10px;
}

.budget-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.budget-item h3 {
    margin: 0;
    font-size: 1em;
}

.budget-item p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    color: #666;
}

/* Waterfall chart specific styles */
.waterfall-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
    position: relative;
}

.waterfall-text {
    flex: 0 0 300px;
    min-width: 300px;
}

.waterfall-text h3 {
    margin: 0;
    font-size: 1em;
}

.waterfall-text p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    color: #666;
}

.waterfall-bar-container {
    flex: 1;
    position: relative;
    height: 40px;
    overflow: visible;
}

.waterfall-bar {
    position: absolute !important;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.9em;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    box-sizing: border-box;
    top: 0;
}

.waterfall-amount {
    flex: 0 0 120px;
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 120px;
    text-align: right;
    color: #666;
}

/* Year toggle slider styles */
.year-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.slider-toggle {
    position: relative;
    display: inline-block;
}

.slider-track {
    position: relative;
    display: flex;
    background-color: #e9ecef;
    border-radius: 25px;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    min-width: 120px;
}

.slider-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    z-index: 2;
}

.slider-option {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-radius: 20px;
    position: relative;
    z-index: 3;
    transition: color 0.3s ease;
    user-select: none;
}

.slider-option.active {
    color: white;
}

.slider-option:hover:not(.active) {
    color: #495057;
}

/* Move thumb to the right for 2026 */
.slider-toggle[data-active="2026"] .slider-thumb {
    transform: translateX(100%);
}
