/* ==========================================================================
   Mobile "app view" (phones only, < 768px). Desktop is not affected.
   Loaded after custom.css.
   ========================================================================== */

/* Bottom tab bar is hidden everywhere except on phones */
.app-bottom-nav { display: none; }

@media (max-width: 767.98px) {
    :root {
        --app-green: #0BAA46;
        --app-green-dark: #08903A;
        --app-bg: #f4f6f3;
        --app-card: #ffffff;
        --app-ink: #1b1f23;
        --app-muted: #66707a;
        --app-line: #e6e9e4;
        --app-nav-h: 62px;
        --app-radius: 14px;
    }

    html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
    body {
        background: var(--app-bg);
        -webkit-tap-highlight-color: transparent;
        padding-bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
    }
    img { max-width: 100%; }
    a, button, .btn, .pointer { touch-action: manipulation; }

    /* ---------- Top app bar ---------- */
    header.search-nav {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: #fff;
        box-shadow: 0 1px 0 var(--app-line);
    }
    header.search-nav .navbar { padding: 6px 10px; min-height: 52px; }
    header.search-nav .company-logo img,
    header.search-nav .brand-logo-link { height: 38px; width: auto; max-width: 150px; object-fit: contain; }
    header.search-nav .btn { min-width: 40px; min-height: 40px; }

    /* Search */
    .searchcontainer { margin: 0; padding: 8px 12px 10px; background: #fff; }
    .searchcontainer .select2-container { width: 100% !important; }
    .searchcontainer .select2-selection,
    .searchcontainer .form-control {
        height: 42px !important;
        border-radius: 12px !important;
        border: 1px solid var(--app-line) !important;
        background: var(--app-bg) !important;
        display: flex;
        align-items: center;
        font-size: 15px;
    }
    .searchcontainer .select2-selection__rendered { line-height: 40px !important; color: var(--app-muted) !important; }

    /* ---------- Hero ---------- */
    .content-wrapper > div.mb-4 { margin-bottom: 14px !important; }
    .mySwiper {
        margin: 10px 12px 0;
        width: auto;
        border-radius: var(--app-radius);
        box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    }
    .mySwiper .swiper-pagination { bottom: 6px !important; }
    .mySwiper .swiper-pagination-bullet { background: #fff; opacity: .7; }
    .mySwiper .swiper-pagination-bullet-active { background: var(--app-green); opacity: 1; }

    /* ---------- Sections ---------- */
    main .container,
    main .container-fluid { padding-left: 14px; padding-right: 14px; }
    main h1, main h2, main .section-title, main .title {
        font-size: 17px !important;
        font-weight: 700;
        letter-spacing: .2px;
        color: var(--app-ink);
        margin-bottom: 6px;
    }
    .banner-paragraph { font-size: 13px; line-height: 1.5; color: var(--app-muted); margin-bottom: 8px; }
    main .btn-primary, main .view-more, main a.btn.btn-sm {
        border-radius: 999px;
        font-size: 13px;
        padding: 6px 14px;
        min-height: 34px;
    }

    /* ---------- Category tiles ---------- */
    .categories-card,
    .swiperForCategories .swiper-slide > div { border-radius: var(--app-radius); overflow: hidden; }
    .swiperForCategories .swiper-slide { padding-bottom: 4px; }
    .swiperForCategories .swiper-slide p,
    .swiperForCategories .swiper-slide h6,
    .swiperForCategories .swiper-slide .category-name { font-size: 13px; font-weight: 600; margin-top: 6px; }

    /* ---------- Product cards ---------- */
    .product-card,
    .card.product-card {
        background: var(--app-card);
        border: 0;
        border-radius: var(--app-radius);
        box-shadow: 0 1px 6px rgba(20, 30, 20, .08);
        height: auto !important;
        overflow: hidden;
    }
    .product-card .card-body { padding: 8px 10px 10px; }
    .product-card .card-title {
        font-size: 13px !important;
        font-weight: 600;
        line-height: 1.3;
        text-transform: none;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 34px;
        color: var(--app-ink);
    }
    .product-card .card-text { font-size: 11.5px; color: var(--app-muted); margin: 2px 0; }
    .product-card .card-price { font-size: 15px; font-weight: 700; color: var(--app-green-dark); }
    .product-card .btn,
    .product-card [class*="add-to-cart"] {
        border-radius: 10px;
        min-height: 36px;
        font-size: 13px;
        font-weight: 600;
    }
    .product-img-style3 { padding: 6px 6px 0; background: #fff; }
    .product-img-style3 img { border-radius: 10px; }
    .add-to-fav-btn {
        background: rgba(255, 255, 255, .92);
        border-radius: 50%;
        width: 32px; height: 32px;
        display: flex; align-items: center; justify-content: center;
        box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    }

    /* ---------- Forms & modals feel like sheets ---------- */
    .form-control, .form-select { min-height: 44px; border-radius: 10px; font-size: 16px; } /* 16px stops iOS zoom */
    .btn { border-radius: 10px; }
    .offcanvas-end { width: 100% !important; max-width: 100vw; z-index: 1060; }
    .offcanvas-backdrop { z-index: 1055; }
    .modal-content { border-radius: 18px 18px 0 0; }
    .modal-dialog { margin: 0; align-items: flex-end; min-height: 100%; }
    .swal2-container { padding-bottom: calc(var(--app-nav-h) + 10px); }

    /* ---------- Footer: slim ---------- */
    footer .container.pt-5 { padding-top: 12px !important; }
    footer .pb-5 { padding-bottom: 8px !important; }
    footer { font-size: 12.5px; }
    footer h5, footer h6 { font-size: 14px; margin-top: 10px; }

    /* ---------- Floating buttons sit above the tab bar ---------- */
    .whatsapp-icon,
    .buy-now-btn {
        bottom: calc(var(--app-nav-h) + 14px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .whatsapp-icon { width: 44px; height: 44px; }

    /* ---------- Bottom tab bar ---------- */
    .app-bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 1030;
        height: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #fff;
        border-top: 1px solid var(--app-line);
        box-shadow: 0 -4px 14px rgba(20, 30, 20, .06);
    }
    .app-tab {
        flex: 1;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--app-muted);
        font-size: 11px;
        font-weight: 600;
        text-decoration: none;
    }
    .app-tab svg {
        width: 23px; height: 23px;
        fill: none; stroke: currentColor; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round;
    }
    .app-tab.active { color: var(--app-green); }
    .app-tab.active svg { fill: rgba(11, 170, 70, .12); }
    .app-tab.active::before {
        content: "";
        position: absolute; top: 0; left: 30%; right: 30%;
        height: 3px; border-radius: 0 0 4px 4px;
        background: var(--app-green);
    }
    .app-tab:active { background: rgba(11, 170, 70, .06); }
    .app-badge {
        position: absolute;
        top: 6px; left: calc(50% + 6px);
        min-width: 17px; height: 17px; padding: 0 4px;
        border-radius: 9px;
        background: #e53935; color: #fff;
        font-size: 10px; line-height: 17px; text-align: center; font-weight: 700;
    }
    .app-badge:empty { display: none; }
}

@media (max-width: 767.98px) {
    /* Category row: small round-corner tiles, arrows hidden (swipe instead) */
    .swiperForCategories .swiper-button-next,
    .swiperForCategories .swiper-button-prev,
    .swiperForBrands .swiper-button-next,
    .swiperForBrands .swiper-button-prev,
    .swiper-arrow .swiper-button-next,
    .swiper-arrow .swiper-button-prev { display: none !important; }
    .swiperForCategories .swiper-slide { text-align: center; }
    .swiperForCategories .swiper-slide img { border-radius: 12px; }
    .swiperForCategories .swiper-slide > a > div:last-child,
    .swiperForCategories .swiper-slide p,
    .swiperForCategories .swiper-slide h3,
    .swiperForCategories .swiper-slide h4,
    .swiperForCategories .swiper-slide span { font-size: 12px !important; font-weight: 600; line-height: 1.25; text-transform: uppercase; margin-top: 6px; }
    main h4, main h3.section-title, main .section-title, main h1, main h2 { text-transform: none !important; }
    /* Section header: title left, small button right */
    main .btn.btn-primary { font-size: 12px; padding: 5px 12px; min-height: 30px; }
}

@media (max-width: 767.98px) {
    /* Section header: title + description on the left, button on the right (no wrapping) */
    main .d-flex.flex-wrap.justify-content-between.align-items-center.pb-3 {
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        gap: 10px;
        padding-bottom: 8px !important;
    }
    main .d-flex.flex-wrap.justify-content-between.align-items-center.pb-3 > :first-child { min-width: 0; flex: 1 1 auto; }
    main .d-flex.flex-wrap.justify-content-between.align-items-center.pb-3 > a,
    main .d-flex.flex-wrap.justify-content-between.align-items-center.pb-3 > div:last-child:not(:first-child) { flex: 0 0 auto; }
    main h1.section-title, main .section-title { text-transform: none !important; font-size: 17px !important; margin: 0 0 2px; }
    main .banner-paragraph { margin-bottom: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

    /* Category tiles */
    .categories-card { background: transparent; box-shadow: none; }
    .categories-image { padding: 0; }
    .categories-image img { width: 100%; height: auto; aspect-ratio: 1 / 1.05; object-fit: cover; border-radius: 12px; }
    .categories-card-text h4 { font-size: 11.5px !important; font-weight: 600; line-height: 1.25; margin: 6px 0 0; text-transform: uppercase; color: var(--app-ink); }

    /* Product cards: tighter */
    .product-card .card-title { min-height: 0; text-transform: none; font-size: 13px !important; margin: 4px 0 0; }
    .product-card .card-text { margin: 0 0 2px; }
    .product-card .rating-container { transform: scale(.8); transform-origin: left center; margin: -2px 0 0; height: 18px; }
    .product-card .card-body { padding: 6px 10px 10px; }
}

@media (max-width: 767.98px) {
    /* Category tile image: show the whole picture, no crop */
    .categories-card, .categories-image { height: auto !important; min-height: 0 !important; }
    .categories-image img { aspect-ratio: auto !important; height: auto !important; object-fit: contain !important; }
    /* "View More" as a compact pill */
    main .d-flex.flex-wrap.justify-content-between.align-items-center.pb-3 a.btn,
    main .d-flex.justify-content-between a.btn {
        padding: 5px 12px !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
        min-height: 30px !important;
        height: auto !important;
        width: auto !important;
        border-radius: 999px !important;
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    /* ---------- Product page ---------- */
    .mySwiper-preview, .mySwiper-preview .swiper-wrapper, .mySwiper-preview .swiper-slide { height: auto !important; }
    .mySwiper-preview .zoomWrapper { width: 100% !important; height: auto !important; }
    .mySwiper-preview img.zoom_03,
    .mySwiper-preview .swiper-slide img {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        max-height: 360px;
        object-fit: contain !important;
        margin: 0 auto;
        display: block;
    }
    .zoomContainer, .zoomWindowContainer, .zoomLens { display: none !important; }
    .Product-Detail-card { padding-bottom: 80px; }

    /* Sticky action bar above the tab bar */
    .product-add-section > .d-flex.gap-2 {
        position: fixed;
        left: 0; right: 0;
        bottom: calc(var(--app-nav-h) + env(safe-area-inset-bottom, 0px));
        z-index: 1025;
        background: #fff;
        padding: 8px 12px;
        gap: 8px !important;
        margin: 0 !important;
        box-shadow: 0 -4px 14px rgba(20, 30, 20, .08);
        border-top: 1px solid var(--app-line);
    }
    .product-add-section > .d-flex.gap-2 > a { flex: 1 1 0; display: block; margin: 0 !important; }
    .product-add-section > .d-flex.gap-2 > a.whatsapp-link,
    .product-add-section > .d-flex.gap-2 > a:last-child { flex: 0 0 48px; }
    .product-add-section > .d-flex.gap-2 .btn {
        width: 100%;
        min-height: 46px;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 700;
        padding: 0 8px;
    }
    .product-add-section > .d-flex.gap-2 .btn.whatsapp { font-size: 0; padding: 0; }
    .product-add-section > .d-flex.gap-2 .btn.whatsapp ion-icon { margin: 0 !important; font-size: 24px !important; }
}

@media (max-width: 767.98px) {
    /* Product page mobile gallery: whole product visible, natural proportions */
    .Product-Detail-card .mySwiper {
        margin: 0 0 8px;
        background: #fff;
        box-shadow: none;
        border-radius: var(--app-radius);
    }
    .Product-Detail-card .mySwiper,
    .Product-Detail-card .mySwiper .swiper-wrapper,
    .Product-Detail-card .mySwiper .swiper-slide { height: auto !important; }
    .Product-Detail-card .mySwiper .swiper-slide { display: flex; align-items: center; justify-content: center; padding: 10px 0 24px; }
    .Product-Detail-card .mySwiper img {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 380px;
        object-fit: contain !important;
        margin: 0 auto;
    }
}

@media (max-width: 767.98px) {
    html { overflow-x: hidden; }
    iframe, video, table, pre, .map-iframe { max-width: 100% !important; }
    iframe { width: 100% !important; }
    table { display: block; overflow-x: auto; }
}
