/* Loan Calculator Custom Styles */

/* Tab Navigation */
.calculator-tab {
    transition: all 0.2s ease-in-out;
}

.calculator-tab.active {
    border-color: #3b82f6;
    color: #3b82f6;
}

.calculator-tab:hover:not(.active) {
    border-color: #d1d5db;
    color: #374151;
}

/* Form Inputs Enhancement */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: none;
}

/* Ensure input focus and interaction works properly */
input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="number"]:not(:placeholder-shown) {
    background-color: #fff;
}

/* Results Cards */
.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.result-card:hover::before {
    opacity: 1;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Amortization Table */
.amortization-table {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.amortization-table table {
    width: 100%;
    border-collapse: collapse;
}

.amortization-table th,
.amortization-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.amortization-table th {
    background-color: #f9fafb;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.amortization-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Loan Comparison Cards */
.loan-comparison-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.loan-comparison-card.best-option {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.loan-comparison-card.best-option::before {
    content: "Best Option";
    position: absolute;
    top: -10px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Charts Container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width 0.6s ease-in-out;
}

/* Affordability Gauge */
.affordability-gauge {
    position: relative;
    width: 200px;
    height: 100px;
    margin: 20px auto;
}

.gauge-arc {
    width: 100%;
    height: 100%;
}

.gauge-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 80px;
    background: #ef4444;
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(0deg);
    transition: transform 0.8s ease-in-out;
}

/* Refinance Analysis */
.refinance-savings {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.refinance-savings.negative {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-content {
        padding: 0;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 250px;
    }

    .amortization-table {
        font-size: 0.875rem;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 8px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
    animation: slideUp 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #374151;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Summary Statistics */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}
