/* ============================================================
   Mobile fixes — load this AFTER static/css/styles.css
   Isolated on purpose: nothing here touches desktop layout
   (everything is wrapped in max-width media queries), so this
   file can be removed/reverted independently of styles.css.
   ============================================================ */

/* ---------------- Header / top navbar ---------------- */
@media (max-width: 767.98px) {
  .navbar-custom {
    height: auto;
    padding: 10px 0;
  }

  /* Bootstrap's .navbar already sets flex-wrap:wrap and the
     .container inherits it — we just make sure our three
     children (logo / search / buttons) land in a sane order
     and don't get squeezed into one unreadable row. */
  .navbar-custom .container {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .navbar-custom .navbar-brand {
    order: 1;
  }

  .navbar-custom .d-flex.order-3 {
    order: 2;
    margin-inline-start: auto;
    gap: 6px !important;
  }

  /* Search moves to its own full-width row below logo+buttons */
  .navbar-custom .search-box {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
  }

  /* Icon-only buttons on mobile — text labels hidden, button
     becomes a compact circular tap target (44px, touch-friendly) */
  .header-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
  }
  .header-btn i {
    font-size: 19px;
  }
  .header-btn span {
    display: none;
  }
}

/* ---------------- Hero banner (shoar image) ---------------- */
@media (max-width: 767.98px) {
  .center-image {
    margin: 16px 0;
  }
  .center-image img {
    width: 92%;
  }
}

/* ---------------- Footer ---------------- */
@media (max-width: 767.98px) {
  .expandable-content {
    width: 100%;
  }
  .footer-badges-top {
    width: 100%;
    margin: 24px auto;
    justify-content: center;
    gap: 1.1rem 1.4rem;
  }
  .footer-badges-top img {
    height: 46px;
  }
  .site-footer {
    padding: 2rem 0 1rem;
  }
}

/* ---------------- Homepage banner sections ---------------- */
/* Reduce the heavy vertical margins that add up to a lot of
   scrolling on a small screen with many stacked sections. */
@media (max-width: 767.98px) {
  section.container.my-4 {
    margin-top: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }
}

/* ---------------- Cart page: card layout instead of a table ---------------- */
/* The <table> stays for desktop (>=768px); a separate card-based
   layout takes over on mobile. Both are rendered server-side in
   cart_details.html inside two independent <form> elements so
   there's no duplicate-input-name issue — only the visible one
   is ever a real, single form to the user. */
@media (max-width: 767.98px) {
  .cart-table-wrap {
    display: none !important;
  }
}
@media (min-width: 768px) {
  .cart-mobile-list {
    display: none !important;
  }
}

.cart-mobile-card {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
}
.cart-mobile-card .cart-mobile-title {
  font-weight: 600;
  margin-bottom: 2px;
  display: block;
}
.cart-mobile-card .cart-mobile-meta {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 10px;
}
.cart-mobile-card .cart-mobile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.cart-mobile-card .cart-mobile-price {
  font-weight: 600;
  color: #d1477e;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.qty-stepper button {
  border: none;
  background: #f7f7f7;
  width: 36px;
  height: 36px;
  font-size: 1.15rem;
  line-height: 1;
}
.qty-stepper button:active {
  background: #ececec;
}
.qty-stepper input {
  border: none;
  border-inline: 1px solid #eee;
  width: 46px;
  height: 36px;
  text-align: center;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-mobile-remove {
  border: none;
  background: none;
  color: #dc3545;
  font-size: 0.85rem;
  padding: 6px 4px;
}

/* Sticky "update quantities" action bar on mobile so it's always
   reachable without scrolling back up after editing a card at
   the bottom of a long cart. */
@media (max-width: 767.98px) {
  .cart-mobile-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0;
    margin-top: 4px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  }
}

/* ---------------- General touch-target safety net ---------------- */
@media (max-width: 767.98px) {
  .btn {
    min-height: 40px;
  }
}

/* ---------------- Cart count badge (all viewports, not mobile-only) ---------------- */
/* Kept in this file to avoid introducing yet another linked stylesheet
   for a handful of rules; nothing here is wrapped in a media query on
   purpose, since the badge should show on desktop too. */
.cart-count-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d1477e;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

