/**
 * Modern Airbnb-Inspired Design for Real Estate Monitor
 */

/* ========== CSS Variables ========== */
:root {
    --primary-color: #FF385C;
    --primary-dark: #E31C5F;
    --secondary-color: #00A699;
    --text-dark: #222222;
    --text-medium: #717171;
    --text-light: #B0B0B0;
    --border-color: #DDDDDD;
    --background: #FFFFFF;
    --background-light: #F7F7F7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Global Styles ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--background);
}

a {
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-color);
}

/* ========== Navigation ========== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
}

.navbar-container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
}

.navbar-brand i {
    font-size: 18px;
}

.navbar-menu {
    display: flex;
    gap: 4px;
}

.navbar-link {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-medium);
    padding: 5px 10px;
    border-radius: 20px;
    transition: var(--transition);
}

.navbar-link:hover {
    background: var(--background-light);
    color: var(--text-dark);
}

.navbar-link.active {
    color: var(--text-dark);
}

/* ========== Main Content ========== */
.main-content {
    min-height: calc(100vh - 160px);
}

.container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ========== Filter Section ========== */
.filter-bar {
    position: sticky;
    top: 43px;
    z-index: 50;
    background: var(--background);
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.type-pills-section {
    background: var(--background);
    margin-bottom: 24px;
}

.filter-container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 40px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--background);
}

.filter-input:focus {
    outline: none;
    border-color: var(--text-dark);
    box-shadow: 0 0 0 2px rgba(34, 34, 34, 0.1);
}

.filter-group-toggle {
    justify-content: flex-end;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 0;
    user-select: none;
}

.filter-toggle input[type="checkbox"] {
    display: none;
}

.filter-toggle-track {
    width: 40px;
    height: 22px;
    background: var(--border-color);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.filter-toggle input:checked ~ .filter-toggle-track {
    background: var(--primary-color);
}

.filter-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.filter-toggle input:checked ~ .filter-toggle-track .filter-toggle-thumb {
    transform: translateX(18px);
}

.filter-toggle-label {
    font-size: 14px;
    color: var(--text-dark);
}

.type-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0 20px;
}

.type-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--background);
    color: var(--text-medium);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.type-btn:hover {
    border-color: var(--text-dark);
    color: var(--text-dark);
}

.type-btn.active {
    background: var(--text-dark);
    border-color: var(--text-dark);
    color: #fff;
}

.filter-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary:hover {
    background: #000000;
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

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

/* ========== Stats Bar ========== */
.stats-bar {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 16px 0;
}

.stat-item {
    font-size: 14px;
    color: var(--text-medium);
}

.stat-item strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* ========== Listings Grid ========== */
.listings-section {
    padding: 24px 0 60px;
}

.listings-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.listings-count {
    font-size: 14px;
    color: var(--text-medium);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--background);
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ========== Listing Card ========== */
.listing-card {
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.listing-card:hover .card-image {
    transform: scale(1.05);
}

.card-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 12px;
    background-color: #f0f0f0;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

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

/* ── Save / Favourite button (card overlay) ── */
.save-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-dark);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 0;
}

.card-image-container:hover .save-btn,
.save-btn.saved {
    opacity: 1;
}

.save-btn.saved {
    color: #e53935;
}

/* ── Save button — detail page (always visible) ── */
.detail-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.detail-title-row .detail-title {
    flex: 1;
}

.save-btn-detail {
    flex-shrink: 0;
    margin-top: 4px;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    padding: 0;
}

.save-btn-detail:hover {
    border-color: #e53935;
    color: #e53935;
}

.save-btn-detail.saved {
    color: #e53935;
    border-color: #e53935;
    background: #fdecea;
}

.card-content {
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-location {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-title {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-details {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-medium);
    margin-bottom: 8px;
}

.card-detail {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.card-price--on-request {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-medium);
    font-style: italic;
}

.card-price-per-sqm {
    font-size: 13px;
    color: var(--text-medium);
}

/* ========== Time on Market + Fairness Badges (Cards) ========== */
.card-market-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    flex-wrap: wrap;
}

.tom-badge,
.fairness-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Time on market colours */
.tom-fresh  { background: #e6f4ea; color: #1a7431; }
.tom-active { background: #fff8e1; color: #7a5c00; }
.tom-aging  { background: #fff0e0; color: #a04000; }
.tom-stale  { background: #fdecea; color: #b71c1c; }

/* Source portal badge */
.source-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: auto;
}
.source-sreality { background: #e8eaf6; color: #3949ab; }
.source-bzr      { background: #fce4ec; color: #c62828; }
.source-idnes    { background: #e8f5e9; color: #2e7d32; }
.source-realingo { background: #fff3e0; color: #e65100; }

/* Fairness colours */
.fairness-great { background: #e6f4ea; color: #1a7431; }
.fairness-good  { background: #e8f5e9; color: #2e7d32; }
.fairness-avg   { background: #fff8e1; color: #7a5c00; }
.fairness-high  { background: #fdecea; color: #b71c1c; }

.card-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.card-link:hover {
    color: var(--primary-color);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    padding: 24px 0;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--background);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(.disabled):not(.active) {
    background: var(--background-light);
    border-color: var(--text-dark);
}

.page-btn.active {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========== Footer ========== */
.footer {
    background: var(--background-light);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: 60px;
}

.footer-container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 40px;
}

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

.footer-section p {
    font-size: 14px;
    color: var(--text-medium);
}

.footer-section a {
    color: var(--text-dark);
    font-weight: 500;
}

/* ========== Map Styles ========== */
#map {
    height: calc(100vh - 140px);
    width: 100%;
    border-radius: var(--border-radius);
}

.map-container {
    padding: 24px 40px;
}

.map-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.map-count {
    font-size: 14px;
    color: var(--text-medium);
    margin-left: 12px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 280px;
}

.popup-card {
    padding: 0;
}

.popup-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.popup-content {
    padding: 16px;
}

.popup-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.popup-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.popup-details {
    font-size: 13px;
    color: var(--text-medium);
    margin-bottom: 12px;
}

.popup-link {
    display: block;
    text-align: center;
    padding: 10px;
    background: var(--text-dark);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

.popup-link:hover {
    background: #000000;
    color: white;
}

/* ========== Mobile Filter Toggle ========== */
.filter-mobile-header {
    display: none;
}

.filter-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 6px 12px;
    color: var(--text-dark);
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-toggle-btn:hover {
    background: var(--background-light);
}

.filter-toggle-btn .bi {
    transition: transform 0.2s ease;
}

.filter-toggle-btn.open .bi {
    transform: rotate(180deg);
}

/* ========== Desktop: two-row filter bar ========== */
@media (min-width: 769px) {
    .filter-collapsible {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    /* Row 1: inputs + CTA buttons */
    .filter-top-row {
        display: flex;
        align-items: stretch;
        gap: 8px;
    }

    .filter-grid {
        display: flex;
        flex: 1;
        gap: 8px;
        margin-bottom: 0;
        align-items: stretch;
    }

    /* Each filter group becomes a labelled input pill */
    .filter-group {
        flex: 1;
        min-width: 0;
        gap: 0;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 7px 14px 9px;
        background: var(--background);
        transition: var(--transition);
    }

    .filter-group:focus-within {
        border-color: var(--text-dark);
        box-shadow: 0 0 0 2px rgba(34, 34, 34, 0.08);
    }

    .filter-group:first-child {
        flex: 1.5;
    }

    .filter-label {
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--text-dark);
        line-height: 1.2;
        margin-bottom: 1px;
    }

    .filter-input {
        border: none;
        padding: 0;
        font-size: 14px;
        width: 100%;
        background: transparent;
        box-shadow: none;
    }

    .filter-input:focus {
        outline: none;
        box-shadow: none;
    }

    .filter-group-toggle {
        flex: 0 0 auto;
        justify-content: center;
        align-items: center;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0 10px;
    }

    .filter-group-toggle:focus-within {
        border-color: var(--text-dark);
        box-shadow: 0 0 0 2px rgba(34, 34, 34, 0.08);
    }

    .filter-toggle {
        padding: 0;
        gap: 8px;
    }

    .filter-toggle-label {
        font-size: 13px;
    }

    .filter-actions {
        flex-shrink: 0;
        gap: 6px;
        align-items: stretch;
        margin-top: 0;
    }

    .filter-actions .btn {
        padding: 0 14px;
        font-size: 13px;
        align-self: stretch;
    }

    /* Row 2: type pills */
    .type-filter-row {
        padding: 8px 0 2px;
        margin-bottom: 0;
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 1280px) {
    .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .navbar-container,
    .filter-container,
    .container,
    .footer-container {
        padding: 0 24px;
    }

    .filter-bar {
        padding: 12px 0;
        margin-bottom: 16px;
    }

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

    .filter-mobile-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-dark);
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .filter-collapsible {
        display: none;
        margin-top: 12px;
        flex-direction: column;
        gap: 0;
    }

    .filter-collapsible.open {
        display: flex;
    }

    .filter-top-row {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .filter-grid {
        display: grid;
        grid-template-columns: 1fr;
        margin-bottom: 12px;
    }

    .filter-actions {
        margin-bottom: 4px;
    }

    .type-filter-row {
        border-top: 1px solid var(--border-color);
        padding-top: 12px;
        margin-bottom: 12px;
    }

    .listings-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .navbar-menu {
        gap: 16px;
    }

    .navbar-link span {
        display: none;
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .map-container {
        padding: 16px 24px;
    }
}

@media (max-width: 480px) {
    .navbar-container,
    .filter-container,
    .container,
    .footer-container {
        padding: 0 16px;
    }

    .card-image-container {
        border-radius: 8px;
    }
}

/* ========== Utility Classes ========== */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 32px;
}

.mb-4 {
    margin-bottom: 32px;
}

.hidden {
    display: none;
}

/* ========== No Results ========== */
.no-results {
    text-align: center;
    padding: 80px 24px;
}

.no-results i {
    font-size: 64px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.no-results p {
    font-size: 16px;
    color: var(--text-medium);
}

/* ========== Detail Page ========== */
.detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 40px 80px;
}

.detail-back {
    margin-bottom: 24px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    padding: 8px 0;
}

.back-link:hover {
    color: var(--primary-color);
}

/* Gallery */
.detail-gallery {
    margin-bottom: 40px;
}

.gallery-main {
    width: 100%;
    height: 500px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.gallery-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.gallery-thumbnail:hover {
    opacity: 0.8;
}

.gallery-thumbnail.active {
    border-color: var(--text-dark);
}

.gallery-more {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    background: var(--background-light);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-medium);
}

/* Content Grid */
.detail-content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 80px;
}

.detail-main {
    min-width: 0;
}

.detail-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}

/* Header */
.detail-header {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.detail-title-section {
    margin-bottom: 24px;
}

.detail-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.detail-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: var(--text-medium);
}

.detail-location i {
    font-size: 18px;
}

.detail-price-section {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.detail-price--on-request {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-medium);
    font-style: italic;
}

.detail-price-per-sqm {
    font-size: 16px;
    color: var(--text-medium);
}

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

.detail-section-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 24px;
}

/* Specs Grid */
.detail-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.detail-spec {
    display: flex;
    gap: 12px;
    align-items: start;
}

.detail-spec i {
    font-size: 24px;
    color: var(--text-dark);
    margin-top: 4px;
}

.spec-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.spec-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
}

/* Description */
.detail-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-medium);
    white-space: pre-wrap;
}

/* Map */
.detail-map {
    width: 100%;
    height: 400px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

/* Sidebar Cards */
.detail-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 16px;
}

.detail-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.detail-info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    font-size: 14px;
    color: var(--text-medium);
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: right;
}

.detail-badge-card {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    align-items: start;
}

.detail-badge-card i {
    font-size: 24px;
    color: var(--primary-color);
}

.detail-badge-card strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.detail-badge-card p {
    font-size: 13px;
    color: var(--text-medium);
    margin: 0;
}

/* Detail badge — urgency colour variants */
.detail-badge-tom-fresh  { border-left: 3px solid #34a853; }
.detail-badge-tom-active { border-left: 3px solid #fbbc04; }
.detail-badge-tom-aging  { border-left: 3px solid #ff6d00; }
.detail-badge-tom-stale  { border-left: 3px solid #ea4335; }

.detail-badge-tom-fresh i  { color: #34a853; }
.detail-badge-tom-active i { color: #f29900; }
.detail-badge-tom-aging i  { color: #ff6d00; }
.detail-badge-tom-stale i  { color: #ea4335; }

/* Detail badge — fairness colour variants */
.detail-badge-fairness.fairness-great { border-left: 3px solid #34a853; }
.detail-badge-fairness.fairness-good  { border-left: 3px solid #00897b; }
.detail-badge-fairness.fairness-avg   { border-left: 3px solid #fbbc04; }
.detail-badge-fairness.fairness-high  { border-left: 3px solid #ea4335; }

.detail-badge-fairness.fairness-great i { color: #34a853; }
.detail-badge-fairness.fairness-good i  { color: #00897b; }
.detail-badge-fairness.fairness-avg i   { color: #f29900; }
.detail-badge-fairness.fairness-high i  { color: #ea4335; }

/* Detail badge — ČÚZK sale price colour variants */
.detail-badge-czuk.czuk-great { border-left: 3px solid #34a853; }
.detail-badge-czuk.czuk-good  { border-left: 3px solid #00897b; }
.detail-badge-czuk.czuk-avg   { border-left: 3px solid #fbbc04; }
.detail-badge-czuk.czuk-high  { border-left: 3px solid #ea4335; }

.detail-badge-czuk.czuk-great i { color: #34a853; }
.detail-badge-czuk.czuk-good i  { color: #00897b; }
.detail-badge-czuk.czuk-avg i   { color: #f29900; }
.detail-badge-czuk.czuk-high i  { color: #ea4335; }

.czuk-source {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 0;
}

/* Livability score card */
.livability-card .detail-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.livability-score-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.livability-score-circle {
    display: flex;
    align-items: baseline;
    gap: 2px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    border: 3px solid var(--border-color);
}

.livability-score-circle.lv-excellent { border-color: #34a853; background: #e6f4ea; }
.livability-score-circle.lv-good      { border-color: #00897b; background: #e0f2f1; }
.livability-score-circle.lv-average   { border-color: #fbbc04; background: #fef9e7; }
.livability-score-circle.lv-below-average { border-color: #ff6d00; background: #fff3e0; }
.livability-score-circle.lv-poor      { border-color: #ea4335; background: #fce8e6; }

.livability-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.livability-max {
    font-size: 12px;
    color: var(--text-muted);
}

.livability-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.livability-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.lv-category {}

.lv-cat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.lv-cat-header i {
    font-size: 13px;
    color: var(--text-medium);
    width: 16px;
}

.lv-cat-label {
    font-size: 12px;
    color: var(--text-medium);
    flex: 1;
}

.lv-cat-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.lv-bar-track {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.lv-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Mortgage calculator card */
.mortgage-card .detail-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.mortgage-result {
    margin-bottom: 20px;
}

.mortgage-payment {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.mortgage-amount {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
}

.mortgage-label {
    font-size: 14px;
    color: var(--text-medium);
}

.mortgage-income {
    font-size: 13px;
    color: var(--text-medium);
}

.mortgage-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 12px;
}

.mortgage-control label {
    display: block;
    font-size: 12px;
    color: var(--text-medium);
    margin-bottom: 4px;
}

.mortgage-control label strong {
    color: var(--text-dark);
}

.mortgage-slider {
    width: 100%;
    height: 4px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Button Large */
.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
}

/* Responsive Detail Page */
@media (max-width: 1024px) {
    .detail-content-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .detail-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .detail-container {
        padding: 16px 24px 60px;
    }

    .gallery-main {
        height: 300px;
    }

    .gallery-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-title {
        font-size: 24px;
    }

    .detail-price {
        font-size: 22px;
    }

    .detail-specs {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .detail-container {
        padding: 12px 16px 48px;
    }

    .gallery-main {
        height: 250px;
        border-radius: 8px;
    }

    .gallery-thumbnails {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .gallery-thumbnail {
        height: 100px;
    }
}

/* ========== Infinite Scroll Sentinel ========== */
.scroll-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    min-height: 80px;
}

.scroll-sentinel.done {
    display: none;
}

.scroll-spinner {
    display: none;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.scroll-sentinel.loading .scroll-spinner {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Card Carousel ========== */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 14px;
    color: var(--text-dark);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    padding: 0;
}

.card-image-container:hover .carousel-btn {
    opacity: 1;
}

.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 2;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-dot.active {
    background: white;
}

.carousel-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 2;
}
