/* Mortgage Calculator - Compact Styling */
/* CSP Compliant - No inline styles */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-blue: #667eea;
    --accent-green: #10b981;
    --hover-green: #34e8ac;
    --white-bro: #ffffff;
    --accent-red: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --surface-light: rgba(255, 255, 255, 0.98);
    --border-color: #e2e8f0;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --primary-blue: #3b82f6;
    --hover-blue: #6b9ef1;

}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    padding: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* App Container - Main wrapper */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Main Header - Standalone at top */
.main-header {
    text-align: center;
    margin-bottom: 20px;
    background: var(--surface-light);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
}

.main-header h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.main-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Compact Mortgage Rates - Horizontal layout */
.mortgage-rates.compact {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.7) 0%, rgba(34, 197, 94, 0.7) 100%);
    border: 2px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-in;
}

.compact-rates-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.rates-title,
.rates-week {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white-bro);
    flex-shrink: 0;
    /* Prevent shrinking */
}


.rates-inline {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.rate-item-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.1);
    white-space: nowrap;
    /* Prevent text wrapping */
}

.rate-label-inline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.rate-value-inline {
    font-size: 0.9rem;
    color: var(--accent-green);
    font-weight: 700;
}

/* Fixed refresh button - make it small and static */
.refresh-btn-compact {
    width: 24px;
    /* Fixed width */
    height: 24px;
    /* Fixed height */
    min-width: 24px;
    /* Prevent shrinking */
    max-width: 24px;
    /* Prevent growing */
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    /* Remove all padding */
    margin: 0;
    /* Remove all margin */
    flex-shrink: 0;
    /* Prevent flex shrinking */
    flex-grow: 0;
    /* Prevent flex growing */
    box-sizing: border-box;
}

.refresh-btn-compact svg {
    width: 14px;
    /* Fixed SVG size */
    height: 14px;
    /* Fixed SVG size */
    fill: var(--white-bro);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.refresh-btn-compact:hover {
    background: var(--accent-green);
    transform: scale(1.05);
}

.refresh-btn-compact:hover svg {
    fill: white;
    transform: rotate(180deg);
}

.refresh-btn-compact:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.rates-date-compact {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    flex-shrink: 0;
    /* Prevent shrinking */
    white-space: nowrap;
    /* Prevent text wrapping */
}

/* Two Column Layout */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* Calculator Container - Left Column */
.calculator-container {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(10px);
}

/* Message Display */
.message {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
    text-align: center;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.2);
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.2);
}

.message.info {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--accent-blue);
    border-color: rgba(102, 126, 234, 0.2);
}

.message.hidden {
    display: none;
}

/* Form Styles */
.mortgage-form {
    margin-bottom: 20px;
}

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

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

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

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.valid {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.05);
}

.form-group input.invalid {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

.input-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 3px;
    font-style: italic;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.calculate-btn {
    background: var(--accent-blue);
    color: white;
}

.calculate-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.reset-btn {
    background: #6b7280;
    color: white;
}

.reset-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

button:focus {
    outline: 2px solid rgba(102, 126, 234, 0.3);
    outline-offset: 2px;
}

/* Result Display */
.result {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.5s ease-in;
    margin-top: 20px;
}

.result.hidden {
    display: none;
}

.result-header h2 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.payment-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 18px;
}

.currency {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.payment-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent-blue);
    line-height: 1;
}

.payment-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 6px;
}

.payment-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    margin-bottom: 15px;
}

.breakdown-item {
    text-align: center;
}

.breakdown-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-weight: 500;
}

.breakdown-value {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Interest Summary Section - Original Working Version */
.interest-summary {
    margin-top: 20px;
    padding: 20px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.interest-summary h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 600;
}

.interest-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.interest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    box-shadow: var(--shadow-light);
}

.interest-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.interest-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-icon {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.info-icon svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
}

.info-icon:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-blue);
    transform: scale(1.1);
}

.info-icon:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.interest-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.interest-value.highlight {
    color: var(--accent-red);
    font-size: 1.1rem;
}

/* Placeholder and calculated states */
.placeholder {
    color: var(--text-secondary) !important;
    font-style: italic;
    opacity: 0.7;
    font-weight: 400 !important;
}

.calculated {
    color: inherit !important;
    font-style: normal !important;
    opacity: 1 !important;
}

.payment-amount.calculated {
    color: var(--accent-blue) !important;
    font-weight: 800 !important;
}

.interest-value.highlight.calculated {
    color: var(--accent-red) !important;
    font-weight: 800 !important;
}

/* Info Tooltip */
.info-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-large);
    border: 2px solid var(--primary-blue);
    z-index: 1000;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.info-tooltip.hidden {
    display: none;
}

.tooltip-content {
    padding: 20px;
    position: relative;
}

.tooltip-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tooltip-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.tooltip-text h4 {
    color: var(--primary-blue);
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.tooltip-text p {
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.9rem;
    margin: 0;
}

/* Rent Panel - Right Column */
.rent-panel {
    background: linear-gradient(135deg, rgba(251, 146, 60, .8) 0%, rgba(249, 115, 22, 0.8) 100%);
    border: 2px solid rgba(251, 146, 60, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(10px);
    min-height: fit-content;
    position: sticky;
    top: 20px;
}

.rent-panel-header {
    text-align: center;
    margin-bottom: 16px;
}

.rent-panel-header h3 {
    font-size: 1.1rem;
    color: #fffbf9;
    margin: 0 0 6px 0;
    font-weight: 700;
}

.rent-subtitle {
    font-size: 0.85rem;
    color: var(--white-bro);
    margin: 0;
    font-style: italic;
}

/* Rent Form Styling */
.rent-form {
    margin-bottom: 16px;
}

.rent-input-group {
    margin-bottom: 16px;
}

.rent-input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.rent-input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(251, 146, 60, 0.2);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.rent-input-group input:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1);
}

.rent-input-group input.valid {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.05);
}

.rent-input-group input.invalid {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

.rent-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--white-bro);
    margin-top: 3px;
    font-style: italic;
}

/* Rent Button Group */
.rent-button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.rent-calculate-btn,
.rent-reset-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
}

.rent-calculate-btn {
    background: var(--accent-green);
    color: white;
}

.rent-calculate-btn:hover {
    background: var(--hover-green);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.rent-reset-btn {
    background: var(--primary-blue);
    color: var(--white-bro);
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.rent-reset-btn:hover {
    background: var(--hover-blue);
    transform: translateY(-1px);
}

/* Rent Results - Multiple Terms */
.rent-result {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(251, 146, 60, 0.2);
    box-shadow: var(--shadow-light);
}

.rent-results-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(251, 146, 60, 0.1);
}

.rent-results-header h4 {
    font-size: 0.95rem;
    color: #ea580c;
    margin: 0 0 2px 0;
    font-weight: 700;
}

.results-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Individual Result Sections */
.rent-result-section {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(251, 146, 60, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(251, 146, 60, 0.1);
}

.rent-result-section:last-of-type {
    margin-bottom: 8px;
}

.rent-result-term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(251, 146, 60, 0.15);
}

.term-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ea580c;
}

.term-rate {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.term-rate.calculated {
    color: #ea580c !important;
    font-weight: 600;
}

.term-rate.live-rate {
    color: #10b981 !important;
    font-weight: 700;
}

.term-rate.estimated {
    color: #f59e0b !important;
    font-style: italic;
    font-weight: 600;
}

/* Result Items */
.rent-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.rent-result-item.small {
    font-size: 0.85em;
    opacity: 0.9;
}

.rent-result-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.rent-result-value {
    font-size: 0.85rem;
    color: #ea580c;
    font-weight: 700;
}

.rent-result-value.primary {
    font-size: 0.9rem;
    font-weight: 800;
}

.rent-result-value.placeholder {
    color: var(--text-secondary) !important;
    font-style: italic;
    opacity: 0.7;
    font-weight: 400;
}

.rent-result-value.calculated {
    color: #ea580c !important;
    font-style: normal !important;
    opacity: 1 !important;
    font-weight: 700;
}

.rent-result-value.primary.calculated {
    font-weight: 800;
}

/* Disclaimer */
.rent-disclaimer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(251, 146, 60, 0.1);
    line-height: 1.3;
}

.rent-disclaimer .rate-legend {
    display: block;
    margin-top: 4px;
    font-size: 0.65rem;
}

.rate-legend .live {
    color: #10b981;
}

.rate-legend .estimated {
    color: #f59e0b;
}

/* Loan Limit Section */
.loan-limit-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    transition: all 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.loan-limit-section.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .info-icon {
    flex-shrink: 0;
    min-width: 20px;
    max-width: 20px;
    width: 20px;
    height: 20px;
    padding: 0;
}

.section-title .info-icon svg {
    width: 12px;
    height: 12px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select:disabled {
    background-color: #f8f9fa;
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loan Type Indicator */
.loan-type-indicator {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease-in;
}

.loan-type-badge {
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.conforming {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.jumbo {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.15) 0%, rgba(249, 115, 22, 0.15) 100%);
    color: #ea580c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.loan-limit-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.limit-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.limit-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.loan-status-message {
    margin-top: 4px;
}

.status-message {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
}

.status-message.conforming {
    color: #059669;
}

.status-message.jumbo {
    color: #ea580c;
}

/* Jumbo Loan Alert */
.jumbo-loan-alert {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.08) 0%, rgba(249, 115, 22, 0.08) 100%);
    border: 2px solid rgba(251, 146, 60, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    transition: all 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.jumbo-loan-alert.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

.alert-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
}

.alert-text strong {
    display: block;
    color: #ea580c;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.alert-text p {
    margin: 0;
    font-size: 0.85rem;
    color: #ffffff;
    line-height: 1.5;
}

.check-location-btn {
    width: 100%;
    padding: 10px 16px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background-color: #764ba2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.check-location-btn:hover {
    transform: translateY(-1px);
    /*  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); */
}

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

/* Property Location Section - External */
.loan-limit-section-external {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    animation: fadeIn 0.3s ease;
}

.loan-limit-section-external.hidden {
    display: none;
}

.loan-limit-container {
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-medium);
}

.loan-limit-header {
    margin-bottom: 16px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 6px 0 0 0;
}

/* Compact Search-Based Location Inputs */
.location-search-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.location-search-inputs {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    align-items: start;
}

.search-input-wrapper {
    position: relative;
}

.location-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-transform: uppercase;
}

.location-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.location-search-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.location-search-input::placeholder {
    text-transform: none;
    font-size: 0.85rem;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.search-dropdown.hidden {
    display: none;
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.dropdown-item.selected {
    background-color: rgba(102, 126, 234, 0.2);
    font-weight: 600;
}

.dropdown-no-results {
    padding: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* Compact Loan Type Indicator */
.loan-type-indicator {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    padding: 12px 16px;
    animation: slideIn 0.3s ease;
}

.loan-type-indicator.hidden {
    display: none;
}

.loan-type-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.loan-type-content .badge {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.loan-type-content .badge.conforming {
    background-color: #d4edda;
    color: #155724;
}

.loan-type-content .badge.jumbo {
    background-color: #fff3cd;
    color: #856404;
}

.loan-limit-details {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.loan-limit-details .limit-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.loan-limit-details .limit-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1rem;
}

.loan-status-message {
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: auto;
}

.loan-status-message.conforming {
    color: #155724;
}

.loan-status-message.jumbo {
    color: #856404;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tabs UX for calculators */
.calculator-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.tab-btn {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    outline: none;
}

.tab-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-bottom: 2px solid var(--accent-green);
    z-index: 2;
}

.tab-btn:not(.active):hover {
    background: var(--hover-blue);
    color: #fff;
}

.tab-panel {
    display: block;
    background: var(--surface-light);
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-light);
    padding: 2rem;
    margin-bottom: 2rem;
}

.tab-panel.hidden {
    display: none !important;
}

/* Responsive adjustments for location search */
@media (max-width: 600px) {
    .location-search-inputs {
        grid-template-columns: 1fr;
    }

    .loan-type-content {
        justify-content: center;
        text-align: center;
    }

    .loan-status-message {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .calculator-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .rent-panel {
        order: 1;
        position: static;
        margin-bottom: 15px;
    }

    .calculator-container {
        order: 2;
    }

    .compact-rates-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .rates-inline {
        justify-content: center;
    }

    .refresh-btn-compact {
        width: 28px;
        height: 28px;
        min-width: 28px;
        max-width: 28px;
    }

    .refresh-btn-compact svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 15px;
    }

    .main-header h1 {
        font-size: 1.5rem;
    }

    .calculator-container {
        padding: 18px;
    }

    .rent-panel {
        padding: 15px;
    }

    .loan-limit-container {
        padding: 16px;
    }

    .location-inputs {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .alert-content {
        flex-direction: column;
        gap: 8px;
    }

    .alert-icon {
        font-size: 1.25rem;
    }

    /* Make all calculators more compact on mobile */
    body {
        padding: 8px;
    }

    .app-container {
        padding: 5px;
    }

    .main-header {
        margin-bottom: 12px;
        padding: 12px;
    }

    .main-header h1 {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .main-header .subtitle {
        font-size: 0.8rem;
    }

    /* Compact mortgage rates */
    .mortgage-rates.compact {
        padding: 8px 10px;
        margin-bottom: 12px;
    }

    .rates-title,
    .rates-week {
        font-size: 0.8rem;
    }

    .rate-item {
        font-size: 0.75rem;
    }

    /* Compact tabs */
    .calculator-tabs {
        gap: 6px;
        margin-bottom: 12px;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* Compact forms */
    .calculator-container,
    .tab-panel {
        padding: 12px;
    }

    .form-group,
    .rent-input-group,
    .credit-input-group {
        margin-bottom: 12px;
    }

    .form-group label,
    .rent-input-group label,
    .credit-input-group label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .form-group input,
    .form-group select,
    .rent-input-group input,
    .credit-input-group input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .hint,
    .rent-hint,
    .credit-hint {
        font-size: 0.7rem;
        margin-top: 2px;
    }

    /* Compact buttons */
    .button-group,
    .rent-button-group,
    .credit-button-group {
        gap: 8px;
        margin-bottom: 12px;
    }

    .calculate-btn,
    .reset-btn,
    .rent-calculate-btn,
    .rent-reset-btn,
    .credit-calculate-btn,
    .credit-reset-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Compact results */
    .result,
    .rent-result,
    .credit-result {
        padding: 12px;
    }

    .result-header,
    .rent-results-header,
    .credit-results-header {
        margin-bottom: 12px;
        padding-bottom: 6px;
    }

    .result-header h4,
    .rent-results-header h4,
    .credit-results-header h4 {
        font-size: 0.85rem;
    }

    .results-subtitle {
        font-size: 0.7rem;
    }

    .result-section,
    .rent-result-section,
    .credit-result-section {
        padding: 10px;
        margin-bottom: 12px;
    }

    .result-item,
    .rent-result-item,
    .credit-result-item {
        padding: 4px 0;
    }

    .result-label,
    .rent-result-label,
    .credit-result-label {
        font-size: 0.75rem;
    }

    .result-value,
    .rent-result-value,
    .credit-result-value {
        font-size: 0.8rem;
    }

    .result-value.primary,
    .rent-result-value.primary,
    .credit-result-value.highlight {
        font-size: 0.85rem;
    }

    /* Compact payment breakdown */
    .payment-breakdown {
        padding: 12px;
        margin-top: 12px;
    }

    .breakdown-header {
        margin-bottom: 12px;
    }

    .breakdown-header h5 {
        font-size: 0.85rem;
    }

    .chart-row {
        grid-template-columns: 110px 1fr 70px;
        gap: 6px;
        margin-bottom: 10px;
    }

    .chart-label {
        font-size: 0.75rem;
        gap: 4px;
    }

    .chart-icon {
        font-size: 0.95rem;
    }

    .chart-bar-container {
        height: 20px;
    }

    .chart-value {
        font-size: 0.75rem;
    }

    .breakdown-total {
        padding: 10px;
        margin-top: 10px;
    }

    .total-label {
        font-size: 0.85rem;
    }

    .total-value {
        font-size: 0.9rem;
    }

    /* Compact loan limits */
    .loan-limit-section {
        padding: 12px;
        margin: 12px 0;
    }

    .section-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .location-search-inputs {
        gap: 10px;
    }

    /* Compact loan type indicator */
    .loan-type-indicator {
        padding: 10px;
        margin-top: 12px;
    }

    .badge {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    .county-limit {
        font-size: 0.75rem;
    }

    /* Compact message and tooltip */
    .message {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .info-tooltip {
        padding: 12px;
        max-width: calc(100vw - 20px);
    }

    .tooltip-content {
        font-size: 0.8rem;
    }

    /* Reduce spacing between elements */
    .disclaimer,
    .rent-disclaimer,
    .credit-disclaimer {
        font-size: 0.65rem;
        margin-top: 6px;
        padding-top: 6px;
    }

    /* Compact large payment display */
    .payment-amount {
        font-size: 1.6rem;
    }

    .payment-label {
        font-size: 0.85rem;
    }

    .payment-highlight {
        padding: 12px;
    }

    /* Reduce icon sizes */
    .info-icon {
        width: 18px;
        height: 18px;
        padding: 3px;
    }

    .info-icon svg {
        width: 10px;
        height: 10px;
    }

    /* Compact rate displays */
    .rate-value {
        font-size: 1rem;
    }

    .rate-label {
        font-size: 0.7rem;
    }

    /* Make term headers more compact */
    .term-label {
        font-size: 0.8rem;
    }

    .term-rate {
        font-size: 0.7rem;
    }
}

/* Extra small screens - even more compact */
@media (max-width: 360px) {
    body {
        padding: 5px;
    }

    .app-container {
        padding: 3px;
    }

    .main-header {
        padding: 10px;
        margin-bottom: 10px;
    }

    .main-header h1 {
        font-size: 1.1rem;
    }

    .main-header .subtitle {
        font-size: 0.75rem;
    }

    .mortgage-rates.compact {
        padding: 6px 8px;
        margin-bottom: 10px;
    }

    .calculator-tabs {
        gap: 4px;
        margin-bottom: 10px;
    }

    .tab-btn {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .calculator-container,
    .tab-panel {
        padding: 10px;
    }

    .payment-amount {
        font-size: 1.4rem;
    }

    .payment-label {
        font-size: 0.8rem;
    }

    .chart-row {
        grid-template-columns: 90px 1fr 60px;
        gap: 4px;
    }

    .chart-label {
        font-size: 0.7rem;
    }

    .chart-value {
        font-size: 0.7rem;
    }

    .breakdown-total {
        padding: 8px;
    }

    .total-label {
        font-size: 0.8rem;
    }

    .total-value {
        font-size: 0.85rem;
    }
}

/* Print styles */
@media print {

    .button-group,
    .info-icon,
    .refresh-btn-compact,
    .mortgage-rates,
    .rent-panel {
        display: none !important;
    }

    .result {
        page-break-inside: avoid;
        border: 2px solid #000;
    }

    body {
        background: white;
        padding: 0;
    }

    .calculator-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ===============================================
   Credit Card Calculator Styling
   =============================================== */

/* Credit Card Form Styling */
.credit-form {
    margin-bottom: 16px;
}

.credit-input-group {
    margin-bottom: 16px;
}

.credit-input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.credit-input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.credit-input-group input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.credit-input-group input.valid {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.05);
}

.credit-input-group input.invalid {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

.credit-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--white-bro);
    margin-top: 3px;
    font-style: italic;
}

/* Credit Card Button Group */
.credit-button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.credit-calculate-btn,
.credit-reset-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
}

.credit-calculate-btn {
    background: var(--accent-green);
    color: white;
}

.credit-calculate-btn:hover {
    background: var(--hover-green);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.credit-reset-btn {
    background: var(--primary-blue);
    color: var(--white-bro);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.credit-reset-btn:hover {
    background: var(--hover-blue);
    transform: translateY(-1px);
}

/* Credit Card Results */
.credit-result {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: var(--shadow-light);
    display: none;
}

.credit-results-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(239, 68, 68, 0.1);
}

.credit-results-header h4 {
    font-size: 0.95rem;
    color: #dc2626;
    margin: 0 0 2px 0;
    font-weight: 700;
}

/* Credit Result Section */
.credit-result-section {
    margin-bottom: 8px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

/* Credit Result Items */
.credit-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.credit-result-item.primary {
    padding: 8px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

.credit-result-item.small {
    font-size: 0.85em;
    opacity: 0.9;
}

.credit-result-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.credit-result-value {
    font-size: 0.85rem;
    color: #dc2626;
    font-weight: 700;
}

.credit-result-value.highlight {
    font-size: 0.95rem;
    font-weight: 800;
    color: #dc2626;
}

.credit-result-value.placeholder {
    color: var(--text-secondary) !important;
    font-style: italic;
    opacity: 0.7;
    font-weight: 400;
}

.credit-result-value:not(.placeholder) {
    color: #dc2626 !important;
    font-style: normal !important;
    opacity: 1 !important;
    font-weight: 700;
}

.credit-result-value.highlight:not(.placeholder) {
    font-weight: 800;
}

/* Initial Balance Display */
.credit-result-item.initial-balance {
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.credit-result-item.initial-balance .credit-result-value {
    font-size: 0.95rem;
    font-weight: 700;
}

/* Credit Card Disclaimer */
.credit-disclaimer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(239, 68, 68, 0.1);
    line-height: 1.3;
}

/* Payment Breakdown Chart */
.payment-breakdown {
    margin-top: 16px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.breakdown-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

.breakdown-header h5 {
    font-size: 0.9rem;
    color: #dc2626;
    margin: 0 0 2px 0;
    font-weight: 700;
}

.breakdown-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.breakdown-chart {
    margin-bottom: 12px;
}

.chart-row {
    display: grid;
    grid-template-columns: 140px 1fr 80px;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.chart-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.chart-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chart-bar-container {
    height: 24px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease-out;
    position: relative;
}

.principal-bar {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.interest-bar {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.chart-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.breakdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-top: 12px;
    background: white;
    border-radius: 6px;
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.total-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.total-value {
    font-size: 1rem;
    font-weight: 800;
    color: #dc2626;
}

/* Responsive adjustments for payment breakdown */
@media (max-width: 600px) {
    .chart-row {
        grid-template-columns: 120px 1fr 70px;
        gap: 8px;
    }

    .chart-label {
        font-size: 0.8rem;
    }

    .chart-value {
        font-size: 0.8rem;
    }
}

/* ============================================================================
   LOADING STATES - Added for Phase 5 enhancements
   ============================================================================ */

/* Loading button state */
.calculate-btn.loading,
.rent-calculate-btn.loading,
.credit-calculate-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.calculate-btn.loading::after,
.rent-calculate-btn.loading::after,
.credit-calculate-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================================================
   ACCESSIBILITY - Screen Reader Only Elements
   ============================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   MOBILE TOUCH TARGETS - Enhanced for Better UX
   ============================================================================ */

@media (max-width: 768px) {

    /* Ensure minimum 44x44px touch targets per Apple HIG */
    .calculate-btn,
    .reset-btn,
    .rent-calculate-btn,
    .rent-reset-btn,
    .credit-calculate-btn,
    .credit-reset-btn,
    .info-icon,
    .refresh-btn-compact {
        min-width: 44px;
        min-height: 44px;
        padding: 12px 20px;
        touch-action: manipulation;
        /* Disable double-tap zoom */
    }

    /* Larger refresh button on mobile */
    .refresh-btn-compact {
        width: 32px;
        height: 32px;
        min-width: 32px;
        max-width: 32px;
    }

    .refresh-btn-compact svg {
        width: 16px;
        height: 16px;
    }

    /* Larger tap targets for tabs */
    .tab-btn {
        min-height: 44px;
        padding: 12px 16px;
    }

    /* Increase input height for easier tapping */
    .form-group input,
    .rent-input-group input,
    .credit-input-group input {
        min-height: 44px;
        padding: 12px;
        font-size: 16px;
        /* Prevents iOS auto-zoom */
    }
}

/* ============================================================================
   SMOOTH TRANSITIONS FOR ERROR STATES
   ============================================================================ */

.form-group input,
.rent-input-group input,
.credit-input-group input {
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.message {
    transition: opacity 0.3s ease;
}

.message.hidden {
    opacity: 0;
}

/* ============================================================================
   ENHANCED FOCUS STATES FOR ACCESSIBILITY
   ============================================================================ */

*:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {

    .main-header,
    .mortgage-rates,
    .calculator-tabs,
    button {
        display: none;
    }

    .result,
    .rent-result,
    .credit-result {
        page-break-inside: avoid;
    }
}