/**
 * Unified App Promotion Surfaces
 *
 * Single stylesheet for every iOS-app promo surface (smart banner, desktop
 * footer QR promo, property inline card). All surfaces ship hidden;
 * assets/js/mld-app-promo.js reveals them based on client-side device
 * detection (pages are edge-cached UA-agnostically, so device gating must
 * never be server-side).
 *
 * @since 6.196.0 Consolidated from the inline <style> blocks previously
 *                emitted by MLD_App_Store_Banner render methods.
 */

/* Banner height drives the whole fixed-element offset system below. */
:root {
    --mld-app-banner-h: 64px;
}
@media (max-width: 380px) {
    :root {
        --mld-app-banner-h: 56px;
    }
}

/* ========================================
   SMART BANNER (all iOS browsers)
   Native-iOS look: icon / title+rating / GET pill
   ======================================== */
#mld-app-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    height: var(--mld-app-banner-h);
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: rgba(248, 249, 250, 0.97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #dee2e6;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    box-sizing: border-box;
    cursor: pointer;
}
#mld-app-banner.mld-banner-visible {
    display: flex;
}
#mld-app-banner .mld-banner-close {
    background: none;
    border: none;
    /* >=44x44 tap target (16px icon + padding); negative margin keeps the
       occupied footprint compact so the banner layout is unchanged. */
    padding: 14px 10px;
    margin: -14px -6px;
    color: #8e8e93;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}
#mld-app-banner .mld-banner-close svg {
    display: block;
}
#mld-app-banner .mld-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
#mld-app-banner .mld-banner-text {
    flex: 1;
    min-width: 0;
    margin: 0 2px;
}
#mld-app-banner .mld-banner-title {
    font-weight: 600;
    font-size: 15px;
    color: #1c1c1e;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#mld-app-banner .mld-banner-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
}
#mld-app-banner .mld-banner-stars {
    color: #f59e0b;
    font-size: 11px;
    letter-spacing: 1px;
    flex-shrink: 0;
}
#mld-app-banner .mld-banner-subtitle {
    font-size: 12px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
}
#mld-app-banner .mld-banner-get {
    flex-shrink: 0;
    background: #0071e3;
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    padding: 7px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
}
@media (max-width: 380px) {
    #mld-app-banner .mld-banner-icon {
        width: 38px;
        height: 38px;
        border-radius: 9px;
    }
    #mld-app-banner .mld-banner-get {
        padding: 6px 14px;
        font-size: 12px;
    }
}

/* ========================================
   FIXED-ELEMENT OFFSET SYSTEM (Pitfall #81)
   Any new position:fixed; top:0 element site-wide MUST be added to these
   selector lists or the banner will cover it.
   ======================================== */
html.mld-has-app-banner {
    margin-top: var(--mld-app-banner-h) !important;
}
html.mld-has-app-banner body {
    margin-top: 0 !important;
}
/* Push down fixed/sticky headers when banner is active */
html.mld-has-app-banner header,
html.mld-has-app-banner .site-header,
html.mld-has-app-banner #masthead,
html.mld-has-app-banner .bne-header,
html.mld-has-app-banner .elementor-location-header,
html.mld-has-app-banner #bme-top-bar {
    top: var(--mld-app-banner-h) !important;
}
/* Full-height fixed nav drawers (theme .bne-drawer + plugin #mld-nav-drawer)
   are position:fixed;top:0 with a LOWER z-index than this banner, so the
   drawer header + close X would render underneath it and be untappable. */
html.mld-has-app-banner .bne-drawer,
html.mld-has-app-banner #mld-nav-drawer,
html.mld-has-app-banner #bme-login-prompt {
    top: var(--mld-app-banner-h) !important;
    height: calc(100% - var(--mld-app-banner-h)) !important;
}
/* Search-page filters modal: its overlay starts at top:0 (z10000, under the
   banner), so drop its content + fixed close X below the banner too. */
@media (max-width: 782px) {
    html.mld-has-app-banner #bme-filters-modal-content {
        padding-top: var(--mld-app-banner-h);
    }
    html.mld-has-app-banner #bme-filters-modal-close {
        top: calc(var(--mld-app-banner-h) + 12px + env(safe-area-inset-top, 0px)) !important;
    }
}
/* Mobile property template (single-property-mobile-v3): its floating nav
   toggle is position:fixed at top:16px over the gallery — drop it below the
   banner (v6.197.0, banner now renders on property pages). Do NOT add
   .mld-status-badge here: it sits inside a transformed gallery ancestor, so
   its "fixed" is container-relative and the html margin-top already shifts
   it — adding the offset again double-shifts it (verified v6.197.1). The
   bottom sheet opens to 85% on iPhone (top edge ~15% down the viewport), so
   it clears the banner on its own. */
html.mld-has-app-banner #mld-nav-toggle {
    top: calc(16px + var(--mld-app-banner-h)) !important;
}

/* ========================================
   DESKTOP FOOTER QR PROMO
   ======================================== */
.mld-app-footer-promo {
    display: none;
    position: relative;
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top: 1px solid #2a2a4a;
}
.mld-app-footer-promo.mld-footer-visible {
    display: block;
}
.mld-app-footer-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    padding: 8px;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    line-height: 1;
}
.mld-app-footer-close:hover {
    color: #fff;
}
.mld-app-footer-promo-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.mld-app-footer-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.mld-app-footer-qr img {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.mld-app-footer-qr-label {
    color: #a0a0b0;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.mld-app-footer-content {
    text-align: left;
}
.mld-app-footer-headline {
    color: #ffffff;
    font-size: 22px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0 0 8px 0;
}
.mld-app-footer-subtext {
    color: #a0a0b0;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0 0 15px 0;
    max-width: 350px;
}
.mld-app-footer-badge {
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.mld-app-footer-badge:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.mld-app-footer-badge img {
    height: 44px;
    width: auto;
}
@media (max-width: 600px) {
    .mld-app-footer-promo-inner {
        flex-direction: column;
        gap: 20px;
    }
    .mld-app-footer-content {
        text-align: center;
    }
    .mld-app-footer-subtext {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ========================================
   PROPERTY INLINE CARD
   ======================================== */
.mld-app-property-card {
    display: none;
    margin: 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
    border-radius: 16px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    box-shadow: 0 10px 25px -5px rgba(12, 74, 110, 0.4);
    overflow: hidden;
}
.mld-app-property-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}
.mld-app-property-card.mld-card-visible {
    display: block;
}
.mld-app-property-card-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 6px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    z-index: 2;
}
.mld-app-property-card-close:hover {
    background-color: rgba(255, 255, 255, 0.25);
    color: white;
}
.mld-app-property-card-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}
.mld-app-property-card-icon {
    flex-shrink: 0;
}
.mld-app-property-card-icon img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.mld-app-property-card-text {
    flex: 1;
    min-width: 0;
}
.mld-app-property-card-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0 0 6px 0;
}
.mld-app-property-card-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.5;
}
.mld-app-property-card-cta {
    flex-shrink: 0;
}
.mld-app-property-card-btn {
    display: inline-block;
    padding: 14px 28px;
    background: white;
    color: #0c4a6e;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    border: none;
}
.mld-app-property-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #0c4a6e;
}
/* Desktop variant: QR instead of Open App button */
.mld-app-property-card-qr {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.mld-app-property-card-qr img {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    background: white;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.mld-app-property-card-qr-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.mld-app-property-card.mld-card-desktop .mld-app-property-card-btn {
    display: none;
}
.mld-app-property-card.mld-card-desktop .mld-app-property-card-qr {
    display: flex;
}
@media (max-width: 480px) {
    .mld-app-property-card {
        padding: 20px;
        margin: 20px 0;
    }
    .mld-app-property-card-content {
        flex-wrap: wrap;
    }
    .mld-app-property-card-text {
        flex: 1 1 calc(100% - 76px);
    }
    .mld-app-property-card-title {
        font-size: 18px;
    }
    .mld-app-property-card-cta {
        flex: 1 1 100%;
        margin-top: 16px;
    }
    .mld-app-property-card-btn {
        display: block;
        text-align: center;
        width: 100%;
    }
}
