/* Final overrides for the mobile summary sheet and footer separation. */

/* `overflow-x: clip` instead of `hidden` so the page keeps a single scroll
   container (hidden on html+body creates a second one and makes scrolling
   jump/stick on mobile, and breaks position:sticky). */
html, body {
  overflow-x: clip;
  max-width: 100%;
}

/* The warning is visual only; it must never block the shared header links. */
#mixToast {
  pointer-events: none !important;
}

/* The two decorative blobs used `position:fixed` + `filter:blur(80px)`, which
   forces a full-screen repaint of a blurred layer on every scroll frame. A
   pre-blurred radial gradient looks the same and costs nothing. */
.mix-bg-blob {
  filter: none !important;
  opacity: 1 !important;
  background: transparent !important;
  will-change: auto;
}

.mix-blob-top {
  background-image: radial-gradient(circle closest-side, var(--mix-primary-light), transparent 100%) !important;
}

.mix-blob-bottom {
  display: none !important;
}

/* Radios are visually hidden; keep them 1px so clicking a card can't make the
   browser scroll the focused input into view. */
.mix-box-card-label,
.mix-group-tabs label {
  position: relative;
}

.mix-box-radio,
.mix-group-tabs input[type="radio"] {
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
  inset: auto auto 0 0 !important;
  pointer-events: none;
}

.mix-summary-sidebar {
  z-index: 30;
}

.mix-summary-card {
  position: relative;
  z-index: 3;
  border: 1px solid rgba(234, 243, 228, .25);
  box-shadow: 0 28px 65px rgba(18, 31, 15, .5), 0 0 0 3px rgba(155, 197, 130, .32);
}

.mix-close-summary {
  display: none !important;
}

.mix-mobile-cart-toggle > i.fa-chevron-up,
.mix-mobile-cart-toggle > .fa-chevron-up {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mix-mobile-cart-toggle[aria-expanded="true"] > i.fa-chevron-up,
.mix-mobile-cart-toggle[aria-expanded="true"] > .fa-chevron-up,
body.mix-sheet-open .mix-mobile-cart-toggle > i.fa-chevron-up,
body.mix-sheet-open .mix-mobile-cart-toggle > .fa-chevron-up {
  transform: rotate(180deg);
}

.mix-selected-line {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 9px;
}

.mix-selected-line img {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
  background: #eaf3e4;
}

.mix-remove-item {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: #d8ebce;
  cursor: pointer;
}

.mix-remove-item:hover {
  background: #a8cb96;
  color: #20371b;
}

.mix-box-selector {
  margin-top: 0;
  margin-bottom: 24px;
}

.mix-box-selector h2 {
  margin-bottom: 12px;
}

/*
 * A horizontal scroll carousel here used to clip the first card (e.g. "شیرینی خشک")
 * outside the visible box because it's wider than the row of items, and browsers
 * disagree on how `scrollLeft` works inside a `dir="rtl"` scroll container, which made
 * the clipped part unreachable in some browsers. Since there are only ever a handful
 * of boxes/groups, wrapping them instead of scrolling avoids that whole class of bug.
 */
.mix-box-grid {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 4px 2px 12px;
}

.mix-group-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 4px 2px 12px;
}

.mix-group-tabs label {
  flex: 0 0 clamp(140px, 42vw, 210px);
  width: clamp(140px, 42vw, 210px);
  max-width: 100%;
}

.mix-group-tabs label > span {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 3px solid var(--mix-border);
  border-radius: 22px;
  background: var(--mix-card);
  box-shadow: var(--mix-shadow);
  text-align: center;
  cursor: pointer;
}

.mix-group-tabs label > span img,
.mix-group-tabs label > span i {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  object-fit: cover;
  background: var(--mix-primary-light);
  color: var(--mix-primary-hover);
  font-size: 2rem;
}

.mix-group-tabs input:checked + span {
  border-color: var(--mix-primary-hover);
  background: var(--mix-primary-light);
}

/* A tab that can't be combined with what is already in the box: still clickable,
   but switching to it empties the box. */
.mix-group-tabs label.mix-group-locked > span {
  opacity: .72;
  border-style: dashed;
}

.mix-group-hint {
  margin: 0 0 10px;
  text-align: center;
  font-size: .82rem;
  color: var(--mix-muted, #6a7a63);
}

.mix-box-card-label {
  flex: 0 0 clamp(140px, 42vw, 230px);
  max-width: 100%;
}

.mix-box-card {
  min-height: 138px !important;
  border-radius: 22px !important;
  padding: 14px 12px !important;
  gap: 5px !important;
}

.mix-box-card .mix-box-icon,
.mix-box-icon {
  width: 52px !important;
  height: 52px !important;
  font-size: 2rem !important;
  margin-bottom: 0 !important;
}

.mix-box-card h3 {
  margin: 0;
  font-size: .95rem !important;
}

.mix-box-card span,
.mix-box-card small {
  font-size: .74rem !important;
  line-height: 1.5;
}

#mixForm[hidden],
#mixMobileToggle[hidden],
.mix-ai-entry[hidden],
.mix-ai-chat[hidden],
.mix-ai-reopen[hidden],
.mix-ai-result[hidden] {
  display: none !important;
}

.mix-ai-entry {
  display: flex;
  justify-content: center;
  padding: 12px 0 28px;
}

.mix-ai-entry .mix-ai-button {
  grid-column: auto;
  width: min(100%, 430px);
  min-height: 66px;
  padding: 14px 22px;
  border-radius: 20px;
  font-size: 1.05rem;
  box-shadow: 0 14px 34px rgba(42, 59, 36, .18);
}

.mix-ai-chat {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 31, 15, .58);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity .24s ease, visibility .24s ease;
  visibility: hidden;
}

.mix-ai-chat.is-open {
  opacity: 1;
  visibility: visible;
}

.mix-ai-chat.is-closing {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
}

.mix-ai-chat-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 620px);
  height: min(760px, calc(100dvh - 36px));
  padding: 22px;
  border: 1px solid var(--mix-primary-border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 26px 90px rgba(18, 31, 15, .32);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .24s ease, transform .24s cubic-bezier(.2, .75, .25, 1);
}

.mix-ai-chat.is-open .mix-ai-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.mix-ai-chat.is-closing .mix-ai-chat-panel {
  opacity: 0;
  transform: translateY(12px) scale(.98);
}

.mix-ai-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mix-border);
}

.mix-ai-chat-header h2 {
  margin: 8px 0 0;
  color: var(--mix-dark);
  font: 1.4rem/1.5 Lalezar, cursive;
}

.mix-ai-chat-header > button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--mix-primary-light);
  color: var(--mix-dark);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}

.mix-ai-chat-header > button:hover {
  background: var(--mix-primary-border);
  transform: rotate(90deg);
}

.mix-ai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px 4px;
}

.mix-ai-message {
  max-width: 88%;
  margin: 0;
  padding: 11px 15px;
  border-radius: 18px;
  color: var(--mix-dark);
  line-height: 1.8;
  overflow-wrap: anywhere;
  animation: mix-ai-message-in .24s ease both;
}

.mix-ai-message-assistant {
  align-self: flex-start;
  border-bottom-right-radius: 5px;
  background: var(--mix-primary-light);
}

.mix-ai-message-user {
  align-self: flex-end;
  border-bottom-left-radius: 5px;
  background: var(--mix-dark);
  color: #fff;
}

.mix-ai-apply {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  background: var(--mix-primary-hover);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
  animation: mix-ai-message-in .24s ease both;
}

.mix-ai-apply:hover:not(:disabled) {
  background: var(--mix-dark);
  transform: translateY(-1px);
}

.mix-ai-apply:disabled {
  opacity: .7;
  cursor: default;
}

.mix-ai-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--mix-border);
}

.mix-ai-chat-form textarea {
  min-width: 0;
  flex: 1;
  min-height: 48px;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--mix-primary-border);
  border-radius: 14px;
  padding: 11px 13px;
  color: var(--mix-dark);
  font: inherit;
  line-height: 1.7;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.mix-ai-chat-form textarea:focus {
  outline: 0;
  border-color: var(--mix-primary-hover);
  box-shadow: 0 0 0 3px rgba(126, 169, 102, .16);
}

.mix-ai-chat-form button {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 0;
  border-radius: 13px;
  background: var(--mix-dark);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}

.mix-ai-chat-form button:hover:not(:disabled) {
  background: var(--mix-primary-hover);
  transform: translateY(-1px);
}

@keyframes mix-ai-message-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mix-ai-chat-form button:disabled {
  opacity: .65;
  cursor: wait;
}

.mix-ai-status:not([hidden]) {
  margin-top: 10px;
  color: #9a3412;
}

.mix-ai-result {
  margin: 10px 0 24px;
  padding: 14px 18px;
  border: 1px solid var(--mix-primary-border);
  border-radius: 16px;
  background: var(--mix-primary-light);
  color: var(--mix-dark);
  line-height: 1.8;
}

.mix-ai-reopen {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 17px;
  border: 0;
  border-radius: 999px;
  background: var(--mix-dark);
  color: #fff;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(18, 31, 15, .25);
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 650px) {
  .mix-ai-entry {
    padding: 8px 0 24px;
  }

  .mix-ai-chat {
    align-items: flex-end;
    padding: 12px;
  }

  .mix-ai-chat-panel {
    width: 100%;
    height: min(720px, calc(100dvh - 24px));
    max-height: calc(100dvh - 24px);
    padding: 18px 15px max(15px, env(safe-area-inset-bottom));
    border-radius: 22px;
    transform: translateY(28px);
  }

  .mix-ai-chat.is-open .mix-ai-chat-panel {
    transform: translateY(0);
  }

  .mix-ai-chat.is-closing .mix-ai-chat-panel {
    transform: translateY(18px);
  }

  .mix-ai-chat-header h2 {
    font-size: 1.2rem;
  }

  .mix-ai-messages {
    gap: 10px;
    padding: 15px 2px;
  }

  .mix-ai-message {
    max-width: 94%;
    padding: 10px 13px;
    font-size: .94rem;
  }

  .mix-ai-chat-form {
    gap: 8px;
  }

  .mix-ai-chat-form button {
    padding: 0 12px;
  }

  .mix-ai-reopen {
    right: 12px;
    bottom: 12px;
  }

  @media (prefers-reduced-motion: reduce) {
    .mix-ai-chat,
    .mix-ai-chat-panel,
    .mix-ai-message,
    .mix-ai-apply,
    .mix-ai-chat-header > button,
    .mix-ai-chat-form button,
    .mix-ai-chat-form textarea {
      animation-duration: .01ms !important;
      transition-duration: .01ms !important;
    }
  }
}

@media (max-width: 850px) {
  .mix-type-selector .mix-group-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center;
    width: 100%;
    max-width: 100%;
  }

  .mix-builder {
    padding-bottom: 180px;
  }

  .mix-summary-sidebar {
    position: fixed !important;
    inset: 0 !important;
    display: block;
    z-index: 1001 !important;
    padding: 18px 10px 86px;
    background: rgba(18, 31, 15, .72);
    backdrop-filter: blur(5px);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .mix-summary-sidebar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .mix-summary-sidebar.mobile-open {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .mix-summary-card {
    width: min(100%, 520px);
    margin: 0 auto;
    border-radius: 28px;
    box-shadow: 0 28px 70px rgba(8, 15, 6, .65), 0 0 0 2px rgba(155, 197, 130, .4);
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .mix-summary-card::-webkit-scrollbar,
  .mix-selected-items::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .mix-mobile-cart-toggle {
    z-index: 1002 !important;
    box-shadow: 0 -8px 28px rgba(18, 31, 15, .45), 0 0 0 2px rgba(155, 197, 130, .35);
  }
}
