/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #c0392b;
  --red-dark:   #96281b;
  --red-light:  #fdf0ee;
  --black:      #1a1a1a;
  --gray-800:   #2c2c2c;
  --gray-600:   #555555;
  --gray-400:   #999999;
  --gray-200:   #e8e8e8;
  --gray-100:   #f5f5f5;
  --white:      #ffffff;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.08);
  --shadow:     0 2px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.18);
  --font:       'Nunito', sans-serif;
  --transition: .15s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  box-shadow: 0 1px 0 var(--gray-200), var(--shadow-sm);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 8px;
  gap: 12px;
}

/* Logo */
.logo-wrap { flex: 1; min-width: 0; display: flex; align-items: center; }
.header-logo {
  height: 48px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

/* Header buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.header-btn:hover,
.header-btn:active { background: var(--gray-100); }

/* Language selector */
.lang-selector { position: relative; }

.lang-btn-inner {
  font-size: 13px;
  font-weight: 600;
}
.lang-flag { font-size: 18px; line-height: 1; }
.lang-code { color: var(--gray-600); font-size: 12px; font-weight: 600; }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  min-width: 148px;
  z-index: 500;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  color: var(--black);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.lang-option:hover { background: var(--red-light); color: var(--red); }
.lang-option.active { font-weight: 700; color: var(--red); }

/* Search bar — always visible below tabs */
#search-bar {
  padding: 0 12px 10px;
  border-top: 1px solid var(--gray-100);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 9px 12px;
  border: 1.5px solid transparent;
  transition: border var(--transition), background var(--transition);
}
.search-wrap:focus-within {
  border-color: var(--red);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(192,57,43,.08);
}
.search-wrap svg { color: var(--gray-400); flex-shrink: 0; }

#search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  font-family: var(--font);
  color: var(--black);
  outline: none;
  min-width: 0;
}
#search-input::placeholder { color: var(--gray-400); }

#search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
#search-clear:hover { color: var(--red); }

/* Category tabs */
#cat-nav { border-top: 1px solid var(--gray-100); }

#cat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 9px 12px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 30px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.cat-tab:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.cat-tab.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
  font-weight: 600;
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
#menu-content {
  padding: 0 16px 36px;
  max-width: 700px;
  margin: 0 auto;
  background: transparent;
}

/* Section */
.menu-section { margin-bottom: 8px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 0 10px;
  border-bottom: 2.5px solid var(--black);
  margin-bottom: 6px;
}
.section-icon { font-size: 24px; line-height: 1; }

.section-image {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  margin: 12px 0 16px;
  display: block;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.1;
}

/* Menu item card — flat, no background */
.menu-item {
  background: transparent;
  padding: 14px 0 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.menu-item.unavailable { opacity: .4; pointer-events: none; }

/* Name + price row */
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.item-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.35;
}

.item-price {
  font-size: 17px;
  font-weight: 700;
  color: var(--black);
  white-space: nowrap;
  flex-shrink: 0;
}
.item-price.no-price { color: var(--gray-400); font-size: 15px; font-weight: 400; }

/* Dotted divider — black */
.item-divider {
  border: none;
  border-top: 1.5px dotted #333333;
  margin: 8px 0 6px;
}

/* Weight + desc below divider */
.item-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-bottom: 12px;
}

.item-weight {
  font-size: 14px;
  color: #777777;
  font-weight: 400;
}

.item-desc {
  font-size: 14px;
  color: #777777;
  line-height: 1.5;
  font-weight: 400;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.allergen-label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

.allergen-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid;
  font-weight: 500;
  white-space: nowrap;
}
.allergen-gluten  { color: #8b4513; background: #fdf5ec; border-color: #f5cba7; }
.allergen-dairy   { color: #1a5276; background: #eaf2f8; border-color: #a9cce3; }
.allergen-eggs    { color: #7d6608; background: #fef9e7; border-color: #f9e79f; }
.allergen-nuts    { color: #5d4037; background: #efebe9; border-color: #bcaaa4; }
.allergen-sesame  { color: #6d4c00; background: #fff8e1; border-color: #ffe082; }
.allergen-fish    { color: #0d47a1; background: #e3f2fd; border-color: #90caf9; }
.allergen-soy     { color: #1b5e20; background: #e8f5e9; border-color: #a5d6a7; }

/* Legacy — kept for compat */
.item-body { flex: 1; min-width: 0; }
.item-right { display: none; }

/* No results */
#no-results {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-400);
  font-size: 16px;
}

/* ══════════════════════════════════════
   REVIEW TRIGGER BUTTON
══════════════════════════════════════ */
.review-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 30px;
  padding: 7px 13px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.review-trigger-btn:hover { background: var(--red-dark); }

/* ══════════════════════════════════════
   REVIEW MODAL
══════════════════════════════════════ */
.rv-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 520px) {
  .rv-overlay { align-items: center; }
}

.rv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}

.rv-box {
  position: relative;
  background: var(--white);
  width: 100%;
  max-width: 440px;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 520px) {
  .rv-box { border-radius: 20px; }
}

.rv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.rv-title {
  font-size: 18px;
  font-weight: 800;
}

.rv-close {
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  transition: background var(--transition);
  flex-shrink: 0;
}
.rv-close:hover { background: var(--gray-200); }

.rv-body {
  padding: 16px 20px 28px;
}

.rv-label {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Stars */
.rv-stars {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.rv-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 38px;
  color: var(--gray-200);
  line-height: 1;
  padding: 0 2px;
  transition: color .1s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.rv-star:hover,
.rv-star--hover   { color: #f39c12; transform: scale(1.1); }
.rv-star--selected { color: #f39c12; }

.rv-star-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 18px;
  min-height: 20px;
}

/* Field */
.rv-field { margin-bottom: 16px; }

.rv-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.rv-field-label span { text-transform: none; font-weight: 400; }

.rv-textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--black);
  resize: vertical;
  outline: none;
  transition: border var(--transition);
  min-height: 90px;
}
.rv-textarea:focus { border-color: var(--red); }

/* Error */
.rv-error {
  background: #fdecea;
  color: var(--red);
  font-size: 13px;
  border-radius: 8px;
  padding: 10px 13px;
  margin-bottom: 14px;
  font-weight: 600;
}

/* Submit */
.rv-submit-btn {
  width: 100%;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.rv-submit-btn:hover    { background: var(--red-dark); }
.rv-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Success */
.rv-success {
  text-align: center;
  padding: 40px 20px 48px;
}
.rv-success-icon { font-size: 52px; margin-bottom: 12px; }
.rv-success h3   { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.rv-success p    { font-size: 14px; color: var(--gray-600); }

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
#app-footer {
  background: var(--white);
  text-align: center;
  padding: 18px 16px;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 13px;
  line-height: 2;
}

.footer-badge {
  height: 56px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
  opacity: .85;
}

/* ══════════════════════════════════════
   RTL SUPPORT (Arabic)
══════════════════════════════════════ */
html[dir="rtl"] .header-actions { flex-direction: row-reverse; }
html[dir="rtl"] .lang-dropdown  { right: auto; left: 0; }
html[dir="rtl"] .item-right     { align-items: flex-start; }
html[dir="rtl"] #search-input   { text-align: right; }

/* ══════════════════════════════════════
   DESKTOP
══════════════════════════════════════ */
@media (min-width: 600px) {
  .header-top { padding: 14px 24px 10px; }
  #search-bar { padding: 0 20px 12px; }
  #cat-tabs   { padding: 9px 20px; }
  #menu-content { padding: 14px 24px 48px; }
  .logo-text { font-size: 19px; }
  .section-title { font-size: 24px; }
  .menu-item { padding: 16px 18px 14px; }
}
