/*
 * Standalone-PWA-only shell styling for the customer storefront.
 *
 * Every rule here is scoped under body.pwa-standalone (set only by
 * pwa-shell-mode.js, only when the page is actually running as an installed,
 * standalone PWA). A normal browser tab never gets that class, so none of this
 * is visible there. This file is linked ONLY from the two customer-storefront
 * layouts (resources/views/user-front/layout.blade.php and
 * .../seabbq-desifoodie-desices/layout.blade.php) — never from the main
 * marketing site, Partner Dashboard, or Partner PWA layouts.
 *
 * Deliberately distinct name/content from the existing public/assets/front/css/
 * yz-shell.css, which is the main Yumzip site's own header/nav/footer shell and
 * is unrelated to this file. Phase 3 Plan v5.1 §4/§9.
 */

/* Make room at the bottom of the page for the fixed nav, so it never overlaps
   content, and respect the device's safe area (notch/home-indicator). */
body.pwa-standalone {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/*
 * Priority 3 — lean app header (pwa-app-header.blade.php), standalone-PWA
 * only, same pattern as the bottom nav above. The full website header
 * (<header class="header-area">, every theme) is hidden only in standalone
 * mode; a normal browser tab is completely unaffected and keeps the
 * existing website header exactly as before.
 */
.pwa-app-header {
    display: none;
}

body.pwa-standalone header.header-area {
    display: none !important;
}

body.pwa-standalone .pwa-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    background: var(--pwa-shell-bg, #ffffff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.pwa-app-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.pwa-app-header__logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
}

.pwa-app-header__name {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-app-header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

@media (prefers-color-scheme: dark) {
    body.pwa-standalone .pwa-app-header {
        --pwa-shell-bg: #1c1c1e;
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
}

/*
 * Priority 4 — grocery theme homepage (resources/views/user-front/grocery/
 * index.blade.php). In standalone mode only: hide the old full-size website
 * hero and the marketing-site sections that have no place in a 5-tab app
 * home (About/intro copy, testimonials, blog/news), and show the new
 * compact pwa-app-home-hero instead. The "Popular Categories"
 * (.category-area), tabbed product browser (.product-area.product-5) and
 * "Best Deals" (.product-area.product-lg-5) sections are INTENTIONALLY left
 * visible — they already render this tenant's own real categories/products
 * (see categoryProductSection.blade.php, specialSection.blade.php), which
 * is exactly the "signature dishes / product cards / popular categories"
 * content the app home needs, so there is no reason to hide or duplicate
 * that query logic here.
 *
 * A normal browser visit to the website is completely unaffected — every
 * rule below is scoped under body.pwa-standalone.
 */
.pwa-app-home-hero {
    display: none;
}

body.pwa-standalone .hero-banner,
body.pwa-standalone .about-area,
body.pwa-standalone .testimonial-area,
body.pwa-standalone .blog-area {
    display: none !important;
}

body.pwa-standalone .pwa-app-home-hero {
    display: block;
    padding: 14px;
}

.pwa-app-home-hero__media {
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}

.pwa-app-home-hero__media img {
    width: 100%;
    display: block;
    object-fit: cover;
    max-height: 220px;
}

.pwa-app-home-hero__title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.pwa-app-home-hero__text {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 14px;
}

.pwa-app-home-hero__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pwa-app-home-hero__btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.pwa-app-home-hero__btn--primary {
    color: #ffffff;
}

.pwa-app-home-hero__btn--outline {
    background: transparent;
}

@media (prefers-color-scheme: dark) {
    .pwa-app-home-hero__text {
        color: #9ca3af;
    }
}

/* Pages that must never be covered by the bottom nav opt out entirely by
   adding this class to <body> alongside pwa-standalone (see
   resources/views/user-front/product/checkout.blade.php and
   resources/views/user-front/client/order_details.blade.php). */
body.pwa-standalone.pwa-no-bottom-nav {
    padding-bottom: 0;
}
body.pwa-standalone.pwa-no-bottom-nav .pwa-bottom-nav {
    display: none !important;
}

.pwa-bottom-nav {
    display: none; /* shown only once body.pwa-standalone is present, below */
}

body.pwa-standalone .pwa-bottom-nav {
    display: flex;
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    box-sizing: border-box;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
    background: #0b1020;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.28);
    /* thin accent line along the very bottom edge, as in the reference */
    border-bottom: 3px solid var(--yz-accent, #F04400);
}

body.pwa-standalone .pwa-bottom-nav__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px; /* touch target */
    padding: 7px 2px;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    font-size: 12px;
    line-height: 1.15;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease;
}

body.pwa-standalone .pwa-bottom-nav__item:active { background: rgba(255, 255, 255, 0.10); }

/* Active tab: bright accent rounded rectangle, white icon + label (same for all five tabs) */
body.pwa-standalone .pwa-bottom-nav__item.is-active {
    background: var(--yz-accent, #F04400);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

body.pwa-standalone .pwa-bottom-nav__icon {
    position: relative;
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
}

body.pwa-standalone .pwa-bottom-nav__icon svg { display: block; }
body.pwa-standalone .pwa-bottom-nav__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cart quantity badge + Offers "new" dot */
body.pwa-standalone .pwa-bottom-nav__badge {
    position: absolute;
    top: -7px;
    right: -11px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 9px;
    background: #fff;
    color: #b42318;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #0b1020;
}
body.pwa-standalone .pwa-bottom-nav__item.is-active .pwa-bottom-nav__badge { box-shadow: 0 0 0 2px var(--yz-accent, #F04400); }
body.pwa-standalone .pwa-bottom-nav__badge[hidden],
body.pwa-standalone .pwa-bottom-nav__dot[hidden] { display: none; }
body.pwa-standalone .pwa-bottom-nav__dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--yz-accent, #F04400);
    box-shadow: 0 0 0 2px #0b1020;
}

@media (max-width: 340px) {
    body.pwa-standalone .pwa-bottom-nav { padding-left: 4px; padding-right: 4px; gap: 2px; }
    body.pwa-standalone .pwa-bottom-nav__item { font-size: 11px; }
}

/* Installed app: the website footer (newsletter, links, copyright, contact, promo) is never shown.
   Scoped to installed mode only (html.yz-standalone is set before first paint by layout.blade.php,
   body.pwa-standalone by pwa-shell-mode.js); the ordinary browser website keeps its footer. */
html.yz-standalone body footer,
body.pwa-standalone footer {
    display: none !important;
}

/* Stage D item 4: public/assets/js/floating-whatsapp.js (#WAButton /
   .floating-wpp, bottom-left, see layout.blade.php) is a second
   always-floating widget with the same overlap problem as the live-chat
   widget. It is left completely untouched on a normal browser tab (where
   the bottom nav below does not exist and there is nothing to overlap);
   this only hides its floating presentation inside the installed,
   standalone PWA, where it would otherwise sit on top of the new 4-tab
   bottom nav. Its own backend/init script (layout.blade.php) and the
   WhatsApp number it opens are untouched — it is simply not shown here. */
body.pwa-standalone #WAButton,
body.pwa-standalone .floating-wpp {
    display: none !important;
}

/* ---- Installed-app header (every installed page): dark, branded, curved accent. Tenant accent comes from
   --yz-accent (restaurant base colour, set in layout.blade.php). ---- */
:root { --yz-app-bg: #0f1624; --yz-app-bg-2: #172036; }
/* ---- Header: dark branded, curved accent ---- */
body.pwa-standalone .pwa-app-header { background: linear-gradient(180deg, var(--yz-app-bg) 0%, var(--yz-app-bg-2) 100%); color: #fff; border: 0;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 34px; gap: 10px; position: sticky; top: 0; overflow: visible; }
body.pwa-standalone .pwa-app-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 26px; pointer-events: none;
    background:
        radial-gradient(120% 100% at 15% 100%, #fff 58%, transparent 59%),
        radial-gradient(120% 100% at 85% 100%, #fff 58%, transparent 59%);
    background-repeat: no-repeat; background-size: 51% 100%, 51% 100%; background-position: left bottom, right bottom; }
body.pwa-standalone .pwa-app-header::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; pointer-events: none;
    background: linear-gradient(100deg, transparent 20%, var(--yz-accent) 100%); opacity: .9; clip-path: ellipse(75% 100% at 60% 100%); }
body.pwa-standalone .pwa-app-header > * { position: relative; z-index: 1; }
body.pwa-standalone .pwa-app-header__logo { width: 48px; height: 48px; border-radius: 10px; background: #000; }
body.pwa-standalone .pwa-app-header__name { color: #fff; font-size: 17px; line-height: 1.15; white-space: normal; }
body.pwa-standalone .pwa-app-header__brand { padding-left: 2px; }
body.pwa-standalone .pwa-app-header__actions .btn-icon { background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.28); color: #fff; }
body.pwa-standalone .pwa-app-header__actions .btn-icon:active { background: rgba(255,255,255,.2); }
body.pwa-standalone .pwa-app-header__loc { color: #fff; }
body.pwa-standalone .pwa-app-header__loc .yz-loc-pin { color: var(--yz-accent); font-size: 20px; }
body.pwa-standalone .pwa-app-header__loc[data-serviceable="no"] .yz-loc-label,
body.pwa-standalone .pwa-app-header__loc[data-serviceable="unconfirmed"] .yz-loc-label { color: #ffb4a8; }
body.pwa-standalone .pwa-app-header__search { position: relative; }
body.pwa-standalone .pwa-app-header__search input { width: 100%; height: 48px; border: 0; border-radius: 14px; padding: 0 16px 0 44px; font-size: 16px; /* >=16px: no iOS/Android zoom */
    background: #fff; color: var(--yz-ink); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
body.pwa-standalone .yz-search-ico { position: absolute; left: 16px; top: 15px; color: #475467; z-index: 2; }


/* ==========================================================================================
   Reference restoration (Phase 2 fix): dark premium header + orange wave, nav polish.
   Standalone / app-shell only (body.pwa-standalone), so the ordinary website is untouched.
   ========================================================================================== */
body.pwa-standalone .pwa-app-header {
    --pwa-shell-bg: #0f1624;
    position: relative;               /* was sticky: the wave needs room and must not float over content */
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 34px;
    background: linear-gradient(180deg, #0f1624 0%, #111a2b 100%);
    border-bottom: 0;
    color: #fff;
    overflow: visible;
    margin-bottom: 0;
}
body.pwa-standalone .pwa-app-header::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 30px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 30' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23ff5a00'/%3E%3Cstop offset='1' stop-color='%23ff8a1f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 12C70 2 140 24 230 16S350 0 400 8V30H0z' fill='url(%23g)'/%3E%3Cpath d='M0 20C80 10 150 28 240 22S350 8 400 16V30H0z' fill='%23fff'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}
body.pwa-standalone .pwa-app-header a, body.pwa-standalone .pwa-app-header button { color: #fff; }
body.pwa-standalone .pwa-app-header__logo { width: 56px; height: 56px; border-radius: 10px; border: 1.5px solid var(--yz-accent, #F04400); background: #000; }
body.pwa-standalone .pwa-app-header__brand { gap: 12px; }
body.pwa-standalone .pwa-app-header__name { font-size: 20px; font-weight: 800; line-height: 1.15; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.25); }
body.pwa-standalone .pwa-app-header__actions .btn-icon { background: rgba(255,255,255,.04); border: 1.5px solid rgba(255,255,255,.22); color: #fff; width: 46px; height: 46px; min-width: 46px; }
body.pwa-standalone .pwa-app-header__actions .btn-icon:active { background: rgba(255,255,255,.14); }
body.pwa-standalone .pwa-app-header__loc { color: #fff; font-size: 18px; font-weight: 600; }
body.pwa-standalone .pwa-app-header__loc .yz-loc-pin { color: var(--yz-accent, #F04400); flex: 0 0 auto; }
body.pwa-standalone .pwa-app-header__loc .yz-loc-chev { flex: 0 0 auto; }
body.pwa-standalone .pwa-app-header__search input[type=search] { min-height: 52px; border-radius: 16px; border: 0; background: #fff; color: #101828; padding-left: 52px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
body.pwa-standalone .pwa-app-header__search .yz-search-ico { left: 18px; top: 15px; color: #344054; }
body.pwa-standalone .yz-suggest { top: 58px; }
body.pwa-standalone .yz-suggest a, body.pwa-standalone .yz-suggest button { color: #101828; }

/* Bottom navigation: dark rounded bar, orange gradient active tab, red Offers dot (reference close-up) */
body.pwa-standalone .pwa-bottom-nav { background: #14141c; border-radius: 30px 30px 0 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
body.pwa-standalone .pwa-bottom-nav__item { color: #eadfd2; font-size: 13px; font-weight: 600; border-radius: 22px; min-height: 60px; }
body.pwa-standalone .pwa-bottom-nav__item.is-active { color: #fff; background: linear-gradient(180deg, #ff6a14 0%, var(--yz-accent, #F04400) 100%); box-shadow: 0 6px 16px rgba(240,68,0,.35); }
body.pwa-standalone .pwa-bottom-nav__icon { width: 28px; height: 28px; }
body.pwa-standalone .pwa-bottom-nav__dot { background: #ef2b2b; top: -3px; right: -5px; box-shadow: 0 0 0 2px #14141c; }
body.pwa-standalone .pwa-bottom-nav__badge { box-shadow: 0 0 0 2px #14141c; }
