/* ==========================================================================
   Cook Yami Shop — mobile responsiveness only.
   No colours, fonts, or desktop layout are changed here. Every rule is
   wrapped in a max-width media query so desktop rendering is untouched.
   ========================================================================== */

/* Never allow sideways scrolling of the whole page on a phone. */
@media (max-width: 900px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Long words / URLs shouldn't push the layout wider than the screen. */
  h1, h2, h3, h4, p, li, td, th, span, a {
    overflow-wrap: anywhere;
  }

  /* Images and media stay inside their container. */
  img,
  video,
  iframe {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Responsive tables: below 760px a `.rtable` collapses from a wide grid
   into stacked cards. Each cell shows its column name from `data-label`.
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .rtable {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    display: block;
  }

  .rtable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .rtable tbody,
  .rtable tr,
  .rtable td {
    display: block;
    width: 100%;
  }

  .rtable tr {
    margin-bottom: 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    background: #ffffff;
  }

  .rtable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: right;
    border: 0 !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    border-radius: 0 !important;
    padding: 0.7rem 0.9rem !important;
  }

  .rtable td:last-child {
    border-bottom: 0 !important;
  }

  .rtable td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.6;
  }

  /* Cells with no label (e.g. empty-state rows) render normally. */
  .rtable td:not([data-label])::before {
    content: none;
  }

  .rtable td:not([data-label]) {
    display: block;
    text-align: center;
  }

  /* Action buttons wrap instead of overflowing. */
  .rtable td > div,
  .rtable td > form {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
  }

  /* The scroll wrapper is no longer needed once cells are stacked. */
  .rtable-wrap {
    overflow-x: visible !important;
  }
}

/* --------------------------------------------------------------------------
   Small-screen spacing / tap-target tidy-ups.
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* Comfortable tap targets. */
  .btn,
  button,
  [role="button"],
  a.btn {
    min-height: 40px;
  }

  /* Horizontal chip / tab rails scroll instead of wrapping awkwardly. */
  .mobile-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mobile-scroll-x::-webkit-scrollbar {
    display: none;
  }
}
