/* Mursalin Digital Deals — global responsive enhancements */

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

img, video, svg {
  max-width: 100%;
  height: auto;
}

body {
  overflow-x: hidden;
}

/* Safe area + mobile bottom nav spacing */
@media (max-width: 992px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
}

/* Fluid containers */
.container {
  width: 100%;
  max-width: 1536px;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

/* ── Responsive utility grids ── */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.form-grid-2--mb { margin-bottom: 16px; }
.form-grid-2--mb-md { margin-bottom: 20px; }
.form-grid-3--mb-lg { margin-bottom: 40px; }

.bm-checkout-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: flex-start;
}
.bm-checkout-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  position: sticky;
  top: 100px;
  box-shadow: var(--shadow);
}
.bm-reviews-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(32px, 6vw, 80px);
}
.wishlist-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
}

@media (max-width: 992px) {
  .form-grid-2,
  .form-grid-3,
  .bm-checkout-grid,
  .bm-reviews-layout {
    grid-template-columns: 1fr;
  }
  .bm-checkout-summary {
    position: static;
    top: auto;
  }
  .wishlist-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .wishlist-product-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Header (mobile rules in header.php inline styles) ── */
@media (max-width: 1100px) {
  .tm-header-search { display: none !important; }
  .header-main-nav { display: none !important; }
  .header-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
  .header-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .utility-bar .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
    font-size: 0.7rem;
  }
  .main-header { padding: 10px 0 !important; }
  .utility-bar .util-left {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
}

.mobile-nav-panel .container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0 16px;
}

/* ── Footer ── */
.footer-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.footer-home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.footer-dark .footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

@media (max-width: 576px) {
  footer .newsletter-inline-form {
    flex-direction: column;
  }
  footer .newsletter-inline-form input,
  footer .newsletter-inline-form button {
    border-radius: var(--radius-pill) !important;
    width: 100%;
  }
  footer .newsletter-inline-form input {
    border-right: 1px solid var(--border) !important;
    margin-bottom: 8px;
  }
  .footer-dark .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Shop ── */
@media (max-width: 991px) {
  .shop-layout,
  .bm-shop-layout {
    grid-template-columns: 1fr !important;
  }
  .shop-sidebar,
  .bm-sidebar-card {
    width: 100% !important;
  }
  .products-grid,
  .bm-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .bm-shop-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px;
  }
  .bm-sort-wrap { width: 100%; }
  .bm-sort-wrap select { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
  .products-grid,
  .bm-products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Pagination ── */
.pagination,
.bm-pagination {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 8px;
}

@media (max-width: 480px) {
  .pagination a,
  .pagination span,
  .bm-pagination a,
  .bm-pagination span {
    min-width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }
}

/* ── Product detail ── */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 5vw, 60px);
  align-items: start;
}
.gallery-wrapper {
  display: flex;
  gap: 16px;
}

@media (max-width: 900px) {
  .product-detail-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Cart page mobile ── */
@media (max-width: 900px) {
  .bm-cart-page .container {
    padding-left: 16px;
    padding-right: 16px;
    overflow-x: hidden;
  }
  .bm-cart-title {
    font-size: 1.65rem;
    margin-bottom: 20px;
  }
  .bm-cart-grid {
    gap: 24px;
  }
  .bm-ship-box {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
  }
}

/* ── Cart & tables ── */
@media (max-width: 600px) {
  .account-table,
  .specs-table,
  .policy-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .account-table th,
  .account-table td {
    white-space: nowrap;
  }
}

/* ── Blog ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
}

@media (max-width: 992px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .blog-filters {
    flex-wrap: wrap;
    gap: 12px !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 576px) {
  .blog-grid { grid-template-columns: 1fr !important; }
}

/* ── Content / policy pages ── */
.page-content-card,
.bm-content-card {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 576px) {
  .page-content-main,
  .bm-content-body {
    padding: 32px 0 60px;
  }
  .page-content-card,
  .bm-content-card {
    padding: 24px 18px !important;
    border-radius: var(--radius) !important;
  }
  .policy-content h2 {
    font-size: 1.2rem !important;
  }
}

/* ── About ── */
@media (max-width: 992px) {
  .ab-precision,
  .ab-footprint-grid {
    grid-template-columns: 1fr !important;
    gap: 40px;
  }
  .ab-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .ab-years {
    right: 12px !important;
    bottom: 12px !important;
  }
}

@media (max-width: 560px) {
  .ab-timeline { grid-template-columns: 1fr !important; }
  .ab-hero-inner { padding: 60px 0 70px !important; }
  .ab-founder { padding: 32px 20px !important; }
}

/* ── Contact ── */
@media (max-width: 992px) {
  .ct-grid,
  .ct-office-card {
    grid-template-columns: 1fr !important;
  }
  .ct-form-row {
    grid-template-columns: 1fr !important;
  }
  .tm-chat-wrap {
    min-height: 420px;
  }
}

/* ── Home sections ── */
@media (max-width: 992px) {
  .bm-sec-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .bm-crosssell-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 576px) {
  .bm-crosssell-grid {
    grid-template-columns: 1fr !important;
  }
  .bm-hero-content h1 {
    font-size: clamp(1.75rem, 8vw, 2.4rem) !important;
  }
}

/* ── Auth pages ── */
@media (max-width: 576px) {
  .bm-auth-page .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bm-auth-card {
    padding: 28px 20px !important;
  }
}

/* ── Order pages ── */
.order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: clamp(24px, 5vw, 48px);
  align-items: start;
}
.order-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 50px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 30px;
}
.order-success-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 5vw, 40px);
  margin-bottom: 40px;
}
.order-recap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}
.order-items-detail .items-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .order-detail-grid,
  .order-success-grid {
    grid-template-columns: 1fr;
  }
  .order-detail-header {
    align-items: flex-start;
  }
}

@media (max-width: 576px) {
  .order-recap {
    padding: 28px 18px !important;
  }
  .order-recap-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .order-recap-header > div:last-child {
    text-align: left !important;
  }
  .order-detail-page .order-items-detail .items-table {
    min-width: 520px;
  }
}

/* ── Checkout page title ── */
@media (max-width: 576px) {
  .bm-page[style*="padding: 60px"] h1,
  main.bm-page h1 {
    font-size: 1.75rem !important;
  }
  .bm-checkout-summary {
    padding: 24px 18px !important;
  }
}

/* ── Touch-friendly tap targets ── */
@media (hover: none) and (pointer: coarse) {
  .header-icon-link,
  .tm-prod-cart,
  .sp-btn,
  .btn,
  .bm-shop-card .add-btn,
  .wishlist-toggle,
  .mobile-bottom-nav a,
  .mobile-menu-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Swiper */
.swiper-slide { height: auto; }

/* Prevent long words breaking layout */
.product-info,
.bm-pd-title,
.bm-shop-card .name,
.policy-content p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
