/* AfghanZone Public Mobile Premium Redesign v1.0.0
   VISUAL/PRESENTATION ONLY.
   Fresh-state additive layer for public/app/home.html.

   Goals:
   - more compact premium header/search
   - tighter product heading + sort/filter bar
   - cleaner two-column product cards with four equal actions
   - preserve successful three-column category layout
   - substantially shorter mobile footer
   - smaller safe-area-aware floating WhatsApp

   NO product, stock, seller, cart, order, WhatsApp routing, authentication,
   settings, API, MySQL, or desktop business logic is changed.
   Shared frontend: AZ + KZ + ZU. */

@media screen and (max-width: 760px) {
    body.az-home-v2.az-product-first-market {
        --az-pm-ink: #132238;
        --az-pm-muted: #7b8798;
        --az-pm-line: #e6eaf0;
        --az-pm-soft: #f6f8fb;
        --az-pm-orange: #f97316;
        --az-pm-green: #079669;
    }

    /* ========================================================
       HEADER / SEARCH
       Keep current working logo, customer avatar, language and menu DOM.
       Only tighten proportions.
       ======================================================== */
    body.az-home-v2 .market-header {
        border-bottom-color: #eceff3 !important;
        background: rgba(255, 255, 255, .97) !important;
        box-shadow: 0 5px 18px rgba(15, 23, 42, .045) !important;
        backdrop-filter: blur(18px) !important;
    }

    body.az-home-v2.az-home-mobile-language-docked .header-main,
    body.az-home-v2.az-customer-market-authenticated.az-home-mobile-language-docked .header-main {
        min-height: 0 !important;
        row-gap: 7px !important;
        column-gap: 7px !important;
        padding-top: 7px !important;
        padding-bottom: 8px !important;
    }

    body.az-home-v2 .market-brand {
        gap: 7px !important;
    }

    body.az-home-v2 .market-brand-logo {
        width: 38px !important;
        height: 38px !important;
        border-radius: 11px !important;
        box-shadow: 0 6px 14px rgba(249, 115, 22, .13) !important;
    }

    body.az-home-v2 .market-brand strong {
        font-size: 18px !important;
        line-height: 1.05 !important;
        letter-spacing: -.25px !important;
    }

    body.az-home-v2 .market-brand small {
        margin-top: 1px !important;
        font-size: 6.4px !important;
        letter-spacing: 1.15px !important;
    }

    body.az-home-v2 #open-language-menu.az-home-mobile-language-trigger {
        width: 39px !important;
        min-width: 39px !important;
        height: 39px !important;
        min-height: 39px !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 13px rgba(15, 23, 42, .075) !important;
    }

    body.az-home-v2 #open-language-menu.az-home-mobile-language-trigger > i {
        font-size: 14px !important;
    }

    body.az-home-v2.az-home-mobile-language-docked .mobile-menu-button {
        width: 43px !important;
        min-width: 43px !important;
        height: 43px !important;
        min-height: 43px !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 13px rgba(15, 23, 42, .075) !important;
    }

    body.az-home-v2 .az-customer-mobile-account {
        width: 39px !important;
        min-width: 39px !important;
        height: 39px !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 13px rgba(15, 23, 42, .075) !important;
    }

    body.az-home-v2 .az-customer-mobile-avatar {
        width: 31px !important;
        height: 31px !important;
        font-size: 12px !important;
    }

    body.az-home-v2.az-home-mobile-language-docked .header-search,
    body.az-home-v2.az-customer-market-authenticated.az-home-mobile-language-docked .header-search {
        height: 42px !important;
        min-height: 42px !important;
        border-width: 1.5px !important;
        border-radius: 12px !important;
        box-shadow: 0 0 0 2px rgba(249, 115, 22, .045) !important;
    }

    body.az-home-v2 .header-search input {
        min-height: 40px !important;
        padding-inline: 12px !important;
        font-size: 10px !important;
    }

    body.az-home-v2 .header-search button {
        min-width: 52px !important;
        width: 52px !important;
        padding: 0 !important;
        font-size: 0 !important;
    }

    body.az-home-v2 .header-search button i {
        margin: 0 !important;
        font-size: 15px !important;
    }

    /* ========================================================
       ALL PRODUCTS HEADING + TOOLBAR
       ======================================================== */
    body.az-product-first-market .all-products-section {
        padding: 9px 0 24px !important;
    }

    body.az-product-first-market .all-products-section .site-container {
        width: min(100% - 18px, 1540px) !important;
        padding-inline: 0 !important;
    }

    body.az-product-first-market .products-heading {
        min-height: 0 !important;
        margin-bottom: 8px !important;
        padding: 10px 11px !important;
        gap: 8px !important;
        border-color: #e7eaf0 !important;
        border-radius: 13px !important;
        box-shadow: 0 5px 16px rgba(15, 23, 42, .035) !important;
    }

    body.az-product-first-market .products-heading > div {
        min-width: 0 !important;
    }

    body.az-product-first-market .products-heading .section-kicker {
        margin-bottom: 2px !important;
        font-size: 6.5px !important;
        line-height: 1.1 !important;
    }

    body.az-product-first-market .products-heading h2 {
        margin: 1px 0 !important;
        font-size: 18px !important;
        line-height: 1.18 !important;
    }

    body.az-product-first-market .products-heading p {
        margin: 1px 0 0 !important;
        font-size: 7px !important;
        line-height: 1.3 !important;
    }

    body.az-product-first-market .filter-mobile-button {
        min-width: 78px !important;
        min-height: 34px !important;
        height: 34px !important;
        padding: 0 9px !important;
        gap: 5px !important;
        border-radius: 9px !important;
        font-size: 8px !important;
        white-space: nowrap !important;
    }

    body.az-product-first-market .products-toolbar {
        min-height: 38px !important;
        margin-bottom: 7px !important;
        padding: 5px 7px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
        border-color: #e7eaf0 !important;
        border-radius: 10px !important;
        background: #fff !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, .025) !important;
    }

    body.az-product-first-market .products-toolbar label {
        min-width: auto !important;
        flex: 0 0 auto !important;
        font-size: 7px !important;
        white-space: nowrap !important;
    }

    body.az-product-first-market .products-toolbar select {
        min-height: 28px !important;
        height: 28px !important;
        margin-inline-start: 3px !important;
        padding: 0 6px !important;
        border-radius: 7px !important;
        font-size: 7px !important;
    }

    body.az-product-first-market .active-filter-chips {
        min-width: 0 !important;
        flex: 1 1 auto !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        overflow-x: auto !important;
        scrollbar-width: none !important;
    }

    body.az-product-first-market .active-filter-chips::-webkit-scrollbar {
        display: none !important;
    }

    body.az-product-first-market .filter-chip {
        flex: 0 0 auto !important;
        gap: 3px !important;
        padding: 3px 6px !important;
        font-size: 6.5px !important;
    }

    /* ========================================================
       PRODUCT GRID + CARDS
       ======================================================== */
    body.az-product-first-market #all-product-grid,
    body.az-product-first-market .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 7px !important;
        align-items: stretch !important;
    }

    body.az-product-first-market .product-card {
        border-color: #e5e8ed !important;
        border-radius: 13px !important;
        background: #fff !important;
        box-shadow: 0 5px 15px rgba(15, 23, 42, .035) !important;
    }

    body.az-product-first-market .product-card:hover {
        transform: none !important;
        border-color: #fdba74 !important;
        box-shadow: 0 7px 18px rgba(249, 115, 22, .075) !important;
    }

    body.az-product-first-market .product-card-media {
        aspect-ratio: 1 / .72 !important;
        border-bottom: 1px solid #f0f2f5 !important;
        background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%) !important;
    }

    body.az-product-first-market .product-card-media > img {
        padding: 4px !important;
        object-fit: contain !important;
    }

    body.az-product-first-market .product-badges {
        inset: 5px 5px auto !important;
        gap: 3px !important;
    }

    body.az-product-first-market .product-badges .stock-badge,
    body.az-product-first-market .product-badges .feature-badge {
        min-height: 17px !important;
        height: 17px !important;
        padding: 0 5px !important;
        gap: 2px !important;
        border-radius: 999px !important;
        font-size: 5.8px !important;
        line-height: 1 !important;
    }

    body.az-product-first-market .product-badges i {
        font-size: 6px !important;
    }

    body.az-product-first-market .product-card-body {
        min-height: 0 !important;
        padding: 6px 6px 7px !important;
    }

    body.az-product-first-market .product-card-meta {
        display: flex !important;
        gap: 4px !important;
        font-size: 6.3px !important;
        line-height: 1.2 !important;
    }

    body.az-product-first-market .product-card h3 {
        min-height: 25px !important;
        margin: 3px 0 !important;
        font-size: 9px !important;
        line-height: 1.3 !important;
    }

    body.az-product-first-market .cmp-product-seller {
        min-height: 22px !important;
        gap: 4px !important;
        margin-bottom: 3px !important;
        padding: 2px 4px !important;
        border-radius: 7px !important;
        background: #f8fafc !important;
    }

    body.az-product-first-market .cmp-product-seller img,
    body.az-product-first-market .cmp-product-seller .cmp-seller-mark {
        width: 17px !important;
        height: 17px !important;
        min-width: 17px !important;
        border-radius: 5px !important;
    }

    body.az-product-first-market .cmp-product-seller b {
        font-size: 6.8px !important;
        line-height: 1.2 !important;
    }

    body.az-product-first-market .cmp-product-seller small {
        font-size: 5.7px !important;
        line-height: 1.15 !important;
    }

    body.az-product-first-market .product-rating {
        min-height: 11px !important;
        margin: 0 !important;
        font-size: 6px !important;
        line-height: 1.1 !important;
    }

    body.az-product-first-market .product-rating small {
        font-size: 5.8px !important;
    }

    body.az-product-first-market .product-commerce-line {
        display: none !important;
    }

    body.az-product-first-market .product-price-row {
        min-height: 30px !important;
        gap: 4px !important;
        margin-top: 2px !important;
        padding-top: 4px !important;
    }

    body.az-product-first-market .product-price strong {
        font-size: 13px !important;
        line-height: 1.05 !important;
        letter-spacing: -.1px !important;
    }

    body.az-product-first-market .product-price small,
    body.az-product-first-market .moq-badge {
        font-size: 5.8px !important;
        line-height: 1.15 !important;
    }

    body.az-product-first-market .moq-badge {
        max-width: 48% !important;
        padding: 3px 4px !important;
        border-radius: 5px !important;
    }

    /* Existing four business actions stay exactly the same actions;
       only dimensions / presentation become cleaner. */
    body.az-product-first-market .product-card-actions {
        grid-template-columns: repeat(4, 28px) !important;
        grid-template-rows: 28px !important;
        justify-content: space-between !important;
        gap: 3px !important;
        margin-top: 4px !important;
    }

    body.az-product-first-market .product-card-actions .public-order-button,
    body.az-product-first-market .product-card-actions .whatsapp-button,
    body.az-product-first-market .product-card-actions .cart-button,
    body.az-product-first-market .product-card-actions .az-chat-button {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
    }

    body.az-product-first-market .product-card-actions .public-order-button i,
    body.az-product-first-market .product-card-actions .whatsapp-button i,
    body.az-product-first-market .product-card-actions .cart-button i,
    body.az-product-first-market .product-card-actions .az-chat-button i {
        font-size: 11px !important;
    }

    /* ========================================================
       CATEGORY FINAL POLISH
       Preserve successful 3-column compact structure.
       ======================================================== */
    body.az-home-v2 .category-section {
        padding-top: 13px !important;
        padding-bottom: 16px !important;
    }

    body.az-home-v2 #category-card-grid.category-card-grid {
        gap: 6px !important;
    }

    body.az-home-v2 #category-card-grid .category-card {
        min-height: 64px !important;
        padding: 5px 4px !important;
        gap: 4px !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(15, 23, 42, .025) !important;
    }

    body.az-home-v2 #category-card-grid .category-icon {
        width: 27px !important;
        height: 27px !important;
        flex-basis: 27px !important;
        border-radius: 8px !important;
        font-size: 10px !important;
    }

    body.az-home-v2 #category-card-grid .category-card b {
        font-size: 7.4px !important;
    }

    body.az-home-v2 #category-card-grid .category-card small {
        font-size: 5.6px !important;
    }

    /* ========================================================
       FILTER SHEET
       Keep all current filter controls / logic; just compact sheet.
       ======================================================== */
    body.az-product-first-market .filter-sidebar {
        max-height: 78vh !important;
        padding: 13px !important;
        border-radius: 20px 20px 0 0 !important;
    }

    body.az-product-first-market .filter-head {
        padding-bottom: 8px !important;
    }

    body.az-product-first-market .filter-head h3 {
        font-size: 12px !important;
    }

    body.az-product-first-market .filter-field {
        margin-top: 10px !important;
    }

    body.az-product-first-market .filter-field > span {
        margin-bottom: 4px !important;
        font-size: 8px !important;
    }

    body.az-product-first-market .filter-field select,
    body.az-product-first-market .filter-field input {
        height: 36px !important;
        border-radius: 9px !important;
        font-size: 8px !important;
    }

    body.az-product-first-market .check-filter {
        margin-top: 10px !important;
        font-size: 8px !important;
    }

    body.az-product-first-market .apply-filter-button {
        min-height: 38px !important;
        margin-top: 12px !important;
        border-radius: 10px !important;
        font-size: 9px !important;
    }

    /* ========================================================
       FOOTER
       Same content / dynamic Settings; radically less mobile height.
       ======================================================== */
    body.az-home-v2 .market-footer {
        padding-top: 20px !important;
        background: #162235 !important;
    }

    body.az-home-v2 .market-footer .site-container {
        width: min(100% - 22px, 1440px) !important;
    }

    body.az-home-v2 .footer-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px 10px !important;
        padding-bottom: 16px !important;
    }

    body.az-home-v2 .footer-brand-column {
        grid-column: 1 / -1 !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        align-items: center !important;
        gap: 7px 10px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid rgba(255,255,255,.07) !important;
    }

    body.az-home-v2 .footer-brand-column .footer-brand {
        grid-column: 1 !important;
        min-width: 0 !important;
        justify-self: start !important;
    }

    body.az-home-v2 .footer-brand-column .market-brand-logo {
        width: 35px !important;
        height: 35px !important;
        border-radius: 10px !important;
    }

    body.az-home-v2 .footer-brand-column .market-brand strong {
        font-size: 16px !important;
    }

    body.az-home-v2 .footer-brand-column .market-brand small {
        font-size: 5.8px !important;
    }

    body.az-home-v2 .footer-brand-column > p {
        grid-column: 1 / -1 !important;
        max-width: 100% !important;
        margin: 0 !important;
        font-size: 7px !important;
        line-height: 1.55 !important;
        display: -webkit-box !important;
        overflow: hidden !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }

    body.az-home-v2 .footer-whatsapp {
        grid-column: 2 !important;
        grid-row: 1 !important;
        min-height: 34px !important;
        padding: 0 9px !important;
        gap: 5px !important;
        border-radius: 9px !important;
        font-size: 7px !important;
        white-space: nowrap !important;
    }

    body.az-home-v2 .footer-grid > div:not(:first-child) {
        min-width: 0 !important;
        padding: 0 !important;
    }

    body.az-home-v2 .footer-grid > div:last-child {
        grid-column: 1 / -1 !important;
        padding-top: 7px !important;
        border-top: 1px solid rgba(255,255,255,.06) !important;
    }

    body.az-home-v2 .footer-grid h3 {
        margin: 0 0 7px !important;
        font-size: 9px !important;
        line-height: 1.2 !important;
    }

    body.az-home-v2 .footer-grid > div:not(:first-child) a,
    body.az-home-v2 .footer-grid > div:not(:first-child) p,
    body.az-home-v2 .footer-grid .link-button {
        margin: 0 0 5px !important;
        font-size: 7px !important;
        line-height: 1.45 !important;
    }

    body.az-home-v2 .footer-grid > div:last-child p {
        overflow-wrap: anywhere !important;
    }

    body.az-home-v2 .footer-bottom {
        min-height: 44px !important;
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom)) !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 3px !important;
        font-size: 6.3px !important;
        line-height: 1.35 !important;
    }

    /* ========================================================
       FLOATING WHATSAPP
       ======================================================== */
    body.az-home-v2 .floating-whatsapp {
        left: 11px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        box-shadow: 0 8px 20px rgba(22, 163, 74, .24) !important;
    }

    body.az-home-v2 .floating-whatsapp i {
        font-size: 18px !important;
    }

    body.az-home-v2 .floating-whatsapp span {
        display: none !important;
    }
}

@media screen and (max-width: 390px) {
    body.az-home-v2 .market-brand strong {
        font-size: 16.5px !important;
    }

    body.az-home-v2 .market-brand small {
        font-size: 5.8px !important;
    }

    body.az-product-first-market .products-heading h2 {
        font-size: 16.5px !important;
    }

    body.az-product-first-market .filter-mobile-button {
        min-width: 70px !important;
        padding-inline: 7px !important;
        font-size: 7.3px !important;
    }

    body.az-product-first-market #all-product-grid,
    body.az-product-first-market .related-grid {
        gap: 5px !important;
    }

    body.az-product-first-market .product-card-body {
        padding: 5px 5px 6px !important;
    }

    body.az-product-first-market .product-card h3 {
        font-size: 8.3px !important;
    }

    body.az-product-first-market .product-price strong {
        font-size: 12px !important;
    }

    body.az-product-first-market .product-card-actions {
        grid-template-columns: repeat(4, 27px) !important;
        grid-template-rows: 27px !important;
    }

    body.az-product-first-market .product-card-actions .public-order-button,
    body.az-product-first-market .product-card-actions .whatsapp-button,
    body.az-product-first-market .product-card-actions .cart-button,
    body.az-product-first-market .product-card-actions .az-chat-button {
        width: 27px !important;
        min-width: 27px !important;
        max-width: 27px !important;
        height: 27px !important;
        min-height: 27px !important;
        max-height: 27px !important;
    }

    body.az-home-v2 .footer-grid {
        gap: 10px 8px !important;
    }
}
