/* =========================================================
   MOBIREXS — Store-wide responsive polish
   Loaded last. Does not change layout logic, only how it
   sits on phone / tablet / laptop / wide desktop.
   ========================================================= */

.mx-cats-grid--sub {
  grid-template-columns: repeat(auto-fit, minmax(140px, 200px));
  justify-content: start;
}

/* Long AED titles and UAE addresses must wrap, not push the page. */
.mx-product-card__title,
.mx-product__info h1,
.mx-cart-item__name,
.mx-order-item__name,
.mx-shop-heading h1,
.mx-breadcrumbs,
.mx-footer,
.mx-contact-list,
.mx-exchange-quote__device {
  overflow-wrap: anywhere;
  word-break: break-word;
}

img, video, canvas, svg { max-width: 100%; }
table { max-width: 100%; }
.mx-variant-table-wrap,
.mx-cart__card,
.mx-checkout__card,
.mx-order-review {
  max-width: 100%;
}

/* Comfortable tap targets on real phones. */
.mx-swatch,
.mx-cats-list a,
.mx-filter-group label,
.mx-cond-guide-toggle,
.mx-btn,
.mx-menu > li > a,
.mx-action,
.mx-product-card__wish,
.mx-qty-btn {
  min-height: 44px;
}

html { overflow-x: clip; }
body { overflow-x: clip; }

@media (max-width: 390px) {
  .mx-product-card__price .woocommerce-Price-amount { font-size: .9rem !important; }
  .mx-header__row { gap: .5rem; }
  .mx-search__input { font-size: 16px; } /* stop iOS zoom on focus */
  .mx-contact-form input,
  .mx-contact-form textarea,
  .woocommerce form .form-row input.input-text,
  .woocommerce form .form-row select { font-size: 16px; }
}

.mx-social a,
.mx-social__link {
  width: 40px;
  height: 40px;
}

/* ---------- Wide desktop ---------- */
@media (min-width: 1440px) {
  .mx-section { padding: 4.5rem 0; }
  .mx-hero { padding: 2rem 0 2.75rem; }
  .mx-trust { padding: 1.85rem 0; }
  .mx-footer { padding-top: 3.5rem; }
}

@media (min-width: 1600px) {
  :root { --mx-container: 1360px; }
}

@media (min-width: 1920px) {
  :root { --mx-container: 1480px; }
  .mx-hero__product { max-height: 400px; }
}

/* ---------- Laptop / small desktop ---------- */
@media (max-width: 1280px) and (min-width: 1101px) {
  .mx-cats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1280px) and (min-width: 901px) {
  .mx-trust__grid { grid-template-columns: repeat(3, 1fr); }
  .mx-trust__item { border-right: 0; border-bottom: 1px solid #E5E7EB; padding: .75rem .85rem; }
  .mx-trust__item:nth-last-child(-n+3) { border-bottom: 0; }
}
@media (max-width: 1280px) {
  .mx-hero-carousel__nav--prev { left: .65rem; }
  .mx-hero-carousel__nav--next { right: .65rem; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .mx-container { width: min(100% - 2rem, var(--mx-container)); }
}
@media (max-width: 1024px) and (min-width: 641px) {
  .mx-products-grid { grid-template-columns: repeat(3, 1fr); }
  .mx-why__grid { grid-template-columns: 1fr 1fr; }
  .mx-exchange-perks { grid-template-columns: 1fr 1fr; }
  .mx-about-values__grid,
  .mx-returns-rules__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .mx-header { z-index: 1200; }
  .mx-nav-overlay:not([hidden]) { z-index: 1100; }
  .mx-nav.is-open {
    position: relative;
    z-index: 1210;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  }
  .mx-cats-btn {
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    padding: .75rem .15rem;
  }
  .mx-cats-panel {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: .35rem;
    border: 1px solid var(--mx-line);
    box-shadow: none;
    border-radius: 12px;
  }
  .mx-cats-list a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .mx-menu > li > a {
    min-height: 48px;
    padding: .75rem .65rem;
  }
  .mx-section { padding: 2.5rem 0; }
  .mx-section__head { margin-bottom: 1.35rem; }
  .mx-hero-carousel__nav { display: none; }
  .mx-trust-banner { padding: 1.5rem 1.35rem; }
  .mx-trust-banner h2 { max-width: none; }
  .mx-about-cta__box,
  .mx-returns-help__box,
  .mx-exchange-hero__inner { gap: 1.1rem; }
  .mx-shop-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .woocommerce .woocommerce-ordering,
  .woocommerce .woocommerce-ordering select,
  .mx-shop-toolbar .woocommerce-ordering select {
    width: 100%;
    min-width: 0;
  }
}

/* ---------- Phone / large phone ---------- */
.mx-breadcrumbs {
  overflow-wrap: anywhere;
  line-height: 1.5;
}

@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="search"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  select,
  textarea,
  .woocommerce form .form-row input.input-text,
  .woocommerce form .form-row select,
  .woocommerce form .form-row textarea,
  .mx-auth__form .input-text,
  .mx-contact-form input,
  .mx-contact-form textarea,
  .mx-newsletter__form input[type="email"],
  .mx-search__input {
    font-size: 16px !important;
  }

  .mx-product-card__wish {
    width: 40px;
    height: 40px;
  }
  .mx-content-page { padding: 1.5rem 0 2.25rem; }
  .mx-shop-main { padding: 1.25rem 0 2.5rem; }
  .mx-checkout-hero { padding: 1.25rem 0 1.1rem; }
  .mx-checkout-hero h1 { font-size: 1.45rem; }
  .mx-checkout__card { padding: 1.2rem 1.1rem; border-radius: 16px; }
  .mx-cart-page { padding: 1.25rem 0 2.5rem; }
  .mx-exchange-card { padding: 1.25rem 1.1rem 1.5rem; border-radius: 18px; }
  .mx-exchange-panel h2 { font-size: 1.2rem; }
  .mx-exchange-steps {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .55rem .65rem;
  }
  .mx-exchange-steps li {
    flex: 1 1 calc(50% - .65rem);
    justify-content: flex-start;
    white-space: nowrap;
  }
  .mx-exchange-chip,
  .mx-exchange-cond {
    min-height: 44px;
    width: 100%;
  }
  .mx-exchange-options--row,
  .mx-exchange-options--wrap {
    flex-direction: column;
  }
  .mx-gallery__thumbs {
    gap: .5rem;
    padding-bottom: .15rem;
  }
  .mx-cond-cards {
    grid-template-columns: 1fr;
  }
  .mx-cond-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: .8rem 1rem;
    min-height: 48px;
  }
  .mx-cond-card__price { text-align: right; }
  .mx-cond-card__price del { display: inline; margin-right: .35rem; }
  .mx-about-cta__box,
  .mx-returns-help__box {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem 1.15rem;
  }
  .mx-about-cta__box .mx-btn,
  .mx-returns-help__box .mx-btn,
  .mx-about-intro__cta .mx-btn {
    width: 100%;
  }
  .mx-returns-highlight__card { padding: 1.35rem 1.15rem; }
  .mx-page-hero__lead { font-size: .95rem; }
  .mx-modal { padding: .75rem; align-items: end; }
  .mx-modal__box { width: 100%; border-radius: 18px 18px 14px 14px; }
  .mx-whatsapp {
    width: 52px;
    height: 52px;
  }
  .mx-product,
  .mx-shop-main,
  .mx-content-page,
  .mx-cart-page,
  .mx-checkout-page,
  .mx-exchange-page,
  .mx-about-page,
  .mx-returns-page,
  .mx-shipping-page {
    padding-bottom: 5.5rem;
  }
}

@media (max-width: 640px) {
  .mx-cats-grid,
  .mx-cats-grid--sub {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem .75rem;
  }
  .mx-cat-card__img { max-width: 110px; }
  .mx-products-grid { gap: .7rem; }
  .mx-product-card .mx-btn { min-height: 42px; }
  .mx-footer__highlights { gap: .65rem 1rem; }
  .mx-promo-strip__offer { font-size: .88rem; }
  .mx-auth__card { padding: 1.5rem 1.15rem 1.25rem; border-radius: 16px; }
  .mx-auth__trust { gap: .75rem; }
  .mx-empty-state { padding: 2rem .5rem 2.5rem; }
  .mx-thankyou__facts li { flex-direction: column; gap: .2rem; }
  .mx-thankyou__actions .mx-btn { width: 100%; }
  .mx-contact-aside { padding: 1.2rem 1.1rem; }
  .mx-contact-form .mx-btn { width: 100%; }
  .mx-order-item { grid-template-columns: 56px 1fr; gap: .65rem; }
  .mx-order-item__media { width: 56px; height: 56px; }
  .mx-order-item__media img,
  .mx-order-item__img { width: 48px !important; height: 48px !important; }
  .woocommerce nav.woocommerce-pagination ul.page-numbers {
    width: 100%;
    justify-content: center;
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  .mx-header__row { padding: .7rem 0; }
  .mx-action--account .mx-action__text { display: none; }
  .mx-deals-carousel { padding: 0 2.1rem; }
  .mx-section__head h2 { font-size: 1.15rem; }
  .mx-hero__panel { padding: 1rem .85rem 1.15rem; border-radius: 12px; }
  .mx-hero__product { max-height: 180px; }
  .mx-hero__badge { width: 68px; height: 68px; }
  .mx-trust__grid { grid-template-columns: 1fr; }
  .mx-trust__item { padding: .7rem 0; }
  .mx-trust-banner__stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .mx-why__grid { grid-template-columns: 1fr; }
  .mx-cart-empty { padding: 2rem 1.1rem; }
  .mx-cart-empty__actions { flex-direction: column; }
  .mx-cart-empty__actions .mx-btn { width: 100%; }
  .mx-checkout-steps { overflow-x: auto; flex-wrap: nowrap; }
  .mx-checkout-steps__item { white-space: nowrap; }
  body.woocommerce-account.logged-in .woocommerce-MyAccount-content table.shop_table td {
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .mx-header__actions { gap: .2rem; }
  .mx-action__icon,
  .mx-nav-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .mx-products-grid { gap: .5rem; }
  .mx-product-card { padding: .55rem; }
  .mx-product-card__media { height: 108px; }
  .mx-btn--sm { padding: .5rem .7rem; }
}

@media (max-width: 800px) {
  .mx-contact-aside { order: -1; }
}

.mx-contact-page h1 {
  margin: 0 0 .65rem;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  color: var(--mx-black);
}
.mx-contact-page .entry-content > p:first-of-type {
  color: var(--mx-muted);
  margin: 0 0 .25rem;
  max-width: 52ch;
}
.mx-exchange-hero .mx-btn { white-space: nowrap; }
@media (max-width: 640px) {
  .mx-exchange-hero { padding: 1.75rem 0 1.5rem; }
  .mx-exchange-hero .mx-btn { width: 100%; }
}

.mx-content-page .mx-section__head {
  flex-wrap: wrap;
  align-items: flex-end;
}
.mx-content-page .mx-section__head h1 {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  margin: 0;
}
.mx-content-page .mx-section__head p {
  margin: .35rem 0 0;
  color: var(--mx-muted);
  width: 100%;
  font-size: .92rem;
}
.mx-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.mx-pagination .page-numbers {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--mx-line);
  font-weight: 700;
  font-size: .85rem;
}
.mx-pagination .page-numbers.current,
.mx-pagination a.page-numbers:hover {
  background: var(--mx-orange);
  border-color: var(--mx-orange);
  color: #fff;
}

/* Related / Woo default grids inherit the theme cards. */
@media (max-width: 700px) {
  .woocommerce ul.products { gap: .7rem; }
  .related.products ul.products,
  .upsells.products ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

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