/* ==================================================
   RESPONSIVE & MOBILE DESIGN SYSTEM
   ================================================== */

/* DESKTOP (Default > 780px) */
@media (min-width: 781px) {
  .open-cart-btn {
    display: flex !important;
  }

  .mobile-cart-btn-container {
    display: none !important;
  }
}

/* TABLET & MOBILE (<= 780px) */
@media (max-width: 780px) {
  html {
    font-size: 58%;
  }

  body {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #ffffff;
    box-shadow: none;
  }

  /* Cart Visibility (Requirement 2) */
  .open-cart-btn {
    display: none !important;
  }

  .mobile-cart-btn-container {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 1.2rem 1.6rem;
    padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0));
    width: 100%;
    box-sizing: border-box;
  }

  .cart-open-mobile-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.4rem 2rem;
    font-size: 1.6rem;
    font-weight: 700;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 10px rgba(142, 0, 0, 0.25);
  }

  .cart-btn-qty-badge {
    background-color: rgba(255, 255, 255, 0.25);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 800;
  }

  .cart-btn-price-container {
    font-weight: 800;
  }

  /* Header */
  .header {
    width: 100%;
    padding: 1.4rem 1.6rem 1.2rem;
    box-sizing: border-box;
    border-bottom: none;
    margin-bottom: 0.6rem;
  }

  .meta-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.2rem;
  }

  .loc-phone {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 1.35rem;
  }

  .location, .phone {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0;
  }

  .logo-container {
    max-width: 10rem;
    flex-shrink: 0;
  }

  .logo {
    max-width: 100%;
    height: auto;
  }

  .order-settings {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .order-delivery-btns {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 0;
  }

  .order-delivery-btns .switch-btn {
    padding: 1rem 2rem;
  }

  .order-time-location-container {
    margin-bottom: 0;
  }

  .a-link,
  .a-link:link,
  .a-link:visited {
    margin-bottom: 0 !important;
  }

  /* Categories Bar (Horizontal Sticky Bar) */
  .category-container {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    padding: 0.8rem 1.4rem;
    border-top: none !important;
    border-bottom: none;
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-container::-webkit-scrollbar {
    display: none;
  }

  .category-container .heading-tertiary {
    display: none;
  }

  .categories {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    overflow-x: visible;
    width: max-content;
    padding: 0.2rem 0;
    list-style: none;
  }

  .categories::-webkit-scrollbar {
    display: none;
  }

  .category {
    flex-shrink: 0;
  }

  .category-link,
  .category-link:link,
  .category-link:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0.8rem 1.4rem;
    font-size: 1.35rem;
    font-weight: 700;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.12s ease;
  }

  .category-link--active,
  .category-link--active:link,
  .category-link--active:visited {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    border-color: var(--primary-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(142, 0, 0, 0.25);
  }

  /* Menu Content */
  .menu-container {
    width: 100%;
    padding: 1.6rem;
    box-sizing: border-box;
    padding-bottom: 14rem;
  }

  .popular-items {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .grid-2-by-2 {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }

  .item {
    grid-template-columns: 13rem 1fr;
    gap: 1.4rem;
    padding: 1.4rem;
  }

  .item-img-container {
    width: 13rem;
    height: 13rem;
  }

  /* Sidebars on Mobile */
  .sidebar,
  .checkout-sidebar {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 1.6rem;
    box-sizing: border-box;
  }
}

/* SMALL MOBILE (<= 520px) */
@media (max-width: 520px) {
  html {
    font-size: 55%;
  }

  .item {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .item-img-container {
    width: 100%;
    height: 18rem;
  }

  .group-2-by-2,
  .group-3-by-1,
  .group-3-3-3 {
    grid-template-columns: 1fr !important;
    gap: 1.2rem;
  }

  .tip-btns {
    flex-wrap: wrap;
  }

  .btn-tips {
    flex: 1 1 40%;
  }
}