/* ============================================================
   Moreish menu — public stylesheet
   Mobile-first, RTL-aware, no framework
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; display: block; }

/* ---- Banner --------------------------------------------------- */
.banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-bg);
  border-bottom: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1rem;
  gap: 1rem;
}
.brand { text-decoration: none; color: inherit; display: flex; align-items: center; }
.logo { height: 44px; width: auto; object-fit: contain; }
.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-header);
  letter-spacing: .3px;
}
.brand-names { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.brand-names .name-ar { font-size: 1.05rem; font-weight: 700; color: var(--c-header); }
.brand-names .name-en { font-size: .8rem; opacity: .7; }

/* ---- Category nav -------------------------------------------- */
.cat-nav {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-top: 1px solid rgba(0,0,0,.04);
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-track {
  display: flex;
  gap: .5rem;
  padding: .55rem 1rem;
  white-space: nowrap;
}
.cat-pill {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--c-text);
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-size: .85rem;
  line-height: 1.2;
  transition: background .2s, color .2s, border-color .2s;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.cat-pill .ar { font-size: .92rem; font-weight: 700; }
.cat-pill .en { font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.cat-pill.is-active {
  background: var(--c-header);
  color: #fff;
  border-color: var(--c-header);
}

/* ---- Page layout --------------------------------------------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}
.hero {
  text-align: center;
  padding: 1rem 0 .5rem;
}
.tag-ar { font-size: 1.25rem; color: var(--c-header); margin: 0; font-weight: 700; }
.tag-en { font-size: .9rem; opacity: .75; margin: .25rem 0 0; letter-spacing: .5px; }

.cat-section { margin-top: 2rem; scroll-margin-top: 120px; }
.cat-title {
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--c-header);
  color: var(--c-header);
  display: flex;
  flex-direction: row-reverse; /* AR on the right, EN on the left */
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}
.cat-title .ar { font-size: 1.45rem; font-weight: 800; }
.cat-title .en { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; }

/* ---- Item cards (image on top, text below) -------------------- */
.items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.item {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.item-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f0eee4;
  display: block;
}
.item-img--ph {
  background: linear-gradient(135deg, #efe9d6 0%, #f9f4e2 60%, #f0e7c8 100%);
  position: relative;
}
.item-img--ph::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 30% 35%, rgba(255,255,255,.6) 0 12%, transparent 13%),
    radial-gradient(circle at 65% 60%, rgba(198,0,0,.05) 0 20%, transparent 21%);
}
.item-body { padding: .9rem 1rem 1rem; min-width: 0; }
.item-name {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}
.item-name .ar { font-size: 1.2rem; font-weight: 700; color: var(--c-text); line-height: 1.25; }
.item-name .en { font-size: 1rem; opacity: .7; line-height: 1.25; margin-top: 2px; }

.item-price-row { text-align: right; margin-top: .55rem; }
.item-price {
  display: inline-block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--c-header);
  white-space: nowrap;
  background: rgba(198,0,0,.08);
  padding: .3rem .6rem;
  border-radius: 6px;
}

.item-desc {
  margin: .55rem 0 0;
  line-height: 1.45;
  color: rgba(44,44,44,.78);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item-desc .ar { font-size: 1rem; }
.item-desc .en { font-size: 1rem; opacity: .8; }

/* ---- Tablet / desktop grid ------------------------------------ */
@media (min-width: 640px) {
  .items { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 960px) {
  .page { max-width: 980px; }
  .items { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ---- Social row (just under hero) ----------------------------- */
.social-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin: .25rem 0 1.5rem;
}
.social-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--c-header);
  color: #fff;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 6px rgba(198,0,0,.18);
}
.social-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(198,0,0,.28); }

/* ---- Footer ---------------------------------------------------- */
.foot {
  margin-top: 3rem;
  text-align: center;
  padding-top: 1.5rem;
  padding-bottom: 5rem; /* leave room for the floating Order Now button */
  border-top: 1px solid rgba(0,0,0,.08);
}
.addr, .hours { font-size: .85rem; margin: .8rem 0 .25rem; opacity: .8; }
.addr .ar, .hours .ar { display: block; font-weight: 600; }
.copy { font-size: .75rem; opacity: .5; margin: 1.5rem 0 .5rem; }

/* ---- Floating Order Now button -------------------------------- */
.order-fab {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
  pointer-events: none; /* children re-enable */
}
.order-fab > * { pointer-events: auto; }

.order-fab-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.25rem;
  background: var(--c-header);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(198,0,0,.35);
  transition: transform .15s ease, box-shadow .15s ease, background .2s;
}
.order-fab-trigger:hover { background: #a30000; box-shadow: 0 8px 24px rgba(198,0,0,.45); }
.order-fab-trigger .ar { font-size: 1rem; }
.order-fab-trigger .en { font-size: .8rem; opacity: .9; border-left: 1px solid rgba(255,255,255,.35); padding-left: .5rem; }
.order-fab-caret { transition: transform .25s ease; }
.order-fab[data-expanded="true"] .order-fab-caret { transform: rotate(180deg); }

.order-fab-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.order-fab[data-expanded="true"] .order-fab-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.order-fab-menu li { display: block; }

.order-platform {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  transition: transform .15s ease, box-shadow .15s ease;
  text-decoration: none;
  font-size: 0; /* hide any text content */
}
.order-platform:hover {
  transform: translateX(-3px) scale(1.05);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}

/* Real brand logos (480x480 WebP) */
.order-talabat { background-image: url('../images/delivery/talabat.webp'); }
.order-snoonu  { background-image: url('../images/delivery/snoonu.webp'); }
.order-rafeeq  { background-image: url('../images/delivery/rafeeq.webp'); }
.order-keeta   { background-image: url('../images/delivery/keeta.webp'); }

/* Rubik covers Arabic — keep RTL on the same family for consistency */
[dir="rtl"] { font-family: "Rubik", "Segoe UI", -apple-system, Arial, sans-serif; }

/* ---- Pull-to-refresh indicator ------------------------------- */
.ptr-indicator {
  position: fixed;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-header);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  opacity: 0;
  z-index: 200;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease, background .15s ease;
}
.ptr-indicator.ready   { background: #1d6f33; }
.ptr-indicator.loading svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== Search FAB & overlay ===================================== */
.search-fab {
  position: fixed;
  z-index: 100;
  left: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--c-header);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  transition: transform .15s ease, box-shadow .15s ease;
}
.search-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.25); }
.search-fab:active { transform: translateY(0); }

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.search-overlay[aria-hidden="false"] { display: block; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  animation: search-fade-in .18s ease;
}
.search-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.2);
  animation: search-slide-up .22s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 720px) {
  .search-sheet {
    left: 50%;
    right: auto;
    bottom: 5vh;
    width: min(640px, 92vw);
    max-height: 80vh;
    transform: translateX(-50%);
    border-radius: 16px;
  }
}
.search-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid #eee;
}
.search-head-icon { color: #999; flex-shrink: 0; }
.search-input {
  flex: 1;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 1rem;
  background: transparent;
  color: var(--c-text);
  padding: .35rem 0;
  min-width: 0;
}
.search-close {
  border: 0;
  background: transparent;
  color: #888;
  cursor: pointer;
  padding: .25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-close:hover { background: #f3f3f3; color: #333; }

.search-results {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #999;
  font-style: italic;
}
.result-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .7rem 1rem;
  border: 0;
  background: transparent;
  text-align: start;
  font: inherit;
  cursor: pointer;
  border-bottom: 1px solid #f3f3f3;
}
.result-item:hover, .result-item:focus { background: #faf9f4; outline: none; }
.result-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f3f3;
  flex-shrink: 0;
}
.result-thumb--ph { background: #f3f3f3; }
.result-body { flex: 1; min-width: 0; }
.result-name { display: flex; flex-direction: column; line-height: 1.25; }
.result-name .ar { font-size: .95rem; font-weight: 600; color: var(--c-text); }
.result-name .en { font-size: .8rem; color: #666; }
.result-desc { font-size: .75rem; color: #999; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-price { font-size: .85rem; font-weight: 700; color: var(--c-header); flex-shrink: 0; margin-inline-start: .5rem; }

/* Highlight target after scroll-to */
.item.search-flash { animation: search-flash 1.4s ease; }
@keyframes search-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198,0,0,0); }
  20%, 60% { box-shadow: 0 0 0 4px rgba(198,0,0,.35); }
}

@keyframes search-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes search-slide-up { from { transform: translateY(100%) } to { transform: translateY(0) } }
@media (min-width: 720px) {
  @keyframes search-slide-up { from { transform: translate(-50%, 100%) } to { transform: translate(-50%, 0) } }
}

/* Lock body scroll when overlay is open */
body.search-open { overflow: hidden; }

