* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background:
        linear-gradient(rgba(0, 63, 89, 0.62), rgba(0, 95, 131, 0.48)),
        url("/static/listings/images/blue_interior_apartment.be9a3f9e50b1.jpg");
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    color: #18232b;
}

.detail-body {
    overflow-x: hidden;
    overflow-y: auto;
}

.go-back-link {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 10px;
    background: #ffffff;
    color: #005f83;
    box-shadow: 0 8px 22px rgba(24, 35, 43, 0.16);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.go-back-link:hover {
    background: #e7f5fa;
}

.search-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    overflow: hidden;
    padding: 18px 24px 24px;
}

.search-page-results {
    padding-bottom: 24px;
}

.video-results-active {
    padding-top: 24px;
}

.search-bar {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
    gap: 0;
    padding: 10px;
    border: 1px solid #d9e3ea;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 14px 35px rgba(24, 35, 43, 0.12);
}

.search-again-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 10px;
    background: #ffffff;
    color: #005f83;
    box-shadow: 0 8px 22px rgba(24, 35, 43, 0.16);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.search-again-link:hover {
    background: #e7f5fa;
}

.search-section {
    display: grid;
    gap: 6px;
    padding: 8px 16px;
    border-right: 1px solid #d9e3ea;
}

.search-section label {
    font-size: 12px;
    font-weight: 700;
    color: #005f83;
}

.search-section input,
.search-section select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #b8cbd6;
    border-radius: 8px;
    outline: 0;
    background: #f2f8fb;
    color: #18232b;
    font-size: 15px;
    padding: 0 10px;
}

.search-section input:focus,
.search-section select:focus {
    border-color: #005f83;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 95, 131, 0.14);
}

.search-section input::placeholder {
    color: #8a98a1;
}

.budget-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.budget-range span {
    color: #8a98a1;
    font-size: 13px;
}

.search-bar button {
    min-height: 48px;
    padding: 0 24px;
    border: 0;
    border-radius: 10px;
    background: #005f83;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.search-bar button:hover {
    background: #003f59;
}

.search-message {
    width: min(100%, 900px);
    margin: 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(24, 35, 43, 0.08);
    text-align: center;
    font-weight: 700;
}

.search-message-error {
    color: #9f1239;
}

.results-area {
    width: 100%;
    min-height: 0;
    flex: 1;
    display: grid;
    place-items: center;
}

.video-feed {
    width: min(100%, 650px);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.video-stage {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 18px;
}

.video-card {
    position: relative;
    width: min(54vh, 480px);
    max-width: calc(100vw - 180px);
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 18px;
    background: #101820;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 220ms ease,
        transform 220ms ease;
    will-change: opacity, transform;
}

.video-details-button {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #005f83;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.video-details-button:hover {
    background: #ffffff;
}

.video-card.slide-out-up {
    opacity: 0;
    transform: translateY(-42px);
}

.video-card.slide-out-down {
    opacity: 0;
    transform: translateY(42px);
}

.video-card.slide-in-from-up {
    opacity: 0;
    transform: translateY(-42px);
    transition: none;
}

.video-card.slide-in-from-down {
    opacity: 0;
    transform: translateY(42px);
    transition: none;
}

.apartment-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #101820;
    object-fit: contain;
}

.video-source {
    display: none;
}

.feed-control-button {
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #232323;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
}

.feed-control-button:hover {
    background: #343434;
}

.feed-controls {
    position: fixed;
    right: 22px;
    top: 50%;
    display: grid;
    gap: 16px;
    transform: translateY(-50%);
}

.video-position {
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #18232b;
    justify-self: center;
    font-size: 13px;
    font-weight: 700;
}

.detail-page {
    width: min(100%, 1180px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 88px 24px 40px;
}

.detail-summary {
    padding: 20px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(24, 35, 43, 0.14);
}

.detail-header {
    margin-bottom: 14px;
}

.detail-header h1 {
    margin: 0;
}

.detail-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.detail-info-card {
    padding: 18px 16px;
    border: 1px solid #d9e3ea;
    border-radius: 14px;
    background: #f7fbfd;
}

.detail-label {
    display: block;
    margin: 0 0 8px;
    color: #005f83;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-value {
    margin: 0 0 8px;
    color: #18232b;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
}

.detail-gallery-section {
    margin-top: 24px;
    padding: 24px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(24, 35, 43, 0.14);
}

.detail-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.detail-image-card {
    appearance: none;
    border: 0;
    padding: 0;
    width: 100%;
    margin: 0;
    min-height: 320px;
    border-radius: 14px;
    overflow: hidden;
    background: #d9e3ea;
    box-shadow: 0 10px 24px rgba(24, 35, 43, 0.12);
    cursor: zoom-in;
}

.detail-image-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.empty-detail {
    margin: 0;
    color: #52606b;
    line-height: 1.6;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 20px;
}

.image-modal[hidden] {
    display: none;
}

.image-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(8, 15, 20, 0.82);
    cursor: pointer;
}

.image-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(96vw, 980px);
    max-height: 90vh;
    margin: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #101820;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.image-modal-image {
    display: block;
    width: 100%;
    max-height: 90vh;
    object-fit: contain;
    background: #101820;
}

.image-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #18232b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 760px) {
    .search-bar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .search-section {
        border-right: 0;
        border-bottom: 1px solid #d9e3ea;
    }

    .search-bar button {
        width: 100%;
    }

    .search-page {
        gap: 12px;
        padding: 72px 16px 16px;
    }

    .video-results-active {
        padding-top: 16px;
    }

    .video-feed {
        width: min(100%, 360px);
    }

    .video-stage {
        gap: 10px;
    }

    .video-card {
        width: min(58vh, 290px);
        max-width: calc(100vw - 92px);
    }

    .video-details-button {
        top: 10px;
        right: 10px;
        min-height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    .feed-control-button {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .feed-controls {
        right: 10px;
    }

    .detail-page {
        padding: 72px 16px 28px;
    }

    .detail-top-grid {
        grid-template-columns: 1fr;
    }

    .detail-gallery-section,
    .detail-summary {
        padding: 18px;
    }

    .detail-image-grid {
        grid-template-columns: 1fr;
    }

    .detail-image-card {
        min-height: 260px;
    }

    .image-modal {
        padding: 12px;
    }
}
