/**
 * MLD Property Modules — BMN Estimate, Recently Sold Nearby, Similar Homes,
 * desktop right rail, sticky mobile CTA bar, tour time chips.
 * Shared by single-property-desktop-v3.php AND single-property-mobile-v3.php.
 * v6.154.0 (2026-07 web audit / iOS v544-550 parity round)
 */

/* ------------------------------------------------ value section (shared) -- */

.mld-value-section .mld-est-headline {
    margin: 0 0 4px;
}
.mld-value-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}
@media (max-width: 900px) {
    .mld-value-grid {
        grid-template-columns: 1fr;
    }
}

.mld-est-panel,
.mld-est-cta-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    background: #fff;
}

/* Loading skeleton — an async section must never be invisibly empty (#85C) */
.mld-est-skel-line {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: mldEstShimmer 1.4s ease infinite;
    margin: 10px 0;
}
.mld-est-skel-line--lg {
    height: 34px;
    width: 55%;
}
.mld-est-skel-line--bar {
    height: 8px;
}
@keyframes mldEstShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .mld-est-skel-line { animation: none; }
}

.mld-est-value-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.mld-est-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}
.mld-est-conf {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.mld-est-conf-high {
    background: #ecfdf5;
    color: #047857;
}
.mld-est-conf-medium {
    background: #fffbeb;
    color: #b45309;
}

.mld-est-range-bar {
    position: relative;
    margin: 18px 2px 6px;
    height: 8px;
}
.mld-est-range-track {
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #bae6fd, #0e7490, #bae6fd);
    opacity: 0.75;
}
.mld-est-range-dot {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0e7490;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
}
.mld-est-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #4b5563;
    font-weight: 600;
}
.mld-est-range-caption {
    color: #9ca3af;
    font-weight: 400;
}
.mld-est-meta {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #4b5563;
}
.mld-est-disclaimer {
    margin-top: 8px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #9ca3af;
}

/* Estimate suppressed/unavailable → the CTA card carries the surface */
.mld-est-cta-only .mld-est-panel {
    display: none;
}
.mld-est-cta-only .mld-value-grid {
    grid-template-columns: 1fr;
}

.mld-est-cta-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 60%);
}
.mld-est-cta-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
.mld-est-cta-sub {
    font-size: 0.85rem;
    color: #4b5563;
    margin: 0;
}
.mld-est-cta-btn {
    margin-top: 6px;
    padding: 12px 18px;
    border: 0;
    border-radius: 8px;
    background: #0e7490;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    align-self: flex-start;
}
.mld-est-cta-btn:hover {
    background: #155e75;
}

/* ------------------------------------------------ card rails (solds/sim) -- */

.mld-pm-subsection {
    margin-top: 28px;
}
.mld-pm-subsection > h3 {
    margin: 0 0 12px;
}
.mld-pm-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1100px) {
    .mld-pm-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 767px) {
    .mld-pm-rail {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 12px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .mld-pm-rail .mld-pm-card {
        flex: 0 0 70vw;
        max-width: 280px;
        scroll-snap-align: start;
    }
}

.mld-pm-card {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.mld-pm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
@media (prefers-reduced-motion: reduce) {
    .mld-pm-card, .mld-pm-card:hover { transform: none; transition: none; }
}
.mld-pm-card-photo {
    position: relative;
    aspect-ratio: 3 / 2;
    background: #f3f4f6;
}
.mld-pm-card-photo img,
.mld-pmc-nophoto {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mld-pm-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 9px;
    border-radius: 6px;
    color: #fff;
}
.mld-pm-badge-sold {
    background: rgba(17, 24, 39, 0.85);
}
.mld-pm-badge-active {
    background: #047857;
}
.mld-pm-card-body {
    padding: 12px 14px 14px;
}
.mld-pm-card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}
.mld-pm-card-meta {
    font-size: 0.8rem;
    color: #4b5563;
    margin-top: 2px;
}
.mld-pm-card-addr {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------- desktop right rail -- */

@media (min-width: 1200px) {
    .mld-v3-content {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 32px;
    }
    .mld-v3-content > .mld-v3-main {
        flex: 1 1 0;
        min-width: 0;
    }
    .mld-v3-right-rail {
        flex: 0 0 340px;
        width: 340px;
        position: sticky;
        top: 84px;
        order: 2; /* markup-first (parser-safety), visually right of main */
    }
    /* Any other direct child (market analytics section, etc.) spans the full
       row below the main+rail pair instead of squeezing into the flex line. */
    .mld-v3-content > *:not(.mld-v3-main):not(.mld-v3-right-rail) {
        flex: 1 1 100%;
        min-width: 0;
    }
}
@media (max-width: 1199px) {
    .mld-v3-right-rail {
        display: none;
    }
}
.mld-v3-rail-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 22px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.mld-v3-rail-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}
.mld-v3-rail-monthly {
    font-size: 0.85rem;
    color: #4b5563;
    margin-top: 2px;
}
.mld-v3-rail-facts {
    font-size: 0.9rem;
    color: #374151;
    margin-top: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.mld-v3-rail-estimate {
    font-size: 0.85rem;
    color: #0e7490;
    margin: 12px 0 0;
}
.mld-v3-rail-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 13px 16px;
    border-radius: 9px;
    border: 1.5px solid #0e7490;
    background: #fff;
    color: #0e7490;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.mld-v3-rail-btn:hover {
    background: #f0f9ff;
}
.mld-v3-rail-btn-primary {
    background: #0e7490;
    color: #fff;
}
.mld-v3-rail-btn-primary:hover {
    background: #155e75;
    color: #fff;
}
.mld-v3-rail-note {
    margin-top: 12px;
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
}

/* --------------------------------------------------- sticky mobile CTA --- */

.mld-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000; /* below modals (10k+) and the app banner */
    display: flex;
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #e5e7eb;
    transform: translateY(110%);
    transition: transform 0.25s ease;
}
.mld-sticky-cta.mld-sticky-cta-visible {
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .mld-sticky-cta { transition: none; }
}
.mld-sticky-cta-price {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    margin-right: auto;
}
.mld-sticky-cta-price strong {
    font-size: 1.05rem;
    color: #111827;
    white-space: nowrap;
}
.mld-sticky-cta-price span {
    font-size: 0.7rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 34vw;
}
.mld-sticky-cta button {
    border: 0;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 16px;
    cursor: pointer;
    min-height: 44px;
}
.mld-sticky-cta-contact {
    background: #f3f4f6;
    color: #111827;
}
.mld-sticky-cta-tour {
    background: #0e7490;
    color: #fff;
}
/* Keep the chatbot FAB clear of the bar while it's visible */
body.mld-has-sticky-cta .mld-chat-bubble {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
}
@media (min-width: 900px) {
    .mld-sticky-cta {
        display: none;
    }
}

/* ------------------------------------------------------ tour time chips -- */

.mld-tour-chips {
    margin: 4px 0 16px;
}
.mld-tour-chips-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.mld-tour-chips-label span {
    font-weight: 400;
    color: #9ca3af;
}
.mld-tour-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.mld-tour-chip {
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.mld-tour-chip:hover {
    border-color: #0e7490;
}
.mld-tour-chip.selected {
    background: #0e7490;
    border-color: #0e7490;
    color: #fff;
}
