/**
 * Контент внутри iframe client_app_shell / Flutter WebView (hub, profile, orders…).
 * Убирает вложенный phone mockup, auto-scale и «мыло» от transform/backdrop на реальном экране.
 */
html.shell-content,
html.ibrand-app-webview,
html.shell-content body,
html.ibrand-app-webview body {
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html.shell-content body,
html.ibrand-app-webview body {
    display: block !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--color-page, #ffffff) !important;
}

html.shell-content .scale-wrapper,
html.shell-content [id$="-device-frame"],
html.shell-content .phone-shell,
html.shell-content .staff-device-frame,
html.shell-content .app-shell-scale-wrapper,
html.shell-content .guest-vitrina-scale-wrapper,
html.ibrand-app-webview .scale-wrapper,
html.ibrand-app-webview [id$="-device-frame"],
html.ibrand-app-webview .phone-shell,
html.ibrand-app-webview .staff-device-frame,
html.ibrand-app-webview .app-shell-scale-wrapper,
html.ibrand-app-webview .guest-vitrina-scale-wrapper {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    transform-origin: initial !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    ring: 0 !important;
    --tw-ring-shadow: 0 0 #0000 !important;
}

html.shell-content .shell-hide,
html.shell-content [class*="device-notch"],
html.shell-content .shell-notch,
html.ibrand-app-webview .shell-hide,
html.ibrand-app-webview [class*="device-notch"],
html.ibrand-app-webview .shell-notch {
    display: none !important;
}

@media (max-height: 1200px) {
    html.shell-content .scale-wrapper,
    html.shell-content [id$="-device-frame"],
    html.shell-content .app-shell-scale-wrapper,
    html.ibrand-app-webview .scale-wrapper,
    html.ibrand-app-webview [id$="-device-frame"],
    html.ibrand-app-webview .app-shell-scale-wrapper {
        transform: none !important;
    }
}

/* Локальные @media scale(0.7–0.9) в HTML-мокапах не должны срабатывать в APK */
@media (max-height: 1200px) {
    html.shell-content .scale-wrapper[class*="scale"],
    html.ibrand-app-webview .scale-wrapper[class*="scale"] {
        --tw-scale-x: 1 !important;
        --tw-scale-y: 1 !important;
    }
}

/* Чёткие фото на retina: без лишнего GPU-blur от transform на контейнерах картинок */
html.ibrand-app-webview img,
html.ibrand-app-webview video,
html.shell-content img,
html.shell-content video {
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html.ibrand-app-webview .partner-card img,
html.ibrand-app-webview .shop-card img,
html.ibrand-app-webview .hero-img,
html.ibrand-app-webview .product-card img,
html.ibrand-app-webview [class*="object-cover"] {
    transform: translateZ(0);
}

/* Лёгкая «глянцевость» карточек в нативном WebView — без тяжёлого blur по всему экрану */
html.ibrand-app-webview .partner-card,
html.ibrand-app-webview .shop-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow:
        0 10px 26px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}

html.ibrand-app-webview img.hub-partner-cover,
html.ibrand-app-webview .partner-card img,
html.ibrand-app-webview .shop-card img,
html.ibrand-app-webview .hero-img,
html.ibrand-app-webview .product-card img,
html.ibrand-app-webview [class*="object-cover"] {
    filter: saturate(1.08) contrast(1.04);
}

/* Shops hub freestanding brand mark: keep drop-shadow gloss (do not flatten filter). */
html.ibrand-app-webview .shop-card__mark img,
html.shell-content .shop-card__mark img {
    filter:
        drop-shadow(0 12px 20px rgba(15, 23, 42, 0.22))
        drop-shadow(0 2px 0 rgba(255, 255, 255, 0.7))
        saturate(1.06) contrast(1.03) !important;
}

html.ibrand-app-webview #food-hub-device-frame,
html.ibrand-app-webview #shops-hub-app-container,
html.ibrand-app-webview.shell-content #food-hub-device-frame,
html.ibrand-app-webview.shell-content body {
    background: #ffffff !important;
}

html.ibrand-app-webview .category-icon,
html.ibrand-app-webview .cat-icon {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%) !important;
    box-shadow:
        0 4px 14px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
}

html.ibrand-app-webview .glass-header,
html.ibrand-app-webview .hub-app-tabbar {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.ibrand-app-webview .guest-vitrina-topbar,
html.ibrand-app-webview .guest-vitrina-tabbar {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.ibrand-app-webview,
html.ibrand-app-webview body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif !important;
}

/* Клиентское приложение: корзина только в native tab / checkout, не в web-chrome хабов */
html.ibrand-app-webview #home-header-cart-link,
html.ibrand-app-webview #home-header-cart-picker,
html.ibrand-app-webview #shops-hub-cart-btn,
html.ibrand-app-webview #shops-hub-cart-picker,
html.ibrand-app-webview #food-hub-cart-btn,
html.ibrand-app-webview #food-hub-cart-picker,
html.ibrand-app-webview #svc-cart-btn,
html.ibrand-app-webview #goods-storefront-header-bag-btn,
html.shell-content #home-header-cart-link,
html.shell-content #home-header-cart-picker,
html.shell-content #shops-hub-cart-btn,
html.shell-content #shops-hub-cart-picker,
html.shell-content #food-hub-cart-btn,
html.shell-content #food-hub-cart-picker,
html.shell-content #svc-cart-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Гостевая витрина / iframe: корзины хабов и web-home chrome (даже если shell-content не успел). */
html.guest-vitrina-child-frame #home-header-cart-link,
html.guest-vitrina-child-frame #home-header-cart-picker,
html.guest-vitrina-child-frame #shops-hub-cart-btn,
html.guest-vitrina-child-frame #shops-hub-cart-picker,
html.guest-vitrina-child-frame #food-hub-cart-btn,
html.guest-vitrina-child-frame #food-hub-cart-picker,
html.guest-vitrina-child-frame #svc-cart-btn,
html.guest-vitrina-child-frame #goods-storefront-header-bag-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html.shell-content.ibrand-app-webview #pm-scroll-main,
html.shell-content.ibrand-app-webview .pm-scroll-main,
html.ibrand-app-webview.shell-content #pm-scroll-main,
html.ibrand-app-webview.shell-content .pm-scroll-main {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px) + 72px) !important;
}

html.ibrand-app-webview #pm-hosted-bind,
html.shell-content #pm-hosted-bind {
    pointer-events: auto !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(204, 85, 83, 0.25);
}

html.ibrand-app-webview .mockup-footer,
html.shell-content .mockup-footer {
    display: none !important;
    pointer-events: none !important;
}
