/* ========================================================
   E-007c — Cabinet menu history: view + restore + today selector
   ======================================================== */

/* ---- Чипы выбора активного меню на сегодня (если их несколько) ---- */
.today-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 10px 14px;
  background: var(--pink-50);
  border: 1px solid var(--pink-200);
  border-radius: 12px;
  align-items: center;
}
.today-options-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 4px;
}
.today-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition: all .15s ease;
}
.today-option:hover {
  border-color: var(--pink-accent);
  color: var(--ink);
}
.today-option.is-active {
  background: var(--pink-accent);
  color: #fff;
  border-color: var(--pink-accent);
  font-weight: 600;
}

/* ---- Кнопки в строках истории ---- */
.history-actions {
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}
.history-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--pink-50);
  border: 1px solid var(--pink-200);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pink-accent-hover);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background-color .15s ease;
}
.history-action-btn:hover {
  background: var(--pink-100);
  border-color: var(--pink-accent);
}
.history-action-btn.is-restore {
  background: transparent;
}

/* ---- Модалка просмотра меню из истории ---- */
.history-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(26, 22, 24, 0.78);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: hmFadeIn .25s ease;
}
.history-modal.is-open { display: flex; }
@keyframes hmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.history-modal-card {
  background: #fff;
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  margin: 24px auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  overflow: hidden;
  animation: hmCardIn .3s cubic-bezier(.22,.61,.36,1);
}
@keyframes hmCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.history-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #FFE4EC, #FFF0F5);
}
.history-modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.history-modal-head .hm-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-muted);
}
.history-modal-close {
  background: rgba(0,0,0,0.05);
  border: none;
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
  flex-shrink: 0;
}
.history-modal-close:hover { background: rgba(0,0,0,0.12); }

.history-modal-body {
  padding: 18px 22px;
  max-height: 65vh;
  overflow-y: auto;
}
.hm-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.hm-image-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--pink-50);
  cursor: zoom-in;
}
.hm-image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hm-image-tile-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,0.65), transparent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.hm-text {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink);
  margin: 0;
  padding: 14px;
  background: rgba(255, 244, 248, 0.45);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.hm-text strong { color: var(--ink); font-weight: 700; }

.history-modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
  flex-wrap: wrap;
}
.history-modal-foot .hm-foot-info {
  font-size: 12px;
  color: var(--ink-faint);
}
.history-modal-foot .hm-restore {
  padding: 10px 18px;
  background: var(--pink-accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background-color .15s ease;
}
.history-modal-foot .hm-restore:hover { background: var(--pink-accent-hover); }
.history-modal-foot .hm-restore form {
  display: contents;
}

/* ---- Lightbox для картинок (используется .hm-image-tile -> opens .dish-lightbox) ---- */
.dish-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dish-lightbox.is-open { display: flex; }
.dish-lightbox img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.5);
}
.dish-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease;
}
.dish-lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .history-modal-head h3 { font-size: 16px; }
  .history-modal-body { padding: 14px 16px; }
  .hm-images { grid-template-columns: repeat(2, 1fr); }
  .history-modal-foot { padding: 12px 16px; }
  .today-options { flex-direction: column; align-items: stretch; }
  .today-option { justify-content: center; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .history-modal { animation: none; }
  .history-modal-card { animation: none; }
}

/* ========================================================
   E-007e — Кнопка «Полный текст» + форматированный контент модалки
   ======================================================== */

/* Правый блок в .section-head: мета + кнопка */
.section-head-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Кнопка "Полный текст" в шапке секции «Меню на сегодня» */
.menu-full-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--pink-50);
  border: 1px solid var(--pink-200);
  border-radius: 999px;
  color: var(--pink-accent-hover);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}
.menu-full-btn:hover {
  background: var(--pink-100);
  border-color: var(--pink-accent);
}
.menu-full-btn .mfb-ico { font-size: 15px; line-height: 1; }

/* Контейнер отформатированного текста внутри модалки */
.mt-content {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  /* Контейнер может быть <pre> — перебиваем white-space, чтобы текст переносился */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.mt-content > *:first-child { margin-top: 0; }
.mt-content > *:last-child { margin-bottom: 0; }

/* Все внутренние элементы — аккуратный перенос, без горизонтального скролла */
.mt-content p,
.mt-content li,
.mt-content h3,
.mt-content h4,
.mt-content h5 {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  max-width: 100%;
}

/* Модалка в fulltext-режиме: запрещаем горизонтальный скролл в боди */
.history-modal.is-fulltext .history-modal-body { overflow-x: hidden; }

.mt-content p {
  margin: 10px 0;
  color: var(--ink);
}
.mt-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pink-200) 20%, var(--pink-200) 80%, transparent);
  margin: 20px 0;
}

.mt-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  padding: 10px 14px;
  background: linear-gradient(135deg, #FFE4EC, #FFF0F5);
  border-radius: 12px;
  border-left: 4px solid var(--pink-accent);
}
.mt-heading-emoji {
  font-size: 22px;
  line-height: 1;
}

.mt-dish-name {
  margin: 14px 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.mt-subheading {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pink-accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.mt-subsub {
  margin: 12px 0 6px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.mt-macros {
  display: inline-block;
  margin: 14px 0 6px;
  padding: 6px 12px;
  background: var(--pink-100);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pink-accent-hover);
  letter-spacing: 0.2px;
}

.mt-content ul.mt-list,
.mt-content ol.mt-ol {
  margin: 8px 0 12px;
  padding-left: 22px;
}
.mt-content ul.mt-list li,
.mt-content ol.mt-ol li {
  margin: 4px 0;
  padding-left: 2px;
}
.mt-content ul.mt-list li::marker { color: var(--pink-accent); font-size: 1.1em; }
.mt-content ol.mt-ol li::marker  { color: var(--pink-accent); font-weight: 700; }

/* Вложенные списки */
.mt-content ul.mt-list ul,
.mt-content ol.mt-ol ul,
.mt-content ul.mt-list ol,
.mt-content ol.mt-ol ol {
  margin: 4px 0 4px;
  padding-left: 20px;
}

.mt-content strong { font-weight: 700; color: var(--ink); }

/* Модалка полного текста — переиспользует .history-modal, размер побольше */
.history-modal.is-fulltext .history-modal-card { max-width: 860px; }
.history-modal.is-fulltext .history-modal-body { max-height: 75vh; padding: 22px 28px; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .menu-full-btn { padding: 7px 12px; font-size: 12px; }
  .mt-content { font-size: 14px; }
  .mt-heading { font-size: 17px; padding: 8px 12px; }
  .mt-heading-emoji { font-size: 19px; }
  .mt-dish-name { font-size: 15px; }
  .mt-subheading { font-size: 12px; }
  .mt-subsub { font-size: 12px; }
  .mt-macros { font-size: 12px; }
  .mt-content ul.mt-list, .mt-content ol.mt-ol { padding-left: 20px; }
  .history-modal.is-fulltext .history-modal-body { padding: 16px 18px; max-height: 82vh; }
}

