/* ===================================
   Home Sale Net Proceeds Calculator
   Professional Stylesheet
   =================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.2);
    position: relative;
    margin-top: 20px;
    border-radius: 2px;
}

.progress-bar span {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #4ade80;
    transition: width 0.3s ease;
    width: 0%;
    border-radius: 2px;
}

/* Calculator Body */
.calculator-body {
    padding: 40px;
}

/* Sections */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* Sale Methods Grid */
.sale-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sale-method-card {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sale-method-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.sale-method-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.sale-method-card input[type="radio"]:checked + label {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.sale-method-card input[type="radio"]:checked + label::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.sale-method-card label {
    display: block;
    padding: 20px;
    cursor: pointer;
    position: relative;
}

.method-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.method-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 5px;
}

.method-desc {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.method-details {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Method Settings */
.method-settings {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.method-settings h4 {
    color: #333;
    margin-bottom: 15px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Form Groups */
.form-group {
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group label .required {
    color: #ef4444;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background: #f9fafb;
    cursor: not-allowed;
}

/* Input Addons */
.input-addon {
    display: flex;
    align-items: center;
}

.input-addon span {
    padding: 12px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #6b7280;
    font-weight: 500;
}

.input-addon span:last-child {
    border-right: 2px solid #e5e7eb;
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.input-addon input {
    border-radius: 0;
}

.input-addon input:first-child {
    border-radius: 8px 0 0 8px;
}

.input-addon input:last-child {
    border-radius: 0 8px 8px 0;
}

/* Autocomplete */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.autocomplete-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f3f4f6;
}

.suggestion-item strong {
    color: #333;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Sliders */
.slider-container {
    margin-top: 10px;
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-value {
    text-align: center;
    margin-top: 5px;
    font-weight: 600;
    color: #667eea;
}

/* Estimate Box */
.estimate-box {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
}

.estimate-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.estimate-range {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.estimate-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Buttons */
.buttons-container {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

/* Results Section */
.results-section {
    display: none;
    margin-top: 40px;
    padding: 40px;
    background: #f9fafb;
    border-radius: 12px;
}

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

/* Comparison Section */
.comparison-section {
    margin-bottom: 30px;
}

.comparison-section h3 {
    color: #333;
    margin-bottom: 20px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.comparison-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.comparison-card .method {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.comparison-card .amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.comparison-card.best {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, rgba(34, 197, 94, 0.1) 100%);
    border: 2px solid #4ade80;
}

/* KPI Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.kpi-card .label {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.kpi-card.primary .value {
    color: #667eea;
}

.kpi-card.success .value {
    color: #4ade80;
}

.kpi-card.danger .value {
    color: #ef4444;
}

/* Breakdown Table */
.breakdown-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.breakdown-table table {
    width: 100%;
    border-collapse: collapse;
}

.breakdown-table th {
    background: #f3f4f6;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.breakdown-table td {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
}

.breakdown-table .total-row {
    background: #f9fafb;
    font-weight: 700;
    font-size: 1.2rem;
}

.breakdown-table .negative {
    color: #ef4444;
}

.breakdown-table .positive {
    color: #4ade80;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.chart-container canvas {
    max-height: 400px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}

.alert.active {
    display: flex;
}

.alert strong {
    font-weight: 600;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Sticky Bar */
.sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    display: none;
    z-index: 100;
}

.sticky-bar.active {
    display: block;
}

.sticky-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticky-net {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4ade80;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .calculator-body {
        padding: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .sale-methods-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-cards {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sticky-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .buttons-container {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .header {
        background: none;
        color: #333;
        border-bottom: 2px solid #667eea;
    }
    
    .buttons-container,
    .sticky-bar,
    .progress-bar,
    .alert {
        display: none !important;
    }
    
    .results-section {
        padding: 20px;
        background: white;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
}