/* ================================================================
   M_AGROMART — Mobile-First CSS  (mobile.css)
   Loads AFTER main.css — all mobile-only overrides here
   ================================================================ */

/* ── Bengali font guarantee ──────────────────────────────────── */
html[lang="bn"],
html[lang="bn"] body,
html[lang="bn"] .mobile-bottom-item span,
html[lang="bn"] .mob-float-nav__item,
html[lang="bn"] .top-notif-bar,
html[lang="bn"] .mob-search-bar input {
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', 'Anek Bangla', sans-serif;
}

/* ── Desktop search bar — modern pill style ──────────────────── */
.search-bar form {
  display: flex;
  border-radius: 50px;
  overflow: hidden;
  border: 2px solid var(--primary);
  background: var(--bg-card);
  transition: box-shadow .2s, border-color .2s;
  box-shadow: 0 2px 8px rgba(11, 97, 64, .08);
}

.search-bar form:focus-within {
  box-shadow: 0 4px 20px rgba(11, 97, 64, .18);
  border-color: var(--primary-light, #13a06a);
}

.search-input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  border-radius: 0 !important;
  padding: 10px 16px !important;
  font-size: .92rem !important;
  flex: 1;
}

.search-btn {
  background: var(--primary) !important;
  border: none !important;
  color: #fff !important;
  padding: 0 22px !important;
  cursor: pointer;
  font-size: .95rem;
  transition: background .2s;
  border-radius: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
}

.search-btn:hover {
  background: var(--primary-dark, #0a5038) !important;
}

/* ================================================================
   MOBILE-ONLY — all rules below apply at ≤900px
   ================================================================ */

/* ── Hide desktop elements on mobile ─────────────────────────── */
@media (max-width: 900px) {
  .topbar {
    display: none !important;
  }

  .navbar {
    display: none !important;
  }

  /* Hide the desktop search bar in the main header */
  .header .search-bar {
    display: none !important;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  }

  /* Reduce body bottom padding — just enough for bottom nav */
  body {
    padding-bottom: 70px !important;
  }
}

/* ── Mobile Search Bar — below header ─────────────────── */
.mob-search-bar {
  display: none;
  /* hidden on desktop */
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  position: static;
}

.mob-search-bar form {
  display: flex;
  align-items: center;
  border-radius: 50px;
  overflow: hidden;
  border: 1.5px solid var(--primary);
  background: var(--bg-body);
  height: 42px;
}

.mob-scan-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  padding: 0 13px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
}

.mob-scan-btn:active {
  color: var(--primary);
}

.mob-search-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  padding: 0 12px !important;
  font-size: .92rem !important;
  height: 100%;
}

.mob-search-submit {
  background: var(--primary) !important;
  border: none !important;
  color: #fff !important;
  padding: 0 16px !important;
  cursor: pointer;
  font-size: .9rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 0 50px 50px 0 !important;
  transition: background .2s;
}

.mob-search-submit:hover {
  background: var(--primary-dark, #0a5038) !important;
}

@media (max-width: 900px) {
  .mob-search-bar {
    display: block;
  }
}

/* ================================================================
   BOTTOM NAVIGATION — Full width, Icons + Labels
   ================================================================ */
.mobile-bottom-bar {
  display: none;
}

@media (max-width: 900px) {
  .mobile-bottom-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 95;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, .08);
    padding: 0 0 max(0px, env(safe-area-inset-bottom));
    align-items: stretch;
    justify-content: stretch;
  }
}

/* Each nav item */
.mobile-bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color .18s, transform .15s;
  position: relative;
  gap: 4px;
  letter-spacing: .01em;
  border: none;
  background: transparent;
}

.mobile-bottom-item i,
.mobile-bottom-item svg {
  font-size: 1.5rem;
  width: 26px;
  height: 26px;
  line-height: 1;
  transition: transform .15s;
  color: var(--primary);
}

html[data-theme="dark"] .mobile-bottom-item i,
html[data-theme="dark"] .mobile-bottom-item svg {
  color: var(--primary);
}

.mobile-bottom-item span {
  font-size: .6rem;
  line-height: 1;
  white-space: nowrap;
}

.mobile-bottom-item:hover,
.mobile-bottom-item.active {
  color: var(--primary);
}

.mobile-bottom-item:hover i,
.mobile-bottom-item:hover svg {
  transform: translateY(-1px);
}

/* ── Center Home button — raised green circle ─────────────────── */
.mobile-bottom-item--home {
  flex: 0 0 70px;
}

.mobile-bottom-item--home i,
.mobile-bottom-item--home svg {
  background: var(--primary);
  color: #fff !important;
  border: 5px solid var(--bg-card);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  padding: 12px;
  font-size: 1.45rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -32px;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
  transition: all .25s ease;
}

.mobile-bottom-item--home:hover i,
.mobile-bottom-item--home:hover svg,
.mobile-bottom-item--home.active i,
.mobile-bottom-item--home.active svg {
  background: var(--primary-dark);
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.1);
}

/* Don't apply the general active color to home (icon handles it) */
.mobile-bottom-item--home {
  color: var(--text-muted);
}

.mobile-bottom-item--home.active {
  color: var(--primary);
}

/* Cart badge */
.mbb-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 22px);
  background: var(--secondary);
  color: #fff;
  font-size: .52rem;
  font-weight: 900;
  min-width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  font-style: normal;
  border: 1.5px solid var(--bg-card);
  line-height: 1;
}

/* ================================================================
   FLOATING QUICK NAV (mobile)
   ================================================================ */
.mob-float-nav {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 12px;
  z-index: 89;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.mob-float-nav__toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  border: none;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(253, 151, 42, .4);
  cursor: pointer;
  transition: transform .2s, background .2s;
}

.mob-float-nav__toggle:hover {
  transform: rotate(15deg) scale(1.08);
}

.mob-float-nav__items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .22s, transform .22s;
}

.mob-float-nav.is-open .mob-float-nav__items {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.mob-float-nav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 7px 14px 7px 10px;
  color: var(--text-main);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
  white-space: nowrap;
  transition: background .15s, transform .15s;
}

.mob-float-nav__item:hover {
  background: var(--bg-body);
  transform: translateX(-3px);
}

.mob-float-nav__item i {
  color: var(--primary);
  width: 16px;
  text-align: center;
}

@media (max-width: 900px) {
  .mob-float-nav {
    display: flex;
  }
}

/* ================================================================
   PRODUCT GRIDS — 2 column on mobile
   ================================================================ */
.product-grid-5col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .product-grid-5col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .product-grid-5col.limit-mobile>*:nth-child(n+7) {
    display: none !important;
  }

  .infinite-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
}

@media (max-width: 480px) {

  .product-grid-5col,
  .infinite-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
}

/* ================================================================
   GENERAL MOBILE POLISH
   ================================================================ */
@media (max-width: 900px) {
  .section {
    padding: 20px 0 !important;
  }

  .section-compact {
    padding: 16px 0 !important;
  }

  .section-head {
    margin-bottom: 14px !important;
  }

  .section-title {
    font-size: 1.25rem !important;
  }

  /* Chat/back-to-top position fixes for mobile */
  .floating-chat-container {
    bottom: 80px !important;
    right: 12px !important;
  }

  /* Prevent floating nav toggle overlap with chat */
  .mob-float-nav {
    bottom: 80px;
  }
}