/* =============================================
   MOBILE / TABLET FIXES ONLY
   Desktop styles are intentionally untouched.
   Loaded after page CSS so these overrides win.
   ============================================= */

/* Hide mobile-only controls on desktop */
.mobile-filter-btn { display: none; }
.mobile-menu-btn { display: none; }

.auth-page-body .whatsapp-float {
  display: none !important;
}

/* ---------- Tablet & below (≤1024px) ---------- */
@media (max-width: 1024px) {
  .mega-menu { min-width: 480px; }
}

/* ---------- Mobile / small tablet (≤768px) ---------- */
@media (max-width: 768px) {
  /* Prevent accidental horizontal scroll from fixed-width children */
  body { overflow-x: hidden; }
  img, video, iframe, svg { max-width: 100%; height: auto; }

  /* Announcement */
  .announcement-bar {
    font-size: 0.72rem;
    padding: 8px 12px;
    line-height: 1.4;
    letter-spacing: 0;
  }

  /* Header: logo + actions on row 1, search on row 2 */
  .header {
    height: auto;
    min-height: var(--header-height);
  }
  .header .container {
    padding-top: 6px;
    padding-bottom: 8px;
  }
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    gap: 10px 12px;
    align-items: center;
  }
  .site-logo { height: 44px; }
  .search-bar {
    display: flex !important;
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    width: 100%;
  }
  .search-bar input { font-size: 0.84rem; padding: 9px 14px; }
  .search-bar button { padding: 9px 14px; }
  .header-actions { gap: 2px; }
  .header-btn { padding: 4px 8px; min-width: 44px; }
  .header-btn .icon { font-size: 1.15rem; }
  .mobile-menu-btn { display: flex !important; }

  /* Mobile nav drawer (desktop mega menus stay as-is above 768) */
  .nav-menu {
    display: none;
    border-bottom: 1px solid var(--border);
    max-height: min(75vh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-md);
  }
  .nav-menu.mobile-open {
    display: block !important;
  }
  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-link {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    white-space: normal;
    justify-content: space-between;
  }
  .nav-link:hover,
  .nav-item:hover .nav-link {
    border-bottom-color: var(--border);
  }
  .mega-menu,
  .mega-simple {
    position: static;
    display: none !important;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    border-radius: 0;
    border-top: none;
    padding: 8px 12px 14px 20px;
    background: var(--bg);
  }
  .nav-item:hover .mega-menu,
  .nav-item:hover .mega-simple {
    display: none !important;
  }
  .nav-item.submenu-open > .mega-menu {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .nav-item.submenu-open > .mega-simple {
    display: block !important;
  }
  .mega-col h4 { margin-top: 4px; }
  .mega-col ul li a,
  .mega-simple a {
    padding: 10px 8px;
  }

  /* Breadcrumbs */
  .breadcrumb {
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 0.78rem;
  }

  /* Page banner — compact so products appear sooner */
  .page-banner { padding: 18px 0 !important; }
  .page-banner h1 { font-size: 1.35rem; margin-bottom: 6px; }
  .page-banner p { font-size: 0.82rem; margin-bottom: 8px; }
  .page-banner .breadcrumb { margin-top: 4px; }

  /* Product cards in grids */
  .product-card .card-body { padding: 10px; }
  .product-card .product-name { font-size: 0.82rem; }
  .product-card .price { font-size: 0.92rem; }
  .product-card .add-btn { font-size: 0.78rem; padding: 8px; }
  .product-card .card-weight-options {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  }

  /* Horizontal product rows: slightly narrower cards */
  .products-row .product-card { width: 168px; }

  /* Footer */
  .footer { padding-top: 40px; }
  .footer-grid {
    align-items: start;
    gap: 28px;
  }
  .footer-brand,
  .footer-col {
    width: 100%;
    min-width: 0;
  }
  .footer-logo {
    margin-left: 0;
  }
  .social-links {
    align-items: center;
  }
  .newsletter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .newsletter-form input,
  .newsletter-form button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 46px;
    border-radius: var(--radius-full);
  }
  .newsletter-form button {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }
  .payment-icons {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* WhatsApp float — keep clear of thumb zone / home indicator */
  .whatsapp-float {
    bottom: 18px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }

  /* Promo sidebar already hidden; ensure popup fits */
  .popup-box {
    width: min(92vw, 480px);
    max-height: 90vh;
    overflow-y: auto;
  }
  .popup-top { padding: 28px 20px; }
  .popup-top h2 { font-size: 2rem; }
  .popup-bottom { padding: 20px 18px; }
  .popup-code { font-size: 1.15rem; letter-spacing: 2px; }

  /* ---- Home: hero ---- */
  .hero-slide {
    height: auto;
    min-height: 380px;
  }
  .hero-slide-content {
    padding: 28px 16px 56px;
    justify-content: flex-end;
    background: linear-gradient(
      180deg,
      rgba(42, 34, 38, 0.12) 0%,
      rgba(210, 179, 99, 0.35) 45%,
      rgba(42, 34, 38, 0.78) 100%
    );
  }
  .hero-slide-content h1 {
    font-size: 1.45rem;
    margin-bottom: 8px;
    max-width: 100%;
  }
  .hero-slide-content p {
    font-size: 0.88rem;
    margin-bottom: 14px;
    max-width: 100%;
  }
  .hero-slide-content .hero-btns {
    gap: 8px;
    margin-bottom: 4px;
  }
  .hero-slide-content .btn {
    padding: 10px 16px;
    font-size: 0.8rem;
  }
  .slider-controls {
    bottom: 14px;
  }
  .slider-prev,
  .slider-next {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }
  .slider-prev { left: 10px; }
  .slider-next { right: 10px; }
  /* Arrows crowd the copy on phones — keep swipe/dots only */
  .slider-prev,
  .slider-next { display: none; }

  /* Category icons */
  .cat-icons-row { padding: 16px 0; }
  .cat-icon-item {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 8px 4px;
  }
  .cat-icon-item span {
    font-size: 0.68rem;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
  }

  /* Featured category blocks */
  .featured-cat-block {
    border-radius: var(--radius-md);
  }
  .fcat-banner { min-height: 180px; }
  .fcat-banner-content { padding: 20px; }
  .fcat-banner-content h3 { font-size: 1.25rem; }
  .fcat-links { padding: 16px; }
  .fcat-link-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Offer strip */
  .offer-strip-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .offer-strip h3 { font-size: 1.1rem; }

  /* Custom order CTA */
  .custom-order-cta {
    padding: 28px 18px !important;
    border-radius: var(--radius-md);
    gap: 24px !important;
  }
  .custom-order-cta .cta-text .cta-btns {
    flex-direction: column;
    align-items: stretch;
  }
  .custom-order-cta .cta-text .cta-btns .btn {
    width: 100%;
    justify-content: center;
  }
  .cta-cards {
    grid-template-columns: 1fr 1fr;
  }

  /* Why / insta */
  .why-item { padding: 16px 8px; }
  .insta-grid { gap: 6px; }

  /* Testimonials: avoid 340px min-width overflow */
  .testi-card {
    min-width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    padding: 20px;
  }

  /* ---- Shop ---- */
  .shop-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }
  .shop-toolbar .result-count {
    font-size: 0.82rem;
  }
  .subcat-pills {
    margin-bottom: 12px;
  }
  .shop-toolbar .sort-row {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  /* Flipkart filter chrome lives in shop.css — keep legacy toolbar btn hidden */
  .mobile-filter-btn { display: none !important; }
  .cat-page-banner {
    height: 160px;
    border-radius: var(--radius-md);
  }
  .cat-page-banner-content {
    padding: 20px;
  }
  .products-grid.list-view .product-card {
    grid-template-columns: 110px 1fr;
  }
  .products-grid.list-view .img-wrap {
    height: 110px;
  }
  .subcat-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
  }
  .shop-main,
  .shop-layout,
  .products-grid,
  .shop-toolbar {
    max-width: 100%;
    min-width: 0;
  }
  .subcat-pill {
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 0.78rem;
  }

  /* ---- Product detail ---- */
  .product-info .product-title { font-size: 1.25rem; }
  .product-info .price-big { font-size: 1.4rem; }
  .action-btns {
    flex-direction: column;
  }
  .action-btns .btn { width: 100%; }
  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .tab-btn {
    flex-shrink: 0;
    padding: 12px 16px;
    font-size: 0.84rem;
  }

  /* ---- Cart / checkout ---- */
  .cart-item {
    grid-template-columns: 80px minmax(0, 1fr) auto !important;
    gap: 12px;
    align-items: start;
  }
  .cart-item-img {
    width: 80px;
    height: 80px;
  }
  .cart-item-details {
    min-width: 0;
  }
  .cart-item .item-actions,
  .cart-item .item-total {
    grid-column: 1 / -1;
  }
  .delivery-method-toggle {
    grid-template-columns: 1fr !important;
  }

  /* ---- Account / auth ---- */
  .otp-inputs { gap: 6px; }
  .otp-input {
    width: 44px;
    height: 48px;
    font-size: 1.2rem;
  }
  .auth-page {
    min-height: auto !important;
    align-items: flex-start !important;
    padding: 22px 0 34px !important;
  }
  .auth-page .container {
    padding-inline: 24px;
  }
  .auth-logo-wrap {
    margin-bottom: 22px !important;
  }
  .auth-logo-wrap img {
    height: 64px !important;
  }
  .auth-card {
    border-radius: 18px !important;
  }
  .auth-panel {
    padding: 28px 20px !important;
  }
  .auth-panel h2 {
    font-size: 1.7rem;
  }
  .auth-form-body {
    padding: 28px 20px 24px !important;
  }
  .auth-page .otp-inputs {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px !important;
    width: 100%;
  }
  .auth-page .otp-input {
    width: 100% !important;
    min-width: 0;
    height: 52px;
    border-radius: 14px;
  }
  .auth-page .btn-lg {
    min-height: 52px;
    padding: 13px 18px;
    white-space: normal;
  }
  .address-actions {
    flex-wrap: wrap;
  }

  /* ---- Static pages ---- */
  .values-grid { grid-template-columns: 1fr !important; }
  .team-grid { grid-template-columns: 1fr 1fr; }
  .faq-category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .faq-tab { flex-shrink: 0; }
}

/* Hide mobile-only filter button on desktop — kept for clarity; base rule is above */

@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .section { padding: 4px 0; }
  .section-sm { padding: 16px 0; }
  .section-header { margin-bottom: 20px; }
  .page-banner { padding: 14px 0 !important; }
  .page-banner h1 { font-size: 1.25rem; margin-bottom: 4px; }
  .page-banner p { display: none; }
  .product-card .card-body { padding: 12px 14px; }
  .product-card .product-name { font-size: 0.95rem; }
  .product-card .price { font-size: 1.05rem; }
  .product-card .add-btn { font-size: 0.88rem; padding: 10px; }

  .announcement-bar {
    font-size: 0.68rem;
    padding: 7px 10px;
  }

  .site-logo { height: 36px; }
  .header .container {
    padding-top: 4px;
    padding-bottom: 6px;
  }
  .header-inner { gap: 6px 10px; }
  .search-bar input { padding: 7px 12px; font-size: 0.8rem; }
  .search-bar button { padding: 7px 12px; }
  .header-btn span:not(.icon):not(.cart-count) {
    display: none;
  }
  .header-btn { padding: 4px; }

  .auth-page {
    padding: 18px 0 30px !important;
  }
  .auth-page .container {
    padding-inline: 16px;
  }
  .auth-logo-wrap {
    margin-bottom: 18px !important;
  }
  .auth-logo-wrap img {
    height: 58px !important;
  }
  .auth-panel {
    padding: 24px 18px !important;
  }
  .auth-form-body {
    padding: 24px 16px 22px !important;
  }
  .auth-page .otp-inputs {
    gap: 6px !important;
  }
  .auth-page .otp-input {
    height: 48px;
    border-radius: 12px;
    font-size: 1.15rem;
  }

  .hero-slide { min-height: 340px; }
  .hero-slide-content {
    padding: 20px 14px 52px;
  }
  .hero-slide-content h1 {
    font-size: 1.28rem;
    line-height: 1.25;
  }
  .hero-slide-content p {
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .hero-slide-content .btn {
    padding: 9px 14px;
    font-size: 0.76rem;
  }

  .cat-icon-item {
    flex: 0 0 33.333%;
    max-width: 33.333%;
  }
  .cat-icon-item .icon-circle {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
  }

  .grid-4,
  .grid-3,
  .grid-2 {
    gap: 10px;
  }

  .products-row .product-card { width: 150px; }

  .cta-cards {
    grid-template-columns: 1fr;
  }

  .why-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .insta-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .fcat-link-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .popup-top h2 { font-size: 1.7rem; }
  .popup-bottom .btn-primary {
    min-width: 0;
    width: 100%;
  }

  .products-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .product-card .wishlist-btn {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .footer-grid { grid-template-columns: 1fr !important; }

  .team-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Frontend mobile audit fixes (forms, about, addresses, etc.)
   ========================================================= */

/* Shared 2-col form rows → stack on phone/tablet */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.about-story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 60px;
}

.about-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.address-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .about-story-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
  }

  .about-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .about-hero {
    padding: 48px 0;
  }

  /* Safety net: leftover inline 2-col form/content grids */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Address card grids that used minmax(280px) can overflow ~430px viewports */
  [style*="minmax(280px"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .about-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .address-cards-grid {
    grid-template-columns: 1fr;
  }

  .values-grid {
    grid-template-columns: 1fr !important;
  }

  .team-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Cart line items: avoid crushing qty controls on narrow phones */
  .cart-item {
    grid-template-columns: 88px minmax(0, 1fr) !important;
    gap: 12px;
    align-items: start;
  }
  .cart-list-card {
    padding: 18px !important;
  }
  .cart-list-header {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .cart-list-header h3 {
    flex: 1 1 auto;
  }
  .cart-list-header a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .cart-item-img {
    grid-row: 1 / span 2;
    width: 88px;
    height: 88px;
  }
  .cart-item-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
  }
  .cart-item-name {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .cart-item-actions {
    margin-top: 0 !important;
  }
  .cart-item .qty-ctrl {
    transform: none !important;
  }
  .cart-item-remove {
    margin-top: 0;
  }
  .cart-item > :last-child {
    grid-column: 2;
    justify-self: start;
    align-self: start;
    margin-top: 0;
  }

  /* Contact form padding when still using inline card styles */
  .contact-layout form {
    padding: 20px 16px !important;
  }
}
