/*
 * The header's «مدل‌های هوش مصنوعی» menu (resources/views/default/home/partials/header.blade.php,
 * App\Support\ModelsMenu). Desktop: a mega menu with four tabs. Phone: two pages inside the
 * drawer, like the app's «چی بسازیم؟». Colours come from the home theme's own tokens.
 */
:root {
  --mm-new: #3fe0e9;
  --mm-new-bg: #3fe0e91c;
  --mm-hot: #ffb15c;
  --mm-hot-bg: #ff8a1f1f;
  --mm-off: #47d6a1;
  --mm-off-bg: #24a87a24;
  --mm-feat: #c49aff;
  --mm-feat-bg: #864ffe26;
  --mm-ease: cubic-bezier(.2, .8, .2, 1);
}
[data-theme=light] {
  --mm-new: #00788a;
  --mm-new-bg: #00cae014;
  --mm-hot: #b4570a;
  --mm-hot-bg: #db8b0a17;
  --mm-off: #137a55;
  --mm-off-bg: #24a87a17;
  --mm-feat: #6222d8;
  --mm-feat-bg: #864ffe14;
}

/* ---------- Desktop ---------- */
.mm-mega { width: min(780px, calc(100vw - 120px)); }
.mm-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; padding: 12px; }
.mm-tabs { display: flex; flex-direction: column; gap: 4px; padding-inline-end: 12px; border-inline-end: 1px solid var(--stroke); }
.mm-tab,
.mm-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer;
  transition: background .18s var(--mm-ease), border-color .18s var(--mm-ease), color .12s;
}
.mm-tab:hover { background: var(--panel-2); }
.mm-tab[aria-selected=true] { background: #864ffe1e; border-color: #864ffe31; }
.mm-tab[aria-selected=true] .mm-tab-text strong { color: var(--purple-soft); }
.mm-tab:focus-visible,
.mm-row:focus-visible,
.mm-item:focus-visible,
.mm-back:focus-visible,
.mm-m-open:focus-visible { outline: 2px solid var(--focus, var(--purple-soft)); outline-offset: 2px; }
.mm-tab-icon {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: #864ffe1f; color: var(--purple-soft); font-size: 15px;
}
.mm-tab-text { min-width: 0; flex: 1; }
.mm-tab-text strong { display: block; font-size: 13px; line-height: 1.5; }
.mm-tab-text small { display: block; font-size: 11px; line-height: 1.6; color: var(--muted); }
.mm-count {
  flex: none; min-width: 24px; padding: 1px 7px; border-radius: 999px;
  background: var(--panel-3); color: var(--muted); font-size: 11px; line-height: 1.8; text-align: center;
}
.mm-panel[hidden] { display: none; }
.mm-panel { max-height: min(460px, calc(100vh - 210px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }

.mm-item {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 7px 8px; border-radius: 11px; color: var(--text) !important;
  transition: background .18s var(--mm-ease);
}
.mm-item:hover { background: var(--panel-2); }
.mm-thumb {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: 10px; background: var(--panel-3); color: var(--text);
}
.mm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mm-thumb .mm-mark { width: 20px; height: 20px; }
.mm-thumb--video { background: #00cae01a; }
.mm-thumb--audio { background: #ff8a1f17; }
.mm-thumb--image { background: #864ffe1a; }
.mm-initial { font-weight: 800; font-size: 15px; color: var(--purple-soft); }
.mm-text { min-width: 0; flex: 1; }
.mm-text strong { display: block; font-size: 13px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Dana draws ASCII digits as Persian ones: «GPT-6.1» would read «GPT-۶.۱». */
.mm-text bdi { font-family: "hn-latin-digits", Dana, system-ui, sans-serif; }
.mm-text small { display: block; font-size: 11px; line-height: 1.6; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mm-badge {
  flex: none; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.7; white-space: nowrap;
}
.mm-badge[hidden] { display: none; }
.mm-badge--new { color: var(--mm-new); background: var(--mm-new-bg); }
.mm-badge--hot { color: var(--mm-hot); background: var(--mm-hot-bg); }
.mm-badge--discount { color: var(--mm-off); background: var(--mm-off-bg); }
.mm-badge--featured { color: var(--mm-feat); background: var(--mm-feat-bg); }

.mm-footer { align-items: center; }
.mm-legend { font-size: 11px; color: var(--muted); }

/* ---------- Phone drawer: two pages ---------- */
.mm-m-open {
  width: 100%; display: flex; align-items: center; gap: 11px; margin-bottom: 8px;
  padding: 12px 10px; border: 1px solid #864ffe31; border-radius: 14px;
  background: #864ffe14; color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.mm-m-open > span:nth-child(2) { flex: 1; min-width: 0; }
.mm-m-open strong { display: block; font-size: 14px; line-height: 1.5; }
.mm-m-open small { display: block; font-size: 11px; line-height: 1.6; color: var(--muted); }
.mm-chev { flex: none; color: var(--muted); }
[dir=ltr] .mm-chev, [dir=ltr] .mm-back svg { transform: scaleX(-1); }

.mm-pages[hidden], .mm-page[hidden] { display: none; }
.mobile-menu.mm-paged > :not(.mm-pages) { display: none; }
.mm-page { animation: mmPageIn .24s var(--mm-ease) both; }
.mm-page.mm-back-in { animation-name: mmPageBack; }
@keyframes mmPageIn { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes mmPageBack { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
[dir=ltr] .mm-page { animation-name: mmPageBack; }

.mm-page-head {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 12px; margin-bottom: 8px; border-bottom: 1px solid var(--stroke);
}
.mm-page-head strong { font-size: 17px; line-height: 1.5; }
.mm-back {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--stroke); border-radius: 12px; background: var(--panel-2);
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer;
}
.mm-back:hover { border-color: var(--purple); }
.mm-row { min-height: 56px; margin-bottom: 4px; }
.mm-row:hover { background: var(--panel-2); }
.mm-list { display: flex; flex-direction: column; gap: 2px; }
.mm-list .mm-item { min-height: 56px; padding: 8px 6px; border-bottom: 1px solid var(--stroke); border-radius: 0; font-size: inherit; }
.mm-list .mm-item:last-child { border-bottom: 0; }
.mobile-menu .mm-list .mm-item { color: var(--text); }

@media (min-width: 1121px) {
  .mm-m-open, .mm-pages { display: none !important; }
}
.mm-t-short { display: none; }
@media (max-width: 1279px) and (min-width: 1121px) {
  .mm-t-long { display: none; }
  .mm-t-short { display: inline; }
}
/* The models menu takes the room of two links the side rail already has. */
@media (max-width: 1439px) and (min-width: 1121px) {
  .header-nav:has(.nav-models) .nav-gallery,
  .header-nav:has(.nav-models) .nav-blog { display: none; }
}
@media (max-width: 1320px) and (min-width: 1121px) {
  .mm-mega { width: min(700px, calc(100vw - 80px)); }
  .mm-body { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .mm-page { animation: none; }
  .mm-tab, .mm-row, .mm-item { transition: none; }
}
