/* Тема: светлая по умолчанию, тёмная — [data-theme="dark"] на <html> */

:root {
  --app-bg: #faf8f5;
  --header-bg: rgba(255, 255, 255, 0.95);
  --card-bg: #ffffff;
  --text-primary: #2c3e2f;
  --text-body: #555555;
  --text-muted: #888888;
  --text-faint: #999999;
  --accent: #2c7a4d;
  --accent-hover: #1a4730;
  --accent-soft: rgba(44, 122, 77, 0.12);
  --border: #eeeeee;
  --border-strong: #dddddd;
  --ingredient-bg: #f0ebe4;
  --ingredient-text: #4a4a4a;
  --note-bg: #fdf8ed;
  --note-border: #e6a017;
  --note-text: #886c32;
  --note-text-soft: #a08858;
  --gradient-image-bg: linear-gradient(135deg, #f5f0e8 0%, #e8e0d5 100%);
  --shadow-card: rgba(0, 0, 0, 0.06);
  --shadow-float: rgba(0, 0, 0, 0.15);
  --shadow-modal: rgba(0, 0, 0, 0.2);
  --overlay-scrim: rgba(0, 0, 0, 0.5);
  --modal-bg: #ffffff;
  --modal-text: #1a1a1a;
  --modal-muted: #666666;
  --pill-inactive-bg: #f3f4f6;
  --pill-inactive-text: #2c3e2f;
  --footer-line: #dddddd;
  --detail-footer-muted: #bbbbbb;
  --waiter-nav-border: rgba(44, 122, 77, 0.45);
}

[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #0f1412;
  --header-bg: rgba(15, 20, 18, 0.94);
  --card-bg: #1a2220;
  --text-primary: #e8f0ec;
  --text-body: #b8c8be;
  --text-muted: #8a9a90;
  --text-faint: #6d7c74;
  --accent: #4ade80;
  --accent-hover: #6ee7a0;
  --accent-soft: rgba(74, 222, 128, 0.2);
  --border: #2a3530;
  --border-strong: #3d4d44;
  --ingredient-bg: #24302a;
  --ingredient-text: #c5d4cc;
  --note-bg: #1e2319;
  --note-border: #c9a227;
  --note-text: #d4c9a8;
  --note-text-soft: #a89b78;
  --gradient-image-bg: linear-gradient(135deg, #1c2622 0%, #141a18 100%);
  --shadow-card: rgba(0, 0, 0, 0.35);
  --shadow-float: rgba(0, 0, 0, 0.45);
  --shadow-modal: rgba(0, 0, 0, 0.5);
  --overlay-scrim: rgba(0, 0, 0, 0.65);
  --modal-bg: #1a2220;
  --modal-text: #e8f0ec;
  --modal-muted: #9aada3;
  --pill-inactive-bg: #2a3530;
  --pill-inactive-text: #d8e4dc;
  --footer-line: #3d4d44;
  --detail-footer-muted: #6d7c74;
  --waiter-nav-border: rgba(74, 222, 128, 0.45);
}

body {
  background: var(--app-bg);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Шапка меню */
.menu-sticky-header {
  top: 0;
  z-index: 1020;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  padding-bottom: 0.5rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}

[data-theme="dark"] .menu-sticky-header {
  border-bottom-color: var(--border);
}

.menu-toolbar,
.product-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
}

.menu-toolbar {
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 0.65rem;
  padding: 0 4px;
}

.product-toolbar {
  margin-bottom: 1.25rem;
}

.product-toolbar .back-button {
  min-width: 0;
  flex: 1 1 auto;
}

.menu-brand-heading {
  margin: 0;
  padding: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.menu-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  padding: 2px 8px 0;
  max-width: 100%;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.menu-brand-logo {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.menu-brand-fallback {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.menu-brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Категории: неактивная пилюля */
.category-link.nav-link:not(.active-category) {
  background: var(--pill-inactive-bg) !important;
  color: var(--pill-inactive-text) !important;
}

.btn-waiter-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  min-width: 44px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  color: var(--accent) !important;
  border: 1px solid var(--waiter-nav-border) !important;
  background: var(--card-bg);
  box-shadow: 0 1px 8px var(--shadow-card);
  touch-action: manipulation;
}

.btn-waiter-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.btn-waiter-label {
  display: inline;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-waiter-nav:hover {
  color: #fff !important;
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* Модалка официанта */
.waiter-modal-shell {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 400px;
  margin: 0 auto;
  padding: 24px;
  z-index: 1050;
  text-align: center;
  border-radius: 24px;
  background: var(--modal-bg);
  color: var(--modal-text);
  box-shadow: 0 20px 40px var(--shadow-modal);
}

.waiter-modal-shell h3 {
  color: var(--modal-text);
  font-weight: bold;
  margin-bottom: 8px;
}

.waiter-modal-caption {
  color: var(--modal-muted);
  margin-bottom: 20px;
}

.waiter-modal-ok {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 40px;
  font-weight: bold;
  width: 100%;
  cursor: pointer;
}

.waiter-modal-ok:hover {
  filter: brightness(1.08);
}

.waiter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  z-index: 1040;
}

/* Переключатель темы (в шапке меню / рядом с «Назад» на карточке) */
.theme-toggle {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 1px 8px var(--shadow-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px var(--shadow-float);
}

.theme-toggle:active {
  transform: scale(0.97);
}

.theme-toggle .theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-icon-dark {
  display: inline;
}

form.lang-switcher {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.lang-picker {
  position: relative;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 52px;
  height: 44px;
  margin: 0;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--waiter-nav-border);
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 1px 8px var(--shadow-card);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  user-select: none;
}

.lang-trigger::-webkit-details-marker {
  display: none;
}

.lang-trigger::marker {
  content: "";
}

.lang-trigger-chevron {
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.lang-picker[open] .lang-trigger-chevron {
  transform: rotate(180deg);
}

.lang-dismiss {
  display: none;
}

.lang-sheet {
  display: none;
  z-index: 1090;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--modal-bg);
  box-shadow: 0 16px 40px var(--shadow-modal);
}

.lang-picker[open] .lang-sheet {
  display: block;
}

.lang-sheet-title {
  margin: 0 6px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lang-option {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--modal-text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.lang-option + .lang-option {
  margin-top: 2px;
}

.lang-option:hover,
.lang-option:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.lang-option.is-active {
  background: var(--accent-soft);
}

.lang-option-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: 999px;
  background: var(--pill-inactive-bg);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lang-option.is-active .lang-option-code {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .lang-option.is-active .lang-option-code {
  color: #0f1412;
}

.lang-option-name {
  font-size: 16px;
  font-weight: 600;
}

@media (max-width: 767.98px) {
  .lang-picker[open] .lang-dismiss {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1080;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--overlay-scrim);
    cursor: pointer;
  }

  .lang-picker[open] .lang-sheet {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 1090;
  }
}

@media (min-width: 768px) {
  .menu-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .menu-brand {
    flex: 1 1 auto;
    justify-content: flex-start;
    padding: 0;
    font-size: 1.35rem;
    text-align: left;
  }

  .menu-brand-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  .menu-toolbar-actions {
    justify-content: flex-end;
  }

  .lang-picker[open] .lang-sheet {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: 220px;
  }
}

.waiter-call-button.is-busy,
.btn-waiter-nav:disabled {
  opacity: 0.7;
  pointer-events: none;
}

.card-add-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  box-shadow: 0 6px 16px var(--shadow-float);
  touch-action: manipulation;
}

[data-theme="dark"] .card-add-btn {
  color: #0f1412;
}

.product-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  touch-action: manipulation;
}

[data-theme="dark"] .product-add-btn {
  color: #0f1412;
}

.cart-fab {
  position: fixed;
  left: 16px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1031;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 8px 24px var(--shadow-float);
  font-size: 22px;
  touch-action: manipulation;
}

.cart-fab-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
}

[data-theme="dark"] .cart-fab-count {
  color: #0f1412;
}

.commerce-sheet {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 420px;
  margin: 0 auto;
  padding: 20px;
  z-index: 1051;
  border-radius: 24px;
  background: var(--modal-bg);
  color: var(--modal-text);
  box-shadow: 0 20px 40px var(--shadow-modal);
}

.commerce-sheet h3 {
  margin: 0 0 8px;
  font-weight: 700;
}

.commerce-muted {
  color: var(--modal-muted);
  font-size: 14px;
  margin: 0 0 12px;
}

.commerce-text-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--modal-muted);
  font-weight: 600;
  padding: 10px;
  touch-action: manipulation;
}

.cart-sheet-items {
  max-height: 40vh;
  overflow: auto;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.cart-line strong {
  display: block;
}

.cart-line span {
  font-size: 13px;
  color: var(--modal-muted);
}

.cart-line .commerce-text-btn {
  width: auto;
  margin: 0;
  font-size: 20px;
}

.cart-sheet-footer {
  margin-top: 12px;
}

.cart-sheet-total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.upsell-items {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.upsell-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--modal-text);
  text-align: left;
  touch-action: manipulation;
}

.upsell-pick img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--ingredient-bg);
}

.upsell-pick em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
}

.feedback-row {
  margin-bottom: 12px;
}

.feedback-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.feedback-scores {
  display: flex;
  gap: 8px;
}

.feedback-scores button {
  flex: 1;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  font-size: 24px;
  touch-action: manipulation;
}

.feedback-scores button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.feedback-entry {
  text-align: center;
  margin: 16px 0 0;
}

.product-image-wrapper {
  position: relative;
}
