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

:root {
    --color-bg: #f8fafc;
    --color-card: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-primary: #3b82f6;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-new: #ef4444;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

header {
    background: var(--color-card);
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.search-info {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.search-info span {
    background: var(--color-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

.updated {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 500;
    color: var(--color-text-muted);
    margin-right: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

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

section {
    margin-bottom: 2rem;
}

section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.new-section h2 {
    color: var(--color-new);
    border-bottom-color: var(--color-new);
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.property-card {
    background: var(--color-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.property-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.property-card.new {
    border: 2px solid var(--color-new);
}

.badge-container {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    z-index: 1;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.new-badge {
    background: var(--color-new);
    color: white;
}

.score-badge {
    background: var(--color-text-muted);
    color: white;
}

.score-badge.good {
    background: var(--color-warning);
}

.score-badge.great {
    background: var(--color-success);
}

.property-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.property-info {
    padding: 1rem;
}

.price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.bedrooms {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.address {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.listing-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.listing-dates span {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.listing-dates.new .date-added {
    background: #dcfce7;
    color: #166534;
}

.listing-dates.medium .date-added {
    background: #fef3c7;
    color: #92400e;
}

.listing-dates.old .date-added {
    background: #fee2e2;
    color: #dc2626;
}

.date-reduced {
    background: #dbeafe;
    color: #1e40af;
}

.description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.match-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.reason {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.reason.warning {
    background: #fee2e2;
    color: #dc2626;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.source {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.card-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.card-footer a:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--color-card);
    border-radius: var(--radius);
}

.empty-state h2 {
    border: none;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--color-text-muted);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    border-top: 1px solid #e2e8f0;
}

footer p {
    margin-bottom: 0.25rem;
}

@media (max-width: 640px) {
    header {
        padding: 1.5rem 1rem;
    }

    main {
        padding: 1rem;
    }

    .property-grid {
        grid-template-columns: 1fr;
    }
}
