/* --- Calculator Container --- */
.calculator-container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    max-width: 750px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

.calculator-header h2 {
    font-size: 1.8rem;
    color: #1a2c4e;
    margin-bottom: 0.5rem;
    text-align: center;
}

.calculator-header p {
    font-size: 1rem;
    color: #555;
    text-align: center;
    margin-bottom: 2rem;
}

/* --- Form --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input,
.input-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrapper input:focus,
.input-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.input-wrapper span {
    position: absolute;
    right: 1rem;
    color: #777;
    font-size: 0.9rem;
}

.input-group-checkbox {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.input-group-checkbox input {
    margin-right: 0.75rem;
    width: 1.2em;
    height: 1.2em;
    accent-color: #007bff;
}

/* --- Button --- */
.calculate-button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.calculate-button:hover {
    background-color: #0056b3;
}

/* --- Results Section --- */
.result-section {
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

.result-section h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1a2c4e;
}

.result-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-box {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.result-box .label {
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.result-box .value {
    display: block;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
}

.result-box.net-salary {
    background-color: #e6f3ff;
}

.result-box.net-salary .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0056b3;
}

/* --- Chart --- */
.chart-container {
    margin-bottom: 2rem;
}

.chart-bar {
    display: flex;
    width: 100%;
    height: 30px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.bar-segment {
    height: 100%;
    transition: width 0.5s ease-in-out;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
}

.bar-segment::after {
    content: attr(data-label);
    position: absolute;
    bottom: -20px;
    font-size: 11px;
    color: #555;
    opacity: 0;
    transition: opacity 0.3s;
}
.bar-segment:hover::after {
    opacity: 1;
}

.bar-segment.net-pay { background-color: #28a745; }
.bar-segment.municipal-tax { background-color: #ffc107; }
.bar-segment.state-tax { background-color: #dc3545; }
.bar-segment.other-tax { background-color: #6c757d; }

.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}
.dot.net-pay { background-color: #28a745; }
.dot.municipal-tax { background-color: #ffc107; }
.dot.state-tax { background-color: #dc3545; }
.dot.other-tax { background-color: #6c757d; }

/* --- Result Details --- */
.result-details {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.result-details h4 {
    font-size: 1.1rem;
    color: #1a2c4e;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.result-details ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.result-details li {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95rem;
}
.result-details li:last-child {
    border-bottom: none;
}
.result-details li strong {
    font-weight: 600;
}
.result-details li.tax-reduction strong {
    color: #28a745;
}

/* --- Error Message --- */
.error-message {
    text-align: center;
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1.5rem;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    .calculator-container {
        padding: 1.5rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .result-summary {
        grid-template-columns: 1fr;
    }
}