/* Listing detail view — a full-screen, premium property card shown when the
   featured 7547 Battle Grove Cir podium is clicked. Loaded on its own (not part
   of the shared styles.min.css build) so it stays inside www/realtor and is
   CSP-safe (same-origin stylesheet). */

#listing-view {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#listing-view.hidden { display: none; }

.listing-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 17, 22, 0.74);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.listing-panel {
    position: relative;
    width: min(940px, 94vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #fbfaf7;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    animation: listing-in 0.30s cubic-bezier(0.2, 0.8, 0.25, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes listing-in {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.listing-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(20, 24, 30, 0.55);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.listing-close:hover { background: rgba(20, 24, 30, 0.8); }

/* ---- Hero ---- */
.listing-hero {
    position: relative;
    height: 340px;
    flex: none;
    background: #dfe3e6;
}
.listing-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.listing-hero-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 26px 30px 22px;
    background: linear-gradient(to top, rgba(10, 13, 18, 0.86) 0%, rgba(10, 13, 18, 0.5) 55%, rgba(10, 13, 18, 0) 100%);
    color: #fff;
}
.listing-badge {
    display: inline-block;
    background: #2e9e5b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.listing-title {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.listing-sub {
    margin: 3px 0 0;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.82);
}
.listing-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.listing-price {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
/* Accent button overlaid by the price, so a CTA is visible without scrolling
   (important on short/mobile screens where the agent-card button is below the fold). */
.listing-hero-cta {
    flex: none;
    background: #2e9e5b;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: background 0.15s ease, transform 0.1s ease;
}
.listing-hero-cta:hover { background: #268650; }
.listing-hero-cta:active { transform: translateY(1px); }
.listing-price .listing-price-note {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 10px;
}

/* ---- Body ---- */
.listing-body {
    padding: 22px 30px 30px;
    overflow-y: auto;
}

.listing-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding-bottom: 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid #e7e3da;
}
.listing-stat {
    text-align: center;
    padding: 10px 6px;
    background: #f2efe8;
    border-radius: 12px;
}
.listing-stat-value {
    font-size: 21px;
    font-weight: 700;
    color: #23262b;
}
.listing-stat-label {
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a857b;
}

.listing-cols {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 28px;
}
.listing-desc h3,
.listing-agent-label {
    margin: 0 0 8px;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a857b;
    font-weight: 700;
}
.listing-desc p {
    margin: 0;
    font-size: 15px;
    line-height: 1.62;
    color: #3a3d42;
}

/* Agent card */
.listing-agent-card {
    background: #ffffff;
    border: 1px solid #e7e3da;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}
.listing-agent-name {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #23262b;
}
.listing-agent-role {
    margin: 2px 0 14px;
    font-size: 13px;
    color: #8a857b;
}
.listing-agent-phone {
    display: block;
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: #2e6f9e;
    text-decoration: none;
}
.listing-agent-phone:hover { text-decoration: underline; }
.listing-cta {
    display: block;
    text-align: center;
    background: #2e9e5b;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}
.listing-cta:hover { background: #268650; }
.listing-cta:active { transform: translateY(1px); }
.listing-payment {
    margin: 14px 2px 0;
    font-size: 13px;
    color: #8a857b;
    text-align: center;
}

/* Hide the floating on-screen gear + home buttons while the listing view is up,
   so they don't overlay the property card. Toggled by the `listing-view-open`
   body class in main.js. */
body.listing-view-open #home-btn,
body.listing-view-open #settings-btn { display: none; }

/* Also hide the mobile touch joysticks while the listing view is up. This needs
   the extra `.visible` in the selector so it outweighs the touch-controls show
   rule (`.is-touch-device #touch-controls.visible`, two classes + an id); the
   plainer `body.listing-view-open #touch-controls` loses to it on touch devices
   and the joysticks bleed through the property card. */
body.listing-view-open #touch-controls.visible { display: none; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
    #listing-view { padding: 0; }
    .listing-panel { width: 100vw; max-height: 100vh; border-radius: 0; }
    .listing-hero { height: 240px; }
    .listing-title { font-size: 24px; }
    .listing-price { font-size: 28px; }
    .listing-stats { grid-template-columns: repeat(3, 1fr); }
    .listing-cols { grid-template-columns: 1fr; gap: 22px; }
}
