/* Loan Calculator Styles - Dark Theme Default */

.loan-calculator-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.loan-form-section {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem;
}

.form-row {
    margin-bottom: 1.5rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    width: 100%;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #e2e8f0;
    letter-spacing: 0.02em;
}

.form-input {
    padding: 0.875rem 1rem;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 1rem;
    background: #1e293b;
    color: #e2e8f0;
    transition: all 0.2s ease;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
    color: #64748b;
}

.term-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.term-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.term-label {
    font-size: 0.875rem;
    color: #94a3b8;
    white-space: nowrap;
}

.term-separator {
    color: #64748b;
    font-size: 0.875rem;
    padding: 0 0.5rem;
}

.button-row {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.5);
    color: #e2e8f0;
    border: 1px solid #334155;
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.8);
}

/* Results Section */
.loan-results-section {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 1.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.result-item {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-item.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.result-label {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
}

.result-item.primary .result-value {
    color: #60a5fa;
}

/* Amortization Section */
.amortization-section {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem;
}

.amortization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.amortization-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 0.25rem;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: #3b82f6;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: rgba(59, 130, 246, 0.1);
    color: #e2e8f0;
}

.amortization-table-container {
    overflow-x: auto;
    border: 1px solid #334155;
    border-radius: 8px;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.amortization-table thead {
    background: rgba(15, 23, 42, 0.8);
    position: sticky;
    top: 0;
    z-index: 1;
}

.amortization-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #e2e8f0;
    border-bottom: 2px solid #334155;
}

.amortization-table tbody tr {
    border-bottom: 1px solid #334155;
    transition: background 0.2s ease;
}

.amortization-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.amortization-table tbody tr.year-row {
    background: rgba(59, 130, 246, 0.1);
    font-weight: 600;
}

.amortization-table tbody tr.year-row:hover {
    background: rgba(59, 130, 246, 0.15);
}

.amortization-table td {
    padding: 0.875rem 1rem;
    color: #cbd5e1;
}

.amortization-table tbody tr:last-child {
    border-bottom: none;
}

/* Custom Modal */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-message {
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-close-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Why Section */
.why-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.why-container {
    max-width: 1200px;
    margin: 0 auto;
}

.why-section .section-title {
    color: #e2e8f0;
    font-size: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.why-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.why-card:hover {
    transform: translateY(-4px);
    border-color: #3b82f6;
}

.why-icon {
    color: #3b82f6;
    margin-bottom: 1rem;
}

.why-icon svg {
    width: 48px;
    height: 48px;
}

.why-title-card {
    color: #e2e8f0;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.why-desc {
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
}

/* Light Theme - Why Section */
[data-theme="light"] .why-section .section-title,
[data-theme="light"] .why-title-card {
    color: #1f2937;
}

[data-theme="light"] .why-card {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .why-desc {
    color: #6b7280;
}

/* Light Theme Overrides */
[data-theme="light"] .loan-form-section,
[data-theme="light"] .loan-results-section,
[data-theme="light"] .amortization-section {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .form-label,
[data-theme="light"] .results-title,
[data-theme="light"] .amortization-title,
[data-theme="light"] .result-value {
    color: #1f2937;
}

[data-theme="light"] .form-input {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .form-input::placeholder {
    color: #9ca3af;
}

[data-theme="light"] .result-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .result-item.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .result-item.primary .result-value {
    color: #2563eb;
}

[data-theme="light"] .result-label {
    color: #6b7280;
}

[data-theme="light"] .btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #e5e7eb;
}

[data-theme="light"] .btn-secondary:hover {
    background: #e5e7eb;
}

[data-theme="light"] .view-toggle {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .toggle-btn {
    color: #6b7280;
}

[data-theme="light"] .toggle-btn:hover:not(.active) {
    background: rgba(59, 130, 246, 0.1);
    color: #1f2937;
}

[data-theme="light"] .amortization-table-container {
    border-color: #e5e7eb;
}

[data-theme="light"] .amortization-table thead {
    background: #f9fafb;
}

[data-theme="light"] .amortization-table th {
    color: #1f2937;
    border-color: #e5e7eb;
}

[data-theme="light"] .amortization-table tbody tr {
    border-color: #e5e7eb;
}

[data-theme="light"] .amortization-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

[data-theme="light"] .amortization-table tbody tr.year-row {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .amortization-table td {
    color: #374151;
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .modal-message {
    color: #1f2937;
}

[data-theme="light"] .term-label {
    color: #6b7280;
}

[data-theme="light"] .term-separator {
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .loan-form-section,
    .loan-results-section,
    .amortization-section {
        padding: 1.5rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .button-row {
        flex-direction: column;
    }

    .term-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .term-separator {
        text-align: center;
    }

    .amortization-header {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        width: 100%;
    }

    .toggle-btn {
        flex: 1;
    }

    .amortization-table {
        font-size: 0.75rem;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .loan-form-section,
    .loan-results-section,
    .amortization-section {
        padding: 1rem;
    }

    .results-title,
    .amortization-title {
        font-size: 1.25rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .amortization-table-container {
        font-size: 0.7rem;
    }
}
