/* Gruppo Mercati — paletul din comandă.
   Direcție: captura clientului + sistemul vizual existent; aceeași schemă de
   baxuri ca în onboarding, cu datele reale din calculatorul de paletizare.
   Mișcarea păstrează continuitatea la deschidere și se elimină la reduced motion. */

dialog.gm.gmp-dialog {
  --gmp-bg: var(--gm-ink, #00211C);
  --gmp-surface: var(--gm-dark-2, #062A23);
  --gmp-line: var(--gm-dark-line-2, #1E4B41);
  --gmp-text: var(--gm-on-dark-2, #DCEBE6);
  --gmp-muted: var(--gm-on-dark, #A9C2BA);
  --gmp-accent: var(--gm-orange, #DA4A0C);
  --gmp-focus: var(--gm-peach, #FFC9A8);
  box-sizing: border-box;
  width: min(560px, calc(100% - 32px));
  max-width: 560px;
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--gmp-line) var(--gmp-bg);
  border: 1px solid var(--gmp-line);
  border-radius: 24px;
  background: var(--gmp-bg);
  color: var(--gmp-text);
  box-shadow: 0 24px 80px rgb(0 0 0 / .32);
  color-scheme: dark;
  transform-origin: center;
}

dialog.gm.gmp-dialog:not([open]) { display: none; }
dialog.gm.gmp-dialog[open] { animation: gmp-open 220ms cubic-bezier(0, 0, .2, 1) both; }
dialog.gm.gmp-dialog::backdrop {
  background: rgb(0 14 11 / .62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: gmp-backdrop-in 200ms ease-out both;
}
dialog.gm.gmp-dialog.is-closing { animation: gmp-close 140ms ease-in both; }
dialog.gm.gmp-dialog.is-closing::backdrop { animation: gmp-backdrop-out 140ms ease-in both; }

.gmp-dialog .gmp-panel { padding: 24px; }
.gmp-dialog .gmp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.gmp-dialog .gmp-head > div { min-width: 0; }
.gmp-dialog .gmp-kicker {
  margin-bottom: 7px;
  font-family: var(--gm-mono, 'IBM Plex Mono', monospace);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: .1em;
  color: var(--gm-orange-light, #F47B42);
}
.gmp-dialog #gmp-title {
  margin: 0;
  font-size: clamp(27px, 5vw, 34px);
  line-height: 1.08;
  font-weight: 700 !important;
  letter-spacing: -.025em;
  color: #FFF;
  text-wrap: balance;
}
.gmp-dialog :is(button, a) { -webkit-tap-highlight-color: rgb(255 255 255 / .14); }
.gmp-dialog :is(button, a, summary):focus-visible {
  outline: 3px solid var(--gmp-focus);
  outline-offset: 4px;
}
.gmp-dialog .gmp-close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--gmp-line);
  border-radius: 50%;
  background: transparent;
  color: var(--gmp-text);
  line-height: 1;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.gmp-dialog .gmp-close:hover { background: var(--gmp-surface); border-color: var(--gmp-muted); }
.gmp-dialog .gmp-close svg { width: 20px; height: 20px; }
.gmp-dialog .gmp-status {
  margin: 14px 0 22px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--gmp-text);
  text-wrap: pretty;
}
.gmp-dialog .gmp-content { transition: opacity 160ms ease-out; }
.gmp-dialog .gmp-loading .gmp-content,
.gmp-dialog.gmp-loading .gmp-content { opacity: .45; }

/* A diagram of capacity, not a physical packing simulation. */
.gmp-dialog .gmp-pallet { width: 100%; max-width: 460px; margin-inline: auto; }
.gmp-dialog .gmp-pallet__meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.gmp-dialog .gmp-pallet__meta strong { font-size: 13px; line-height: 1.3; font-weight: 600; color: #FFF; }
.gmp-dialog .gmp-pallet__meta > span { font-family: var(--gm-mono, 'IBM Plex Mono', monospace); font-size: 11px; line-height: 1.4; color: var(--gmp-muted); text-align: right; }
.gmp-dialog .gmp-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  aspect-ratio: 2.08;
}
.gmp-dialog .gmp-cell {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgb(169 194 186 / .16);
  border-radius: 3px;
  background: rgb(255 255 255 / .025);
  color: #FFF;
  font-family: var(--gm-mono, 'IBM Plex Mono', monospace);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  text-shadow: 0 1px 2px rgb(0 0 0 / .55);
}
.gmp-dialog .gmp-cell__fill {
  position: absolute;
  z-index: -1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: var(--gmp-color, var(--gm-orange, #DA4A0C));
  color: var(--gm-ink, #00211C);
  font-style: normal;
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), inset 0 -2px 0 rgb(0 0 0 / .12);
  transform: scaleY(var(--gmp-fill, 0));
  transform-origin: center bottom;
}
.gmp-dialog .gmp-grid.is-filling .gmp-cell__fill,
.gmp-dialog .gmp-cell.is-filling .gmp-cell__fill,
.gmp-dialog .gmp-cell__fill.is-filling {
  animation: gmp-fill 300ms cubic-bezier(0, 0, .2, 1) both;
  animation-delay: clamp(0ms, var(--gmp-delay, 0ms), 160ms);
}
.gmp-dialog .gmp-deck {
  height: 10px;
  margin-top: 6px;
  border-top: 1px solid rgb(255 255 255 / .18);
  border-radius: 2px;
  background: var(--gm-wood, #B89366);
  box-shadow: inset 0 -3px 0 var(--gm-wood-dark, #8A6B47);
}
.gmp-dialog .gmp-feet { display: flex; justify-content: space-between; padding-inline: 8%; }
.gmp-dialog .gmp-feet > span {
  display: block;
  width: 14%;
  height: 9px;
  border-radius: 0 0 2px 2px;
  background: var(--gm-wood-dark, #8A6B47);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / .16);
}
.gmp-dialog .gmp-progress { height: 5px; margin: 21px 0 19px; overflow: hidden; border-radius: 5px; background: var(--gmp-line); }
.gmp-dialog .gmp-progress[hidden] { display: none; }
.gmp-dialog .gmp-progress > i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--gmp-accent);
  transform: scaleX(var(--gmp-progress, 0));
  transform-origin: left center;
  transition: transform 220ms ease-out;
}
.gmp-dialog .gmp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gmp-dialog .gmp-stat { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.gmp-dialog .gmp-stat strong { font-size: clamp(21px, 4vw, 27px); line-height: 1.1; font-weight: 700; letter-spacing: -.025em; color: #FFF; overflow-wrap: anywhere; }
.gmp-dialog .gmp-stat span { font-size: 11px; line-height: 1.4; color: var(--gmp-muted); text-wrap: pretty; }
.gmp-dialog .gmp-pager { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 18px; }
.gmp-dialog .gmp-pager[hidden] { display: none; }
.gmp-dialog .gmp-pager > button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 9px;
  border: 1px solid var(--gmp-line);
  border-radius: 50%;
  background: transparent;
  color: #FFF;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.gmp-dialog .gmp-pager > button:hover:not(:disabled) { background: var(--gmp-surface); border-color: var(--gmp-muted); }
.gmp-dialog .gmp-pager > button:disabled { opacity: .35; cursor: default; }
.gmp-dialog .gmp-pager > span { font-family: var(--gm-mono, 'IBM Plex Mono', monospace); font-size: 12px; line-height: 1.4; color: var(--gmp-text); }
.gmp-dialog .gmp-note { margin-top: 16px; font-size: 12px; line-height: 1.5; color: var(--gmp-muted); text-wrap: pretty; }
.gmp-dialog .gmp-warning { margin-top: 14px; padding: 11px 13px; border: 1px solid rgb(255 201 168 / .35); border-radius: 10px; background: rgb(218 74 12 / .09); color: var(--gm-peach, #FFC9A8); font-size: 12px; line-height: 1.5; }
.gmp-dialog .gmp-warning[hidden] { display: none; }
.gmp-dialog .gmp-empty { padding: 12px 0; color: var(--gmp-text); font-size: 15px; line-height: 1.5; }
.gmp-dialog .gmp-details { margin-top: 18px; border-top: 1px solid var(--gmp-line); }
.gmp-dialog .gmp-details[hidden] { display: none; }
.gmp-dialog .gmp-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 11px 0; list-style: none; color: var(--gmp-text); font-size: 13px; line-height: 1.4; font-weight: 600; cursor: pointer; }
.gmp-dialog .gmp-details > summary::-webkit-details-marker { display: none; }
.gmp-dialog .gmp-details > summary::after { content: '+'; font-family: var(--gm-mono, 'IBM Plex Mono', monospace); font-size: 20px; line-height: 1; color: var(--gmp-muted); }
.gmp-dialog .gmp-details[open] > summary::after { content: '−'; }
.gmp-dialog .gmp-products { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.gmp-dialog .gmp-products > li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid rgb(169 194 186 / .1); font-size: 12px; line-height: 1.45; }
.gmp-dialog .gmp-dot { align-self: start; width: 8px; height: 8px; margin-top: 4px; border-radius: 2px; background: var(--gmp-color, var(--gmp-accent)); }
.gmp-dialog .gmp-products > li > span:not(.gmp-dot) { overflow-wrap: anywhere; color: var(--gmp-text); }
.gmp-dialog .gmp-products small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--gmp-muted); }
.gmp-dialog .gmp-products > li > strong { max-width: 105px; color: #FFF; font-family: var(--gm-mono, 'IBM Plex Mono', monospace); font-size: 11px; line-height: 1.5; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.gmp-dialog .gmp-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 21px; }
.gmp-dialog .gmp-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--gmp-accent);
  color: #FFF;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease-out;
}
.gmp-dialog .gmp-cta:hover { background: var(--gm-rust, #B83C08); color: #FFF; text-decoration: none; }
.gmp-dialog .gmp-secondary { min-height: 44px; padding: 10px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--gmp-text); font-size: 13px; line-height: 1.3; font-weight: 500 !important; text-align: center; cursor: pointer; transition: background-color 120ms ease-out; }
.gmp-dialog .gmp-secondary:hover { background: var(--gmp-surface); color: #FFF; }
.gmp-dialog .gmp-retry { min-height: 44px; margin-top: 10px; padding: 9px 15px; border: 1px solid var(--gmp-line); border-radius: 999px; background: transparent; color: #FFF; font-size: 13px; line-height: 1.3; cursor: pointer; }
.gmp-dialog .gmp-retry:hover { background: var(--gmp-surface); }
.gmp-dialog .gmp-retry[hidden] { display: none; }

@keyframes gmp-open { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@keyframes gmp-close { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.98); } }
@keyframes gmp-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes gmp-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes gmp-fill { from { transform: scaleY(0); } to { transform: scaleY(var(--gmp-fill, 0)); } }

@media (max-width: 575.98px) {
  dialog.gm.gmp-dialog { width: calc(100% - 24px); border-radius: 22px; }
  .gmp-dialog .gmp-panel { padding: 20px; }
  .gmp-dialog .gmp-status { margin-bottom: 18px; font-size: 14px; }
  .gmp-dialog .gmp-grid { gap: 3px; }
  .gmp-dialog .gmp-cell { font-size: 8px; border-radius: 2px; }
  .gmp-dialog .gmp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .gmp-dialog .gmp-stat span { font-size: 11px; }
  .gmp-dialog .gmp-progress { margin-block: 17px; }
  .gmp-dialog .gmp-note { font-size: 11px; }
}

@media (max-width: 359.98px) {
  dialog.gm.gmp-dialog { width: calc(100% - 16px); border-radius: 20px; }
  .gmp-dialog .gmp-panel { padding: 16px; }
  .gmp-dialog .gmp-head { gap: 8px; }
  .gmp-dialog #gmp-title { font-size: 26px; }
  .gmp-dialog .gmp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .gmp-dialog .gmp-stat span { font-size: 11px; }
  .gmp-dialog .gmp-cell { font-size: 7px; }
  .gmp-dialog .gmp-pallet__meta { gap: 8px; }
  .gmp-dialog .gmp-pallet__meta > span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.gm.gmp-dialog[open],
  dialog.gm.gmp-dialog.is-closing,
  dialog.gm.gmp-dialog::backdrop,
  .gmp-dialog .gmp-grid.is-filling .gmp-cell__fill,
  .gmp-dialog .gmp-cell.is-filling .gmp-cell__fill,
  .gmp-dialog .gmp-cell__fill.is-filling { animation: none; }
  .gmp-dialog .gmp-content,
  .gmp-dialog .gmp-progress > i,
  .gmp-dialog .gmp-close,
  .gmp-dialog .gmp-pager > button,
  .gmp-dialog .gmp-cta,
  .gmp-dialog .gmp-secondary { transition: none; }
}
