/* ===========================
   CALCULATOR MODAL
=========================== */
.calculator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.calculator-modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 16px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close:hover {
    background-color: var(--accent-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 40px;
}

/* ===========================
   CALCULATOR LAYOUT
=========================== */
.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.calculator-header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 20px;
}

.calculator-header h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.calculator-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.calculator-inputs,
.calculator-results {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
}

.calculator-inputs h3,
.calculator-results h3 {
    font-size: 20px;
    margin-bottom: 25px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.calculator-inputs h3 i,
.calculator-results h3 i {
    color: var(--primary-color);
}

/* Form Groups */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(50, 111, 168, 0.1);
}

.input-group {
    position: relative;
}

.input-prefix,
.input-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-prefix {
    left: 16px;
}

.input-suffix {
    right: 16px;
}

.input-group input {
    padding-left: 40px;
}

.input-group.has-suffix input {
    padding-right: 50px;
}

/* Range Slider */
.range-slider {
    margin-top: 15px;
}

.range-slider input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 50%, var(--border-color) 50%);
    outline: none;
    -webkit-appearance: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.range-value {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(50, 111, 168, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Result Cards */
.result-card {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.result-card .result-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.result-card .result-value {
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.result-item {
    background-color: var(--bg-primary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.result-item .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.result-item .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Charts */
.chart-container {
    margin: 25px 0;
    padding: 20px;
    background-color: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
    text-align: center;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* Tables */
.data-table-container {
    margin-top: 25px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
}

.data-table thead {
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table th {
    font-weight: 600;
    color: var(--text-primary);
}

.data-table td {
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Full Width Results */
.calculator-results.full-width {
    grid-column: 1 / -1;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message i {
    font-size: 20px;
}

/* Success Message */
.success-message {
    background-color: #efe;
    border: 1px solid #cfc;
    color: #3c3;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message i {
    font-size: 20px;
}

/* Info Box */
.info-box {
    background-color: var(--bg-tertiary);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 16px;
}

.info-box p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Breakdown Section */
.breakdown-section {
    margin-top: 30px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.breakdown-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 140px;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option label {
    display: block;
    padding: 12px 20px;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.radio-option input[type="radio"]:checked + label {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.radio-option label:hover {
    border-color: var(--primary-color);
}
