/* ==========================================================================
   AG INTERNATIONAL — NATIVE-STYLE MOBILE UI ARCHITECTURE (<= 860px)
   Primary Navy: #092449 | Electric Blue: #1264DE | Accent Yellow: #FFB51B
   Background: #FFFFFF | Secondary: #F4F7FC | Fonts: Inter & Manrope
   ========================================================================== */

/* Mobile-only elements hidden on desktop */
.mob-header-shell,
.mob-drawer-backdrop,
.mob-drawer,
.mob-pdp-sticky,
.mob-filter-bar {
  display: none;
}

@media (max-width: 860px) {
  html, body {
    max-width: 100%;
    overflow-x: hidden;
    background: #FFFFFF;
    font-size: 14px;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding: 0 14px;
  }

  /* Hide desktop 3-level header cleanly on mobile */
  .utility-bar,
  .main-header,
  .nav-bar {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     1. COMPACT TWO-ROW MOBILE HEADER (Sticky, Row1 ~58px, Row2 Search 44px)
     ------------------------------------------------------------------------ */
  .mob-header-shell {
    display: block;
    position: sticky;
    top: 0;
    z-index: 140;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    box-shadow: 0 2px 10px rgba(9, 36, 73, 0.05);
  }

  .mob-header-top {
    height: 58px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .mob-icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: #092449;
    border-radius: 8px;
    display: grid;
    place-items: center;
    cursor: pointer;
  }
  .mob-icon-btn:active { background: #F4F7FC; }

  .mob-badge {
    position: absolute;
    top: 5px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #FFB51B;
    color: #092449;
    font-size: 0.66rem;
    font-weight: 800;
    display: grid;
    place-items: center;
  }

  .mob-logo-center {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .mob-logo-center .ag-logo-badge {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
    border-radius: 7px;
  }
  .mob-logo-center .ag-logo-text strong { font-size: 0.96rem; color: #092449; }
  .mob-logo-center .ag-logo-text span { font-size: 0.6rem; color: #1264DE; }

  .mob-header-right {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .mob-search-row {
    padding: 0 12px 10px;
    position: relative;
  }

  .mob-search-box {
    height: 44px;
    display: flex;
    align-items: center;
    background: #F4F7FC;
    border: 1px solid #CBD5E1;
    border-radius: 9px;
    overflow: hidden;
  }
  .mob-search-box:focus-within {
    border-color: #1264DE;
    background: #FFFFFF;
  }
  .mob-search-icon {
    padding: 0 8px 0 12px;
    color: #64748B;
    display: flex;
    align-items: center;
  }
  .mob-search-box input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: #0F172A;
    outline: none;
  }
  .mob-search-box button {
    height: 36px;
    margin-right: 4px;
    padding: 0 14px;
    border: none;
    border-radius: 7px;
    background: #FFB51B;
    color: #092449;
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    flex-shrink: 0;
  }

  /* Search Suggestions Dropdown */
  .mob-search-suggest {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 46px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(9, 36, 73, 0.16);
    z-index: 220;
    max-height: 290px;
    overflow-y: auto;
    display: none;
  }
  .mob-search-suggest.open { display: block; }
  .mob-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 0.82rem;
  }
  .mob-suggest-item img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border: 1px solid #E2E8F0;
    border-radius: 5px;
    background: #fff;
  }

  /* ------------------------------------------------------------------------
     2. MOBILE SLIDE-OUT NAVIGATION DRAWER (14 Functional Items)
     ------------------------------------------------------------------------ */
  .mob-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 36, 73, 0.55);
    z-index: 250;
  }
  .mob-drawer-backdrop.open { display: block; }

  .mob-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 310px);
    background: #FFFFFF;
    z-index: 260;
    display: flex;
    flex-direction: column;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 10px 0 32px rgba(9, 36, 73, 0.24);
  }
  .mob-drawer.open { transform: translateX(0); }

  .mob-drawer-hdr {
    background: #092449;
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .mob-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 24px;
  }
  .mob-drawer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #092449;
    border-bottom: 1px solid #F1F5F9;
  }
  .mob-drawer-link:active { background: #EBF3FE; color: #1264DE; }
  .mob-drawer-utility {
    margin-top: 14px;
    background: #F4F7FC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.8rem;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  /* ------------------------------------------------------------------------
     3. COMPACT MOBILE HERO BANNER (Uncropped 3:1 Artwork, Zero Clipping/Overlap)
     ------------------------------------------------------------------------ */
  .hero-slider {
    margin: 10px 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    background: #092449;
  }
  .hero-slide {
    width: 100%;
    min-height: 0;
    max-height: none;
  }
  .hero-picture-full,
  .hero-picture-full img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 1;
    object-fit: contain;
    display: block;
  }
  .slider-arrow { display: none; }
  .slider-dots { bottom: 6px; gap: 5px; }
  .slider-dot { width: 14px; height: 3px; }
  .slider-dot.active { width: 24px; }

  /* ------------------------------------------------------------------------
     4. VERIFIED TRUST INDICATORS (Compact 4-Col or 2x2 Strip)
     ------------------------------------------------------------------------ */
  .trust-strip {
    padding: 12px 0;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
  }
  .trust-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .trust-item {
    flex-direction: column;
    text-align: center;
    padding: 10px 6px;
    gap: 6px;
    background: #F4F7FC;
    border-radius: 8px;
  }
  .trust-icon { width: 32px; height: 32px; font-size: 0.95rem; }
  .trust-item strong { font-size: 0.68rem; line-height: 1.15; }
  .trust-item span { display: none; }

  /* ------------------------------------------------------------------------
     5. SECTIONS, TYPOGRAPHY & 4-COLUMN COMPACT CATEGORY GRID
     ------------------------------------------------------------------------ */
  .section { padding: 24px 0; }
  .section-header { margin-bottom: 14px; gap: 8px; align-items: center; }
  .section-eyebrow { font-size: 0.66rem; margin-bottom: 2px; }
  .section-title { font-size: 1.15rem; line-height: 1.25; }
  .section-lead { font-size: 0.8rem; margin-top: 4px; }
  .section-header .btn { min-height: 36px; padding: 6px 12px; font-size: 0.76rem; }

  .cat-grid-8 {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .cat-card {
    border-radius: 9px;
    background: #F4F7FC;
  }
  .cat-card-img {
    aspect-ratio: 1 / 1;
    padding: 8px;
    background: #FFFFFF;
  }
  .cat-card-body {
    padding: 7px 5px;
    text-align: center;
  }
  .cat-card-body h3 { font-size: 0.68rem; line-height: 1.2; margin-bottom: 0; }
  .cat-card-body p, .cat-card-link { display: none; }

  /* ------------------------------------------------------------------------
     6. TWO-COLUMN NATIVE B2B PRODUCT GRID (object-fit: contain, 44px targets)
     ------------------------------------------------------------------------ */
  .product-grid,
  .product-grid.list-view {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .product-grid.list-view .product-card { flex-direction: column; }
  .product-grid.list-view .product-thumb { width: 100%; border-right: none; border-bottom: 1px solid #E2E8F0; }

  .product-card { border-radius: 10px; }
  .product-thumb { aspect-ratio: 1 / 1; padding: 8px; background: #FFFFFF; }
  .product-thumb img { object-fit: contain; }
  .product-cat-tag { top: 6px; left: 6px; font-size: 0.6rem; padding: 2px 6px; }

  .product-body { padding: 10px; }
  .product-sku { font-size: 0.64rem; margin-bottom: 2px; }
  .product-title {
    font-size: 0.8rem;
    line-height: 1.25;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-spec {
    font-size: 0.68rem;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-price-row { padding-top: 7px; margin-bottom: 8px; flex-wrap: wrap; gap: 2px; }
  .price-dealer { font-size: 0.94rem; }
  .price-mrp { font-size: 0.66rem; }
  .pack-info { font-size: 0.64rem; }

  .product-body .btn {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  /* ------------------------------------------------------------------------
     7. MODULAR PROMO, CORPORATE SECTIONS & FOOTER ON MOBILE
     ------------------------------------------------------------------------ */
  .promo-banner,
  .split-2,
  .pdp-grid,
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .promo-copy { padding: 20px 18px; }
  .promo-copy h2 { font-size: 1.2rem; }
  .promo-copy p { font-size: 0.82rem; margin-bottom: 14px; }
  .promo-visual { padding: 10px; gap: 8px; }
  .promo-visual img { height: 95px; }

  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .corp-card img { height: 130px; }
  .corp-card-body, .app-area-card { padding: 12px; }
  .corp-card-body h3, .app-area-card h3 { font-size: 0.84rem; }
  .corp-card-body p, .app-area-card p { font-size: 0.74rem; }

  .form-grid, .footer-grid { grid-template-columns: 1fr; gap: 12px; }
  .site-footer { padding: 30px 0 24px; margin-top: 16px; }

  /* Product Listing Filter Bottom Sheet Support */
  .filter-sidebar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 82vh;
    overflow-y: auto;
    z-index: 270;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 32px rgba(9, 36, 73, 0.25);
  }
  .filter-sidebar.sheet-open { display: block; }
  .mob-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
  }

  /* PDP Sticky Action Bar */
  .mob-pdp-sticky {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    padding: 8px 12px;
    gap: 8px;
    z-index: 145;
    box-shadow: 0 -4px 14px rgba(9, 36, 73, 0.08);
  }
  .mob-pdp-sticky .btn { flex: 1; min-height: 44px; font-size: 0.82rem; }
  body.has-pdp-sticky { padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)) !important; }

  /* ------------------------------------------------------------------------
     8. FIXED FIVE-TAB MOBILE BOTTOM NAVIGATION (64px + Safe Area)
     ------------------------------------------------------------------------ */
  .mobile-bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    z-index: 150;
  }
  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    position: relative;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
  }
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav button.active {
    color: #1264DE;
  }
  .mobile-bottom-nav svg { width: 20px; height: 20px; }
  .mob-nav-badge {
    position: absolute;
    top: 5px;
    right: 18%;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #FFB51B;
    color: #092449;
    font-size: 0.62rem;
    font-weight: 800;
    display: grid;
    place-items: center;
  }
  body.has-mobile-nav { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  body.modal-open .mobile-bottom-nav,
  body.modal-open .mob-pdp-sticky { display: none !important; }

  /* Retailer Portal Bottom Nav safe area */
  .app-bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .app-main { padding: 12px 12px calc(86px + env(safe-area-inset-bottom, 0px)); }
}

/* Narrow 320px-359px safeguard: switch 4-col trust/cat slightly tighter or 2-col where needed */
@media (max-width: 350px) {
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid-8 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
