/* Proplink Design System - Preserving existing styling */

:root {
    /* Primary Colors */
    --primary: #00236f;
    --primary-container: #1e3a8a;
    --on-primary: #ffffff;

    /* Secondary Colors */
    --secondary: #006c4a;
    --secondary-container: #82f5c1;

    /* Surface Colors */
    --background: #f8f9fa;
    --surface: #ffffff;
    --surface-variant: #e1e3e4;
    --text: #191c1d;
    --text-secondary: #666;

    /* Status Colors */
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --error: #dc2626;
    --error-bg: #fef2f2;

    /* Typography */
    --font-headline: 'Manrope', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--background);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Hide scrollbars globally */
::-webkit-scrollbar {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #00236f 0%, #1e3a8a 50%, #264191 100%);
    padding: 60px 0 80px;
    color: var(--on-primary);
}

.hero h1 {
    font-family: var(--font-headline);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero h1 .accent {
    color: var(--secondary-container);
}

.hero .tagline {
    font-size: 1.25rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

/* Search Panel */
.search-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

.search-panel h2 {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 24px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--surface-variant);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-container);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 35, 111, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Loader */
.loader {
    text-align: center;
    padding: 60px 20px;
}

.loader-animation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.loader-icon {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}

.loader-icon:nth-child(2) {
    animation-delay: 0.15s;
}

.loader-icon:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-20px);
    }
}

/* Results Section */
.results-section {
    padding: 40px 0 80px;
}

/* Sold Comps Card */
.sold-comps-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 32px;
    border-left: 3px solid var(--secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-header h2 {
    font-family: var(--font-headline);
    font-size: 1.75rem;
    color: var(--text);
}

.period-badge {
    background: var(--success-bg);
    color: var(--success);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
}

.comps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 24px;
}

.comp-stat {
    background: var(--background);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-headline);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.type-distribution {
    padding: 20px;
    background: var(--background);
    border-radius: 8px;
    margin-bottom: 20px;
}

.target-arv-banner {
    background: var(--warning-bg);
    border-left: 3px solid var(--warning);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.target-arv-banner strong {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    color: var(--warning);
}

/* View Controls */
.view-controls {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-toggle {
    display: flex;
    gap: 8px;
    background: var(--surface);
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background: var(--primary);
    color: var(--on-primary);
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.listing-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.listing-card:active {
    transform: scale(0.98);
}

.listing-card.high-value {
    border-left-color: var(--success);
}

.listing-card.moderate-value {
    border-left-color: var(--warning);
}

.listing-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.listing-content {
    padding: 20px;
}

.listing-price {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.listing-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.listing-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 16px;
}

.arv-comparison {
    padding: 12px;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 12px;
}

.arv-comparison .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.arv-comparison .value {
    font-weight: 600;
    font-size: 1.125rem;
}

.arv-comparison.below-arv .value {
    color: var(--success);
}

.profit-estimate {
    padding: 12px;
    border-radius: 6px;
}

.profit-estimate.flip-mode {
    background: var(--success-bg);
}

.profit-estimate.btl-mode {
    background: var(--warning-bg);
}

.profit-estimate .label {
    font-size: 0.75rem;
    display: block;
    margin-bottom: 4px;
}

.profit-estimate.flip-mode .label {
    color: var(--success);
}

.profit-estimate.btl-mode .label {
    color: var(--warning);
}

.profit-estimate .value {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.25rem;
}

.profit-estimate.flip-mode .value {
    color: var(--success);
}

.profit-estimate.btl-mode .value {
    color: var(--warning);
}

.block-chip {
    display: inline-block;
    background: var(--error-bg);
    color: var(--error);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 10;
}

.detail-view {
    padding: 40px;
}

/* Breakdown Tables */
.breakdown-table {
    border: 1px solid var(--surface-variant);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.breakdown-row {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--surface-variant);
    align-items: center;
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-header {
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breakdown-subtotal {
    background: var(--background);
    font-weight: 600;
    border-top: 2px solid var(--surface-variant);
}

.breakdown-total {
    background: var(--primary-container);
    color: var(--on-primary);
    font-weight: 700;
    border-top: 3px solid var(--primary);
    font-size: 1.05rem;
}

.breakdown-label {
    font-size: 0.9rem;
    color: var(--text);
}

.breakdown-header .breakdown-label,
.breakdown-total .breakdown-label {
    color: var(--on-primary);
}

.breakdown-value {
    text-align: right;
    font-weight: 500;
}

.editable-field {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--surface-variant);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    text-align: right;
    background: var(--background);
    transition: all 0.2s;
}

.editable-field:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.editable-field:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(0, 35, 111, 0.1);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .comps-grid,
    .listings-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}
