/* Modern CSS Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Light Theme Variables */
:root[data-theme="light"] { --primary-color: #2563eb; --primary-hover: #1d4ed8; --primary-light: #eff6ff; --secondary-color: #64748b; --success-color: #10b981; --success-light: #d1fae5; --warning-color: #f59e0b; --warning-light: #fef3c7; --error-color: #ef4444; --error-light: #fef2f2; --info-color: #06b6d4; --info-light: #cffafe; --property-tax-color: #8b5cf6; --property-tax-current-color: #f472b6; --background-color: #f8fafc; --background-secondary: #f1f5f9; --card-background: #ffffff; --card-secondary: #f8fafc; --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #64748b; --border-color: #e2e8f0; --border-focus: #2563eb; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }

/* Medium Theme Variables (Default) */
:root, :root[data-theme="medium"] { --primary-color: #3b82f6; --primary-hover: #2563eb; --primary-light: #1e293b; --secondary-color: #64748b; --success-color: #10b981; --success-light: #1f2937; --warning-color: #f59e0b; --warning-light: #1f2937; --error-color: #ef4444; --error-light: #1f2937; --info-color: #06b6d4; --info-light: #1f2937; --property-tax-color: #8b5cf6; --property-tax-current-color: #f472b6; --background-color: #0f172a; --background-secondary: #1e293b; --card-background: #1e293b; --card-secondary: #334155; --text-primary: #f1f5f9; --text-secondary: #cbd5e1; --text-muted: #94a3b8; --border-color: #374151; --border-focus: #3b82f6; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5); }

/* Dark Theme Variables */
:root[data-theme="dark"] { --primary-color: #60a5fa; --primary-hover: #3b82f6; --primary-light: #111827; --secondary-color: #6b7280; --success-color: #34d399; --success-light: #111827; --warning-color: #fbbf24; --warning-light: #111827; --error-color: #f87171; --error-light: #111827; --info-color: #22d3ee; --info-light: #111827; --property-tax-color: #c084fc; --property-tax-current-color: #f472b6; --background-color: #030712; --background-secondary: #111827; --card-background: #111827; --card-secondary: #1f2937; --text-primary: #f9fafb; --text-secondary: #d1d5db; --text-muted: #9ca3af; --border-color: #374151; --border-focus: #60a5fa; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6); --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.7), 0 8px 10px -6px rgb(0 0 0 / 0.7); }

/* Shared CSS Variables */
:root { --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-2xl: 1.5rem; }

/* Base Styles */
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: var(--text-primary); background: linear-gradient(135deg, var(--background-color) 0%, var(--background-secondary) 100%); min-height: 100vh; font-feature-settings: 'cv11', 'ss01'; font-variation-settings: 'opsz' 32; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; transition: background-color 0.3s ease, color 0.3s ease; }
.container { max-width: 1800px; margin: 0 auto; padding: 1rem; }

/* Header and Theme Selector */
header { margin-bottom: 1.5rem; padding: 1rem 1.5rem; background: linear-gradient(135deg, var(--primary-color), var(--info-color)); border-radius: var(--radius-xl); color: white; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
header::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='m20 20v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-20V0h-2v4h-4v2h4v4h2V6h4V4h-4zM0 20v-4H-2v4h-4v2h4v4h2v-4h4v-2H0z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat; opacity: 0.6; pointer-events: none; }
.header-main { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; gap: 2rem; }
.header-content { flex: 1; }
.header-content h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.25rem; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); line-height: 1.2; }
.header-content p { font-size: 0.85rem; opacity: 0.9; font-weight: 400; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); margin: 0; line-height: 1.3; }
.theme-selector { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; justify-content: flex-end; }
.theme-selector label { font-size: 0.8rem; font-weight: 600; color: white; opacity: 0.9; white-space: nowrap; }
.theme-select { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); color: white; padding: 0.4rem 0.75rem; border-radius: var(--radius-md); font-size: 0.75rem; font-family: inherit; font-weight: 500; cursor: pointer; backdrop-filter: blur(10px); -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.5rem center; background-repeat: no-repeat; background-size: 1em 1em; padding-right: 2rem; min-width: 100px; transition: all 0.2s ease; }
.theme-select:focus { outline: none; border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.2); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2); }
.theme-select:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); }

/* Form Layout */
.calculator-wrapper { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
.input-section { width: 100%; }
.calculator-form { background: var(--card-background); padding: 1.5rem; border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl); border: 1px solid var(--border-color); position: relative; overflow: hidden; transition: background-color 0.3s ease; }
.calculator-form::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary-color), var(--info-color), var(--success-color)); }
.form-section { margin-bottom: 2rem; }
.form-section:last-child { margin-bottom: 0; }
.form-section h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-color); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.section-description { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; font-style: italic; padding: 0.75rem; background: var(--background-color); border-radius: var(--radius-md); border-left: 3px solid var(--info-color); }

/* Scenario Tabs */
.purchase-price-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border-color); }
.tab-button { background: var(--background-color); border: 2px solid var(--border-color); color: var(--text-secondary); padding: 0.75rem 1.5rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-weight: 600; cursor: pointer; transition: all 0.3s ease; border-bottom: none; margin-bottom: -2px; font-family: inherit; }
.tab-button:hover { background: var(--card-background); color: var(--text-primary); }
.tab-button.active { background: var(--card-background); border-color: var(--primary-color); color: var(--primary-color); border-bottom: 2px solid var(--card-background); }
.scenarios-container { position: relative; }
.scenario { display: none; animation: fadeIn 0.3s ease-in-out; }
.scenario.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Form Elements */
.form-row { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
.form-row:last-child { margin-bottom: 0; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.currency-symbol, .percentage-symbol { position: absolute; font-weight: 600; color: var(--text-secondary); font-size: 1rem; z-index: 2; }
.currency-symbol { left: 0.75rem; } .percentage-symbol { right: 0.75rem; }
.form-group input { width: 100%; padding: 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-lg); font-size: 1.1rem; font-family: inherit; transition: all 0.3s ease; background-color: var(--background-color); color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 500; -webkit-appearance: none; -moz-appearance: textfield; min-height: 50px; }
.currency-input { padding-left: 2.5rem !important; } .text-input { padding-left: 0.75rem !important; }
.form-group input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); background-color: var(--card-background); }
.form-group input:hover:not(:focus) { border-color: var(--secondary-color); }
.form-group input::-webkit-outer-spin-button, .form-group input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; font-style: italic; }
.amortization-select { width: 100%; padding: 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-lg); font-size: 1.1rem; font-family: inherit; background-color: var(--background-color); color: var(--text-primary); font-weight: 500; cursor: pointer; transition: all 0.3s ease; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.75rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-right: 3rem; }
.amortization-select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); background-color: var(--card-background); }
.amortization-select:hover:not(:focus) { border-color: var(--secondary-color); }

/* Results Section */
.results-section { background: var(--card-background); border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl); border: 1px solid var(--border-color); width: 100%; transition: background-color 0.3s ease; }
.results-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border-color); background: var(--card-secondary); border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; }
.results-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.pdf-controls { display: flex; align-items: center; gap: 1rem; }
.report-type-select { background: var(--background-color); border: 2px solid var(--border-color); color: var(--text-primary); padding: 0.5rem 0.75rem; border-radius: var(--radius-lg); font-size: 0.85rem; font-family: inherit; font-weight: 500; cursor: pointer; transition: all 0.3s ease; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.5rem center; background-repeat: no-repeat; background-size: 1.25em 1.25em; padding-right: 2.25rem; min-width: 160px; }
.report-type-select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.report-type-select:hover { border-color: var(--secondary-color); }
.save-pdf-btn { background: linear-gradient(135deg, var(--success-color), #059669); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: var(--radius-lg); font-weight: 600; cursor: pointer; transition: all 0.3s ease; font-size: 0.9rem; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 0.5rem; font-family: inherit; white-space: nowrap; }
.save-pdf-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); background: linear-gradient(135deg, #059669, var(--success-color)); }
.save-pdf-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.pdf-content { padding: 2rem; }
.scenario-comparison-grid { display: grid; gap: 2rem; margin-bottom: 2rem; }
.scenario-comparison-item { background: var(--background-color); border: 2px solid var(--border-color); border-radius: var(--radius-xl); padding: 2rem; position: relative; transition: background-color 0.3s ease; }
.scenario-comparison-item.best-overall { border-color: var(--success-color); background: var(--success-light); }
.scenario-comparison-item.best-overall::before { content: "🏆 Best Overall Value"; position: absolute; top: 1rem; right: 1rem; background: var(--success-color); color: white; font-size: 0.8rem; font-weight: 700; padding: 0.5rem 1rem; border-radius: 2rem; box-shadow: var(--shadow-md); text-transform: uppercase; letter-spacing: 0.05em; }
.scenario-title { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.selected-amortization { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.scenario-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; padding: 1.5rem; background: var(--card-background); border-radius: var(--radius-lg); border-left: 4px solid var(--primary-color); }
.summary-stat { text-align: center; }
.summary-stat .label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 0.25rem; letter-spacing: 0.05em; }
.summary-stat .value { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.summary-stat .value.primary { color: var(--primary-color); font-size: 1.4rem; }
.payment-options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.payment-option-card { background: var(--card-background); border: 2px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.payment-option-card.best-option { border-color: var(--warning-color); background: var(--warning-light); }
.payment-option-card .years { font-size: 1rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.5rem; }
.payment-option-card .amount { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.5rem; font-variant-numeric: tabular-nums; }
.payment-option-card .frequency { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.payment-option-card .details { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }
.clickable-option { cursor: pointer; position: relative; user-select: none; }
.clickable-option:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-color); }
.clickable-option.selected-option { border-color: var(--primary-color); background: var(--primary-light); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); transform: translateY(-2px); animation: selectPulse 0.6s ease-out; }
.clickable-option.selected-option::after { content: "✓ Selected"; position: absolute; top: 0.5rem; right: 0.5rem; background: var(--primary-color); color: white; font-size: 0.7rem; font-weight: 700; padding: 0.25rem 0.5rem; border-radius: 1rem; text-transform: uppercase; letter-spacing: 0.05em; z-index: 2; }
.clickable-option:active { transform: translateY(-1px); transition: transform 0.1s ease; }
@keyframes selectPulse { 0% { transform: scale(1) translateY(-2px); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 70% { transform: scale(1.02) translateY(-2px); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } 100% { transform: scale(1) translateY(-2px); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }
.current-comparison-section { margin-top: 2rem; padding: 2rem; background: linear-gradient(135deg, var(--success-light), var(--info-light)); border-radius: var(--radius-xl); border: 2px solid var(--success-color); }
.comparison-header { text-align: center; margin-bottom: 1rem; }
.comparison-header h3 { font-size: 1.2rem; font-weight: 700; color: var(--success-color); display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.current-comparison-grid { display: grid; gap: 1.5rem; }
.compact-comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.compact-comparison-item { background: white; border: 2px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; display: grid; grid-template-columns: 1fr auto auto; gap: 1.5rem; align-items: center; transition: all 0.3s ease; }
.compact-comparison-item.positive-savings { border-color: var(--success-color); background: var(--success-light); }
.compact-comparison-item.negative-savings { border-color: var(--error-color); background: var(--error-light); }
.compact-comparison-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.scenario-info h4 { font-size: 1.1rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.5rem; }
.amortization-badge { background: var(--primary-color); color: white; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 1rem; letter-spacing: 0.05em; text-transform: uppercase; display: inline-block; }
.payment-summary { text-align: center; }
.bi-weekly-amount { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.25rem; }
.payment-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.savings-summary { text-align: center; }
.savings-amount { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.25rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.savings-amount.positive { color: var(--success-color); } .savings-amount.negative { color: var(--error-color); }
.savings-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; margin-bottom: 0.25rem; }
.annual-savings { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }
.placeholder-message { grid-column: 1 / -1; text-align: center; padding: 2rem 1rem; background: var(--background-color); border-radius: var(--radius-xl); border: 2px dashed var(--border-color); }
.placeholder-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.7; }
.placeholder-message h4 { font-size: 1.2rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.placeholder-message p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* Responsive Breakpoints */
@media (min-width: 768px) { .container { padding: 1.5rem; } header { margin-bottom: 2rem; padding: 1.25rem 2rem; } .header-content h1 { font-size: 2rem; } .header-content p { font-size: 0.95rem; } .calculator-form { padding: 2rem; } .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; } .form-row .form-group { align-self: start; } .payment-options-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; } }
@media (min-width: 1024px) { .calculator-wrapper { grid-template-columns: 460px 1fr; gap: 2rem; height: calc(100vh - 140px); } .input-section { height: 100%; overflow-y: auto; padding-right: 0.5rem; } .results-section { height: 100%; overflow-y: auto; display: flex; flex-direction: column; } .results-header { padding: 1.5rem 2rem 1rem; } .pdf-content { flex: 1; } .payment-options-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .calculator-wrapper { grid-template-columns: 460px 1fr; } }
@media (max-width: 768px) { .header-main { flex-direction: column; gap: 1rem; align-items: stretch; text-align: center; } .theme-selector { width: 100%; justify-content: center; } .header-actions-wrapper { align-items: stretch; } .results-header { flex-direction: column; gap: 1rem; align-items: stretch; } .pdf-controls { flex-direction: column; gap: 0.75rem; } .save-pdf-btn { justify-content: center; } .purchase-price-tabs { flex-direction: column; } .tab-button { border-radius: var(--radius-lg); border-bottom: 2px solid var(--border-color); margin-bottom: 0; } .tab-button.active { border-bottom: 2px solid var(--primary-color); } .payment-options-grid { grid-template-columns: 1fr; } .compact-comparison-grid { grid-template-columns: 1fr; } .compact-comparison-item { grid-template-columns: 1fr; text-align: center; gap: 1rem; } .scenario-summary { grid-template-columns: repeat(2, 1fr); } .amortization-select { font-size: 16px; } }

/* Touch and Other States */
@media (hover: none) and (pointer: coarse) { .clickable-option:hover { transform: none; } .clickable-option:active { transform: scale(0.98); background: var(--card-secondary); transition: all 0.2s ease; } .clickable-option.selected-option:active { transform: scale(0.98); } .payment-option-card:hover, .compact-comparison-item:hover { transform: none; box-shadow: none; } .compact-comparison-item:active { transform: scale(0.98); border-color: var(--primary-color); } }
.loading { opacity: 0.6; pointer-events: none; }
.error-message { color: var(--error-color); font-size: 0.85rem; margin-top: 0.5rem; display: none; padding: 0.75rem; background: var(--error-light); border-radius: var(--radius-md); border-left: 3px solid var(--error-color); font-weight: 500; }
.form-group.error input { border-color: var(--error-color); background-color: var(--error-light); } .form-group.error .error-message { display: block; }

/* Print and Browser Specifics */
@media print { .save-pdf-btn, .pdf-controls, .theme-selector { display: none !important; } .calculator-wrapper { grid-template-columns: 1fr !important; } .input-section { display: none !important; } .pdf-content { background: white !important; color: black !important; } .scenario-comparison-item, .compact-comparison-item { break-inside: avoid; page-break-inside: avoid; } }
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) { body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } }
@supports (-webkit-touch-callout: none) { .form-group input, .amortization-select { -webkit-appearance: none; border-radius: var(--radius-lg); } }
@media screen and (max-width: 767px) { .form-group input { font-size: 16px; } }
@supports (padding: max(0px)) { .container { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); } header { padding-top: max(1.25rem, env(safe-area-inset-top)); } }

/* Header Buttons and Actions */
.header-actions-wrapper { display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem; flex-shrink: 0; }
.header-buttons { display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch; }
.header-btn { color: white; text-decoration: none; font-weight: 600; padding: 0.5rem 1rem; background: rgba(255,255,255,0.15); border-radius: var(--radius-md); transition: background 0.2s ease; text-align: center; white-space: nowrap; cursor: pointer; }
.header-btn:hover { background: rgba(255,255,255,0.25); }

/* Amortization & Deductions */
.amortization-options { margin-top: 1.5rem; padding: 1rem; background: var(--card-secondary); border-radius: var(--radius-lg); border-left: 4px solid var(--info-color); }
.amortization-options h4, .individual-deductions-section h4 { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; text-transform: uppercase; }
.individual-deductions-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.amortization-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.amortization-select { width: 100%; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: var(--radius-lg); background: var(--card-background); color: var(--text-primary); font-size: 1rem; font-weight: 500; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.75rem center; background-repeat: no-repeat; padding-right: 2rem; }

/* Current Inputs Alignment Fix */
.current-inputs { display: flex; gap: 1rem; align-items: flex-start; }
.current-inputs .form-group { flex: 1; }
.current-inputs .form-group label { min-height: 3rem; }
.current-inputs .form-group .input-wrapper { min-height: 80px; }

/* User Guide Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.7); z-index: 1000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--card-background); color: var(--text-primary); padding: 2.5rem; border-radius: var(--radius-xl); width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: var(--shadow-xl); border: 1px solid var(--border-color); }
.modal-close-btn { position: absolute; top: 1rem; right: 1.5rem; background: none; border: none; font-size: 2.5rem; font-weight: 300; line-height: 1; color: var(--text-muted); cursor: pointer; transition: color 0.2s ease; }
.modal-close-btn:hover { color: var(--text-primary); }
.modal-content h2 { margin-top: 0; margin-bottom: 1rem; color: var(--primary-color); } .modal-content h3 { margin-top: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; } .modal-content h4 { margin-top: 1.5rem; margin-bottom: 0.5rem; } .modal-content p, .modal-content ul { font-size: 0.95rem; line-height: 1.7; } .modal-content ul { padding-left: 1.5rem; } .modal-content code { background: var(--background-secondary); padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); font-family: 'Courier New', Courier, monospace; }

/* Checkbox and Utility Styles */
.form-group-checkbox { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; margin-bottom: 2rem; }
.form-group-checkbox label { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.form-group-checkbox input { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.hidden { display: none !important; }
