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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #1a1d21;
    color: #b8c4cc;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: #6a9ab5;
    text-decoration: none;
}

a:hover {
    color: #8ab8d0;
    text-decoration: underline;
}

/* === Nav === */
.nav {
    background: #22262b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    color: #8a9aab;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-brand:hover {
    color: #a0b0bc;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-links a {
    color: #6b7a8a;
}

.nav-links a:hover {
    color: #8a9aab;
    text-decoration: none;
}

/* === Content === */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: #1e2227;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
}

.filter-group {
    flex: 1;
    min-width: 110px;
}

.filter-group.search {
    flex: 2;
    min-width: 180px;
}

.filter-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #4a5460;
    margin-bottom: 4px;
}

.filter-bar select,
.filter-bar input {
    width: 100%;
    padding: 6px 10px;
    background: #262a30;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #b8c4cc;
    font-family: inherit;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: rgba(106, 154, 181, 0.4);
}

/* noUiSlider dark theme overrides */
.noUi-target {
    background: #262a30;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    box-shadow: none;
    height: 6px;
}

.noUi-connect {
    background: #5a7a8f;
}

.noUi-handle {
    background: #8a9aab;
    border: none;
    border-radius: 50%;
    box-shadow: none;
    width: 16px !important;
    height: 16px !important;
    right: -8px !important;
    top: -6px !important;
    cursor: pointer;
}

.noUi-handle::before,
.noUi-handle::after {
    display: none;
}

.noUi-handle:hover {
    background: #a0b0bc;
}

/* === Result Count === */
.result-count {
    font-size: 0.75rem;
    color: #4a5460;
    margin-bottom: 10px;
}

/* === Houses Table === */
.houses-table-wrap {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.houses-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.houses-table thead tr {
    background: #22262b;
}

.houses-table th {
    padding: 10px 12px;
    text-align: left;
    color: #7a8490;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.houses-table th.numeric {
    text-align: right;
}

.houses-table th .sort-arrow {
    opacity: 0.3;
    margin-left: 4px;
}

.houses-table th.sorted .sort-arrow {
    opacity: 1;
}

.houses-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #9aa4ad;
}

.houses-table td.numeric {
    text-align: right;
}

.houses-table td.price {
    color: #b8c4cc;
    font-weight: 500;
}

.houses-table td.muted {
    color: #5a6672;
}

.houses-table tbody tr {
    cursor: pointer;
}

.houses-table tbody tr:nth-child(odd) {
    background: #1e2227;
}

.houses-table tbody tr:nth-child(even) {
    background: #1a1d21;
}

.houses-table tbody tr:hover {
    background: #262b31;
}

/* === Status Badge === */
.badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.badge-active {
    background: rgba(80, 180, 80, 0.1);
    color: #5ab85a;
}

.badge-off-market {
    background: rgba(200, 168, 72, 0.1);
    color: #c8a848;
}

.badge-sold {
    background: rgba(180, 80, 80, 0.1);
    color: #b85a5a;
}

.badge-unknown {
    background: rgba(128, 128, 128, 0.08);
    color: #5a6672;
}

/* === Show Page === */
.back-link {
    font-size: 0.8rem;
    color: #5a7a8f;
    border-bottom: 1px solid rgba(90, 122, 143, 0.3);
}

.house-title {
    margin: 12px 0 2px;
    color: #d8dde2;
    font-size: 1.5rem;
    font-weight: 500;
}

.house-subtitle {
    color: #6b7a8a;
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.detail-cell {
    background: #1e2227;
    padding: 14px 16px;
}

.detail-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #5a6672;
    margin-bottom: 6px;
}

.detail-value {
    font-size: 1rem;
    color: #b8c4cc;
    font-weight: 500;
}

.sources {
    margin-bottom: 28px;
    font-size: 0.8rem;
    color: #5a6672;
}

.sources a {
    color: #5a7a8f;
    border-bottom: 1px solid rgba(90, 122, 143, 0.3);
}

.photos-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.photos-header h2 {
    margin: 0;
    color: #9aa4ad;
    font-size: 0.9rem;
    font-weight: 500;
}

.photos-header .count {
    color: #4a5460;
    font-size: 0.8rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
}

.photo-grid a {
    display: block;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #262a30;
}

.photo-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.15s;
}

.photo-grid a:hover img {
    opacity: 0.8;
}

.photo-hint {
    font-size: 0.7rem;
    color: #3e4854;
    margin-top: 10px;
}

/* === Lightbox === */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 1001;
    background: none;
    border: none;
    color: #8a9aab;
    font-size: 2rem;
    cursor: pointer;
    padding: 4px 12px;
    line-height: 1;
}

.lightbox-close:hover {
    color: #d8dde2;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8a9aab;
    font-size: 2rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    line-height: 1;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #d8dde2;
}

.lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    color: #5a6672;
    font-size: 0.8rem;
}

.notes-section {
    margin-top: 24px;
    padding: 16px;
    background: #1e2227;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.notes-section h3 {
    color: #9aa4ad;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
}

/* === About Page === */
.about-content {
    max-width: 700px;
}

.about-content h1 {
    color: #d8dde2;
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.about-content p {
    margin-bottom: 16px;
    line-height: 1.8;
}

/* === 404 Page === */
.not-found {
    text-align: center;
    padding: 80px 0;
}

.not-found h1 {
    color: #d8dde2;
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.not-found p {
    color: #5a6672;
    margin-bottom: 24px;
}

/* === Footer === */
.footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: #3e4854;
}

/* === Responsive === */
@media (max-width: 768px) {
    .content {
        padding: 16px;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .houses-table-wrap {
        overflow-x: auto;
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
