/**
 * Calculator Page Styles
 * Styles for the mortgage, affordability, refinance, closing costs, and seller net sheet calculators.
 */

:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --success: #22c55e;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--gray-700);
}

.header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 0;
    z-index: 100;
}

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

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    color: var(--gray-500);
    text-decoration: none;
    margin-left: 24px;
    font-weight: 500;
    font-size: 14px;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 24px;
}

.user-greeting {
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 500;
}

.btn-auth {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-login {
    color: var(--primary);
    background: transparent;
}

.btn-login:hover {
    background: var(--primary-light);
}

.btn-register, .btn-dashboard {
    background: var(--primary);
    color: white;
}

.btn-register:hover, .btn-dashboard:hover {
    background: var(--primary-dark);
}

.btn-logout {
    color: var(--gray-500);
    background: var(--gray-100);
}

.btn-logout:hover {
    background: var(--gray-200);
}

.page-content {
    padding: 40px 0;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.calc-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.calc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.calc-card.active {
    border-color: var(--primary);
}

.calc-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.calc-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.calc-description {
    color: var(--gray-500);
    font-size: 14px;
}

.calculator-panel {
    display: none;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.calculator-panel.active {
    display: block;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.panel-inputs {
    padding: 32px;
    border-right: 1px solid var(--gray-200);
}

.panel-results {
    padding: 32px;
    background: var(--gray-50);
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 14px;
}

.input-group small {
    color: var(--gray-500);
    font-size: 12px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Select2 Custom Styling */
.select2-container--default .select2-selection--single {
    height: 46px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    padding: 6px 8px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 32px;
    color: var(--gray-700);
    padding-left: 8px;
    font-size: 16px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px;
    right: 8px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--gray-500) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--gray-500) transparent;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.select2-dropdown {
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--primary);
    color: white;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--primary-light);
}

.select2-results__option {
    padding: 10px 12px;
    font-size: 15px;
}

.select2-container {
    width: 100% !important;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Contact Section */
.contact-section {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.contact-section.visible {
    display: block;
}

.contact-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.optional-label {
    font-size: 12px;
    font-weight: 400;
    color: var(--gray-500);
}

.required-label {
    font-size: 12px;
    font-weight: 500;
    color: #dc2626;
}

.required-asterisk {
    color: #dc2626;
}

.contact-note {
    margin-top: 12px;
    color: var(--gray-500);
}

.contact-error {
    color: #dc2626;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.contact-error.visible {
    display: block;
}

.input-group input.error {
    border-color: #dc2626;
}

.contact-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.contact-fields .input-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .contact-fields {
        grid-template-columns: 1fr;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.result-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.result-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
}

.result-value.highlight {
    color: var(--primary);
}

.result-breakdown {
    margin-top: 24px;
}

.breakdown-title {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-row .label {
    color: var(--gray-500);
}

.breakdown-row .value {
    font-weight: 500;
    color: var(--gray-900);
}

.placeholder-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.placeholder-results .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 16px;
}

.placeholder-results .icon img {
    max-width: 120px;
    max-height: 120px;
    display: block;
}

/* Blur overlay styles */
.results-wrapper {
    position: relative;
}

.results-blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    border-radius: 12px;
    z-index: 10;
}

.overlay-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.overlay-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
    text-align: center;
}

.overlay-text {
    color: var(--gray-500);
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
}

.btn-unlock {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-unlock:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.4);
}

/* Collapsible Sections for Net Sheet */
.section-header {
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.section-header.collapsible {
    cursor: pointer;
    user-select: none;
}

.section-header.collapsible:hover {
    background: var(--gray-50);
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.section-header .toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 12px;
    margin-right: 8px;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding-bottom: 16px;
}

.section-content.collapsed {
    display: none;
}

.readonly-field {
    background: var(--gray-100);
    color: var(--gray-700);
    cursor: not-allowed;
}

/* Net Sheet Results */
.net-sheet-summary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.net-sheet-summary .amount {
    font-size: 36px;
    font-weight: 700;
}

.net-sheet-summary .label {
    font-size: 14px;
    opacity: 0.9;
}

.deduction-section {
    margin-bottom: 16px;
}

.deduction-section-header {
    background: var(--gray-100);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-700);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
}

.deduction-section-body {
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 8px 0;
}

.deduction-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 14px;
}

.deduction-row .label {
    color: var(--gray-600);
}

.deduction-row .value {
    font-weight: 500;
    color: var(--gray-900);
}

.deduction-row .value.negative {
    color: #dc2626;
}

.net-sheet-disclaimer {
    margin-top: 20px;
    padding: 16px;
    background: #fef3c7;
    border-radius: 8px;
    font-size: 12px;
    color: #92400e;
    line-height: 1.5;
}

/* Assessment Modal */
.assessment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.assessment-modal.active {
    display: flex;
}

.assessment-card {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.assessment-header {
    padding: 24px 24px 0;
    text-align: center;
}

.assessment-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-200);
    transition: background 0.2s;
}

.progress-dot.active {
    background: var(--primary);
}

.progress-dot.completed {
    background: var(--success);
}

.assessment-body {
    padding: 24px;
}

.assessment-question {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 24px;
    text-align: center;
}

.assessment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.option-btn:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.option-btn.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-form input {
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
}

.contact-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.assessment-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.btn-skip {
    padding: 12px 24px;
    background: transparent;
    color: var(--gray-500);
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-skip:hover {
    color: var(--gray-900);
}

.btn-next {
    padding: 12px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-next:hover {
    background: var(--primary-dark);
}

.btn-next:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* Savings badge */
.savings-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: white;
    padding: 60px 0 30px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-brand {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-tagline {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    line-height: 1.6;
}

.footer-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
}

@media (max-width: 768px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }

    .panel-inputs {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .nav-links { display: none; }
    .auth-buttons { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .input-row { grid-template-columns: 1fr; }
}
