/* Конфигуратор: окно выбора товара и адаптив (продолжение css/configurator.css) */

/* ---------- Окно выбора ---------- */
.picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.picker[hidden] {
  display: none;
}
.picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 20, 0.55);
  backdrop-filter: blur(3px);
}
.picker__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  max-height: min(820px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  animation: picker-in 0.22s ease-out;
}
.picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}
.picker__head h2 {
  margin: 0;
  font-size: 22px;
}
.picker__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
}
.picker__close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.picker__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 8px 20px;
}
.picker__search {
  flex: 1 1 220px;
}
.picker__search,
.picker__sort {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.picker__note {
  min-height: 0;
  margin: 0;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
}
.picker__note:empty {
  display: none;
}
.picker__list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px 20px 20px;
  overflow-y: auto;
  list-style: none;
}
.picker__empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.picker-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.picker-item.is-incompatible {
  border-style: dashed;
}
.picker-item.is-incompatible .picker-item__media {
  opacity: 0.55;
}
.picker-item__media {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--photo-bg);
}
.picker-item__media img {
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
}
.picker-item__name {
  font-weight: 600;
}
.picker-item__name:hover {
  color: var(--accent);
}
.picker-item__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.picker-item__specs b {
  color: var(--text);
  font-weight: 600;
}
.picker-item__buy {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}
.picker-item__buy > b {
  font: 700 20px var(--font-head);
}

body.is-locked {
  overflow: hidden;
}

@keyframes picker-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
@keyframes slot-flash {
  from {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent);
  }
}

@media (max-width: 1024px) {
  .build-layout {
    grid-template-columns: 1fr;
  }
  .build-side {
    position: static;
    order: -1;
  }
  .build-stage__canvas {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 640px) {
  .build-stage__canvas {
    aspect-ratio: 1 / 1;
  }
  .build-slot {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .build-slot__media {
    width: 56px;
  }
  .build-slot__actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .picker {
    padding: 0;
  }
  .picker__dialog {
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
  .picker-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .picker-item__buy {
    grid-column: 1 / -1;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    justify-items: start;
  }
  .picker-item__buy .btn {
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .picker__dialog,
  .build-slot.is-flash {
    animation: none;
  }
  .build-progress__bar span,
  .build-power__bar span {
    transition: none;
  }
}
