:root {
  --ordering-top-bar-max-width: min(var(--ui-content-max, 1200px), 100%);
}

.ordering-top-bar {
  width: var(--ordering-top-bar-max-width);
  margin: 0 auto clamp(10px, 3vw, 24px);
  padding: clamp(10px, 2vw, 18px);
  border: 1px solid #dbe4f2;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
  position: relative;
  z-index: 60;
}

.ordering-top-bar__shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "lang brand home";
  align-items: center;
  gap: 12px;
}

.ordering-top-bar__home {
  grid-area: home;
  justify-self: end;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #d5deed;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.ordering-top-bar__home:hover,
.ordering-top-bar__home:focus-visible {
  border-color: rgba(59, 130, 246, 0.62);
  outline: none;
}

.ordering-top-bar__brand-link {
  grid-area: brand;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1f2937;
  min-width: 0;
}

.ordering-top-bar__brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid #dbe4f2;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.ordering-top-bar__brand-name {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 800;
  line-height: 1.3;
  max-width: min(360px, 48vw);
  overflow-wrap: anywhere;
}

.ordering-top-bar .rt-lang-menu {
  grid-area: lang;
  position: relative;
  left: auto;
  right: auto;
  justify-self: start;
  z-index: 70;
}

.ordering-top-bar .rt-lang-menu__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #d5deed;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ordering-top-bar .rt-lang-menu__toggle:hover,
.ordering-top-bar .rt-lang-menu__toggle:focus-visible {
  border-color: rgba(59, 130, 246, 0.62);
  outline: none;
}

.ordering-top-bar .rt-lang-menu__toggle img {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.ordering-top-bar .rt-lang-menu__chevron {
  font-size: 0.74rem;
  opacity: 0.78;
}

.ordering-top-bar .rt-lang-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: 190px;
  max-height: min(320px, 70vh);
  overflow: auto;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #d5deed;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.ordering-top-bar .rt-lang-menu[data-open="true"] .rt-lang-menu__dropdown {
  display: flex;
}

.ordering-top-bar .rt-lang-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  width: 100%;
  border: 0;
  padding: 8px 9px;
  border-radius: 9px;
  background: transparent;
  color: #1f2937;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.ordering-top-bar .rt-lang-menu__item[data-lang="ar"] {
  font-family: "Cairo", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ordering-top-bar .rt-lang-menu__item img {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  object-fit: cover;
}

.ordering-top-bar .rt-lang-menu__item:hover,
.ordering-top-bar .rt-lang-menu__item:focus-visible {
  background: rgba(148, 163, 184, 0.18);
  outline: none;
}

.ordering-top-bar .rt-lang-menu__item[aria-current="true"] {
  background: rgba(26, 115, 232, 0.15);
  color: #0f5bcc;
}

html[lang="ar"] .ordering-top-bar__brand-link,
html[dir="rtl"] .ordering-top-bar__brand-link {
  flex-direction: row-reverse;
}

html[lang="ar"] .ordering-top-bar .rt-lang-menu,
html[dir="rtl"] .ordering-top-bar .rt-lang-menu {
  justify-self: end;
}

html[lang="ar"] .ordering-top-bar .rt-lang-menu__dropdown,
html[dir="rtl"] .ordering-top-bar .rt-lang-menu__dropdown {
  left: auto;
  right: 0;
}

html[lang="ar"] .ordering-top-bar .rt-lang-menu__item,
html[dir="rtl"] .ordering-top-bar .rt-lang-menu__item {
  text-align: right;
}

@media (min-width: 721px) {
  html[lang="ar"] body.cart-page .ordering-top-bar__shell,
  html[dir="rtl"] body.cart-page .ordering-top-bar__shell,
  html.rt-lang-ar body.cart-page .ordering-top-bar__shell,
  html.rt-lang-rtl body.cart-page .ordering-top-bar__shell,
  body.cairo-font.cart-page .ordering-top-bar__shell {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "lang brand .";
  }

  html[lang="ar"] body.cart-page .ordering-top-bar .rt-lang-menu,
  html[dir="rtl"] body.cart-page .ordering-top-bar .rt-lang-menu,
  html.rt-lang-ar body.cart-page .ordering-top-bar .rt-lang-menu,
  html.rt-lang-rtl body.cart-page .ordering-top-bar .rt-lang-menu,
  body.cairo-font.cart-page .ordering-top-bar .rt-lang-menu {
    grid-area: lang;
    grid-column: auto;
    grid-row: auto;
    justify-self: start;
  }

  html[lang="ar"] body.cart-page .ordering-top-bar__brand-link,
  html[dir="rtl"] body.cart-page .ordering-top-bar__brand-link,
  html.rt-lang-ar body.cart-page .ordering-top-bar__brand-link,
  html.rt-lang-rtl body.cart-page .ordering-top-bar__brand-link,
  body.cairo-font.cart-page .ordering-top-bar__brand-link {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .ordering-top-bar__shell {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand brand"
      "lang home";
    gap: 10px;
  }

  html[lang="ar"] body.cart-page .ordering-top-bar__shell,
  html[dir="rtl"] body.cart-page .ordering-top-bar__shell,
  html.rt-lang-ar body.cart-page .ordering-top-bar__shell,
  html.rt-lang-rtl body.cart-page .ordering-top-bar__shell,
  body.cairo-font.cart-page .ordering-top-bar__shell {
    grid-template-areas:
      "brand brand"
      "lang .";
  }

  html[lang="ar"] body.cart-page .ordering-top-bar .rt-lang-menu,
  html[dir="rtl"] body.cart-page .ordering-top-bar .rt-lang-menu,
  html.rt-lang-ar body.cart-page .ordering-top-bar .rt-lang-menu,
  html.rt-lang-rtl body.cart-page .ordering-top-bar .rt-lang-menu,
  body.cairo-font.cart-page .ordering-top-bar .rt-lang-menu {
    grid-area: lang;
    grid-column: auto;
    grid-row: auto;
    justify-self: start;
  }

  .ordering-top-bar__brand-link {
    justify-self: center;
  }

  .ordering-top-bar__home {
    padding: 8px 12px;
    min-height: 40px;
  }
}

@media (max-width: 520px) {
  .ordering-top-bar {
    border-radius: 18px;
    padding: 10px;
  }

  .ordering-top-bar__brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .ordering-top-bar__brand-name {
    font-size: 0.95rem;
    max-width: 62vw;
  }

  .ordering-top-bar .rt-lang-menu__toggle [data-rt-lang-current] {
    display: none;
  }

  .ordering-top-bar .rt-lang-menu__toggle {
    min-height: 36px;
    padding: 6px 8px;
  }
}
