:root {
  --bg-dark: #1a1410;
  --bg-card: #2a221c;
  --bg-card-hover: #352b24;
  --text-primary: #f5f0eb;
  --text-secondary: #a89888;
  --accent-restaurant: #d4a574;
  --accent-restaurant-glow: rgba(212, 165, 116, 0.3);
  --accent-cafe: #c4a882;
  --accent-cafe-glow: rgba(196, 168, 130, 0.3);
  --price-color: #e8c547;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --top-bar-height: 3.25rem;
  --header-offset: calc(var(--top-bar-height) + env(safe-area-inset-top, 0px));
  --menu-header-height: 4.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Cairo", sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100dvh;
  padding-top: var(--header-offset);
}

/* ========== Top Bar & Language ========== */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.65rem 1rem;
  padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
  background: rgba(26, 20, 16, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transform: translateZ(0);
}

.lang-switcher {
  position: relative;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 50px;
}

.lang-btn {
  min-width: 44px;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 50px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent-restaurant);
  color: var(--bg-dark);
}

[dir="rtl"] .arrow-icon {
  transform: scaleX(-1);
}

.page {
  display: none;
  min-height: 100dvh;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ========== Landing Page ========== */

#landing-page {
  position: relative;
  padding: 1.5rem 1.25rem 2rem;
  align-items: center;
  justify-content: center;
}

.landing-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(212, 165, 116, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(196, 168, 130, 0.1) 0%, transparent 50%),
    var(--bg-dark);
  z-index: -1;
}

.landing-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.welcome-text {
  font-size: 0.9rem;
  color: var(--accent-restaurant);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.main-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-restaurant));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.selection-cards {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.animate-in {
  animation: slideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--delay, 0s);
}

.selection-card {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    border-color var(--transition),
    box-shadow var(--transition);
  text-align: center;
  font-family: inherit;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: cardEnter 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cafe-card {
  --delay: 0.1s;
  --card-accent: var(--accent-cafe);
  animation-delay: var(--delay);
}

.restaurant-card {
  --delay: 0.25s;
  --card-accent: var(--accent-restaurant);
  animation-delay: var(--delay);
}

@keyframes slideUp {
  from {
    opacity: 0.4;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0.4;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes ringPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.85;
  }
}

@keyframes shimmerText {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

@keyframes bounceArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes shineSweep {
  0% { transform: translateX(-120%) skewX(-20deg); }
  100% { transform: translateX(220%) skewX(-20deg); }
}

.selection-card:hover,
.selection-card:focus-visible {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--card-accent);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--card-accent) 30%, transparent);
  outline: none;
}

.selection-card:active,
.selection-card.is-pressed {
  transform: translateY(-2px) scale(0.98);
}

.selection-card.is-selected {
  animation: cardSelect 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}

@keyframes cardSelect {
  to {
    opacity: 0;
    transform: scale(1.05);
  }
}

.card-shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.card-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: translateX(-120%) skewX(-20deg);
}

.selection-card:hover .card-shine::after,
.selection-card:focus-visible .card-shine::after {
  animation: shineSweep 0.9s ease;
}

.venue-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.25rem;
}

.restaurant-card .venue-badge {
  color: var(--accent-restaurant);
}

.cafe-card .venue-badge {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.logo-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.logo-ring::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  border: 2px solid var(--card-accent, var(--accent-restaurant));
  opacity: 0.35;
  animation: ringPulse 2.5s ease-in-out infinite;
}

.restaurant-ring::before {
  border-radius: var(--radius-md);
}

.cafe-ring::before {
  border-radius: var(--radius-md);
}

.logo-ring .logo-wrapper {
  animation: logoFloat 3s ease-in-out infinite;
  margin-bottom: 0;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: color-mix(in srgb, var(--card-accent, #fff) 35%, transparent);
  animation: rippleExpand 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 1;
}

@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.shimmer-restaurant {
  background: linear-gradient(
    90deg,
    var(--text-primary) 0%,
    var(--accent-restaurant) 40%,
    #fff 50%,
    var(--accent-restaurant) 60%,
    var(--text-primary) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 4s linear infinite;
}

.shimmer-cafe {
  background: linear-gradient(
    90deg,
    #fff 0%,
    #ccc 40%,
    #fff 50%,
    #aaa 60%,
    #fff 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 4s linear infinite;
}

.tap-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-top: 0.25rem;
  transition: opacity var(--transition), color var(--transition);
}

.selection-card:hover .tap-hint,
.selection-card:focus-visible .tap-hint {
  opacity: 1;
  color: var(--card-accent);
}

.bounce-arrow {
  animation: bounceArrow 1.2s ease-in-out infinite;
}

[dir="rtl"] .bounce-arrow {
  animation-name: bounceArrowRtl;
}

@keyframes bounceArrowRtl {
  0%, 100% { transform: scaleX(-1) translateX(0); }
  50% { transform: scaleX(-1) translateX(4px); }
}

#landing-page.is-leaving {
  animation: landingLeave 0.4s ease forwards;
}

#menu-page.is-entering {
  animation: menuEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes landingLeave {
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes menuEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-glow {
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.selection-card:hover .card-glow {
  opacity: 1;
}

.restaurant-glow {
  background: var(--accent-restaurant-glow);
}

.cafe-glow {
  background: var(--accent-cafe-glow);
}

.card-content {
  position: relative;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.logo-wrapper {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  border: 2px solid var(--border-subtle);
}

.venue-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.restaurant-logo-wrapper {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-md);
  background: #f5f0e8;
  border: none;
  padding: 0.5rem;
}

.restaurant-logo-img {
  width: 100%;
  height: 100%;
}

.menu-header-logo.restaurant-logo-img {
  border-radius: var(--radius-sm);
  background: #f5f0e8;
  padding: 2px;
  object-fit: contain;
}

.cafe-logo-wrapper {
  width: 160px;
  height: 100px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1rem;
}

.cafe-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.menu-header-logo.cafe-logo-img {
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 4px 8px;
  object-fit: contain;
}

.venue-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.venue-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition);
}

.selection-card:hover .enter-btn {
  background: color-mix(in srgb, var(--card-accent) 25%, transparent);
  color: var(--text-primary);
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.selection-card[hidden],
.divider[hidden] {
  display: none !important;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.menu-load-error {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(180, 40, 40, 0.15);
  border: 1px solid rgba(255, 120, 120, 0.35);
  color: #ffb4b4;
  font-size: 0.9rem;
  text-align: center;
}

.landing-footer {
  margin-top: 2.5rem;
  text-align: center;
}

.landing-footer p {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ========== Menu Page ========== */

#menu-page {
  padding-bottom: 2rem;
}

.menu-header {
  position: sticky;
  top: var(--header-offset);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(26, 20, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.back-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}

.back-btn:hover,
.back-btn:focus-visible {
  background: var(--bg-card-hover);
  outline: none;
}

.back-btn:active {
  transform: scale(0.95);
}

.menu-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.menu-header-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  flex-shrink: 0;
}

.menu-title {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Categories Navigation */
.categories-nav {
  position: sticky;
  top: calc(var(--header-offset) + var(--menu-header-height));
  z-index: 90;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: rgba(26, 20, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.category-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 50px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.category-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.category-tab.active {
  background: var(--accent-restaurant);
  color: var(--bg-dark);
  border-color: var(--accent-restaurant);
}

#menu-page.cafe-theme .category-tab.active {
  background: var(--accent-cafe);
  border-color: var(--accent-cafe);
}

.category-icon {
  font-size: 1rem;
}

/* Menu Content */
.menu-content {
  padding: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.category-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.category-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-card {
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.product-image-wrapper {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  position: relative;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-info {
  flex: 1;
  padding-block: 0.85rem;
  padding-inline-end: 0.85rem;
  padding-inline-start: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.product-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.product-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--price-color);
}

.product-sizes-block {
  margin-top: 0.25rem;
}

.product-sizes {
  display: grid;
  grid-template-columns: repeat(var(--size-count, 3), minmax(0, 1fr));
  gap: 0.35rem;
}

.size-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.2rem;
  padding: 0.4rem 0.2rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  min-width: 0;
  text-align: center;
}

.size-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
  min-width: 0;
}

.size-abbr {
  display: inline;
}

.size-full {
  display: none;
}

.size-sep {
  color: var(--text-secondary);
  opacity: 0.5;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.size-price {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--price-color);
  line-height: 1.2;
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
}

.size-price .currency {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-secondary);
}

@media (min-width: 420px) {
  .size-abbr {
    display: none;
  }

  .size-full {
    display: inline;
  }

  .size-row {
    padding: 0.4rem 0.45rem;
    gap: 0.3rem;
  }

  .size-name {
    font-size: 0.72rem;
  }

  .size-price {
    font-size: 0.78rem;
  }

  .size-price .currency {
    font-size: 0.62rem;
  }
}

.product-price .currency {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ========== Responsive ========== */

@media (min-width: 768px) {
  .selection-cards {
    max-width: 480px;
  }

  .card-content {
    padding: 2.5rem 2rem;
  }

  .logo-wrapper {
    width: 110px;
    height: 110px;
  }

  .restaurant-logo-wrapper {
    width: 160px;
    height: 160px;
  }

  .cafe-logo-wrapper {
    width: 180px;
    height: 110px;
  }

  .venue-logo {
    width: 85px;
    height: 85px;
  }

  .venue-name {
    font-size: 1.75rem;
  }

  .menu-content {
    max-width: 700px;
    padding: 1.5rem;
  }

  .product-image-wrapper {
    width: 130px;
    height: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
