/* Mortgage Calculator Styles - Enhanced & Interactive */
/* Matching CalcTechLab.com theme with modern enhancements */

:root {
    /* CalcTechLab Brand Colors */
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* Neutral colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.calculator-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.calculator-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.calculator-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.calculator-header p {
    font-size: 1.2rem;
    opacity: 0.95;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.last-updated {
    margin-top: 15px;
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: inline-block;
}

/* Card Styles */
.calculator-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 35px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title::before {
    content: '💰';
    font-size: 1.5rem;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.form-label-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    display: block;
    margin-top: 4px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background-color: var(--bg-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-with-icon .form-input {
    padding-left: 45px;
}

/* Mortgage Type Toggle */
.mortgage-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.type-option {
    padding: 20px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: var(--bg-white);
}

.type-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.type-option.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(30, 64, 175, 0.05) 100%);
    box-shadow: var(--shadow);
}

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

.type-option-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.type-option-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Range Slider */
.range-slider {
    width: 100%;
    margin: 15px 0;
}

.range-input {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 50%, var(--border-color) 50%, var(--border-color) 100%);
    outline: none;
    -webkit-appearance: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-lg);
}

.range-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
}

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

.range-value-current {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Button Styles */
.btn {
    padding: 16px 36px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-export {
    background-color: var(--success-color);
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-export:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-block {
    width: 100%;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Results Section */
.results-section {
    display: none;
    animation: fadeInUp 0.6s ease;
}

.results-section.show {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-card {
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--bg-light) 100%);
    padding: 25px;
    border-radius: 12px;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.result-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Highlight Card */
.result-card.highlight {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-left: none;
    grid-column: span 2;
}

.result-card.highlight .result-label,
.result-card.highlight .result-value,
.result-card.highlight .result-subtext {
    color: white;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.chart-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.chart-tab:hover {
    color: var(--primary-color);
}

.chart-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Advice Section */
.advice-section {
    margin-top: 30px;
}

.advice-card {
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 5px solid;
    background: var(--bg-white);
    box-shadow: var(--shadow);
}

.advice-card.excellent {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-white) 100%);
}

.advice-card.good {
    border-color: var(--info-color);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05) 0%, var(--bg-white) 100%);
}

.advice-card.fair {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-white) 100%);
}

.advice-card.high,
.advice-card.very_high {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-white) 100%);
}

.advice-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.advice-message {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.advice-recommendations {
    margin-top: 15px;
}

.advice-recommendations h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.advice-recommendations ul {
    list-style: none;
    padding: 0;
}

.advice-recommendations li {
    padding: 8px 0 8px 30px;
    position: relative;
    color: var(--text-secondary);
}

.advice-recommendations li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Schedule Table */
.schedule-table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
}

.schedule-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.schedule-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.schedule-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

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

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

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 30px;
}

.loading.show {
    display: block;
}

.spinner {
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 5px solid var(--danger-color);
    color: var(--danger-color);
    padding: 18px 24px;
    border-radius: 10px;
    margin: 20px 0;
    display: none;
    font-weight: 500;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, var(--bg-white) 100%);
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.info-box h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.info-box p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Export Buttons */
.export-section {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-header h1 {
        font-size: 2rem;
    }
    
    .calculator-header p {
        font-size: 1rem;
    }
    
    .calculator-card {
        padding: 25px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .result-card.highlight {
        grid-column: span 1;
    }
    
    .mortgage-type-toggle {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .calculator-header {
        padding: 25px 15px;
    }
    
    .calculator-header h1 {
        font-size: 1.5rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
}

/* Embedded Mode */
body.embedded {
    background-color: transparent;
}

body.embedded .calculator-header {
    margin-bottom: 20px;
}

body.embedded .container {
    padding: 10px;
}