/* ═══════════════════════════════════════════════════════════
   PREFERENCE MODAL — full stylesheet
   All classes prefixed with pref- to avoid collisions
═══════════════════════════════════════════════════════════ */

/* ── Modal shell ── */
.pref-modal-content {
  border-radius: 16px !important;
  border: none !important;
  overflow: hidden;
  font-family: "DM Sans", system-ui, sans-serif;
}

.pref-modal-top {
  padding: 22px 24px 0;
}

.pref-modal-body {
  padding: 0 24px 8px;
  min-height: 340px;
}

/* ── Stepper ── */
.pref-stepper {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.pref-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.pref-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.pref-step-dot.idle {
  background: #f4f4f6;
  color: #71717a;
}

.pref-step-dot.active {
  background: #5e17eb;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(94, 23, 235, 0.15);
}

.pref-step-dot.done {
  background: #5e17eb;
  color: #fff;
  box-shadow: none;
}

.pref-step-label {
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  transition: color 0.2s;
}

.pref-step-label.active {
  color: #5e17eb;
  font-weight: 600;
}

.pref-step-connector {
  flex: 1;
  height: 1.5px;
  background: rgba(0, 0, 0, 0.1);
  margin: 0 10px;
  transition: background 0.3s ease;
}

.pref-step-connector.done {
  background: #5e17eb;
}

/* ── Header row ── */
.pref-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pref-title {
  font-size: 16px;
  font-weight: 700;
  color: #09090b;
  margin-bottom: 3px;
  line-height: 1.3;
}

.pref-sub {
  font-size: 12.5px;
  color: #71717a;
  line-height: 1.4;
}

/* ── Panels ── */
.pref-panel {
  display: none;
}

.pref-panel.pref-active {
  display: block;
}

/* ── Search input ── */
.pref-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.pref-search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #a1a1aa;
  pointer-events: none;
}

.pref-search-wrap input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: #f4f4f6;
  padding: 0 12px 0 34px;
  font-size: 13px;
  font-family: inherit;
  color: #09090b;
  outline: none;
  transition: all 0.18s;
}

.pref-search-wrap input::placeholder {
  color: #a1a1aa;
}

.pref-search-wrap input:focus {
  border-color: #5e17eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(94, 23, 235, 0.1);
}

/* ── Country grid ── */
.pref-country-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2px 2px 6px;
}

.pref-country-grid::-webkit-scrollbar {
  width: 4px;
}

.pref-country-grid::-webkit-scrollbar-track {
  background: transparent;
}

.pref-country-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

/* ── Country card ── */
.pref-country-card {
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    transform 0.1s;
  background: #fff;
  user-select: none;
}

.pref-country-card:hover {
  border-color: rgba(94, 23, 235, 0.35);
  background: rgba(94, 23, 235, 0.03);
}

.pref-country-card.selected {
  border-color: #5e17eb;
  background: rgba(94, 23, 235, 0.06);
}

.pref-country-card:active {
  transform: scale(0.97);
}

.pref-country-card img {
  width: 36px;
  height: 27px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
  margin: 0 auto 7px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.pref-c-name {
  font-size: 11px;
  font-weight: 600;
  color: #09090b;
  line-height: 1.25;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pref-country-card.selected .pref-c-name {
  color: #5e17eb;
}

.pref-c-code {
  font-size: 10px;
  color: #a1a1aa;
  line-height: 1;
}

/* ── Empty / error state ── */
.pref-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  font-size: 13px;
  color: #a1a1aa;
}

.pref-empty-error {
  color: #dc2626;
}

/* ── Inventory grid ── */
.pref-inv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0 8px;
}

/* ── Inventory card ── */
.pref-inv-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  background: #fff;
  user-select: none;
}

.pref-inv-card:hover {
  border-color: rgba(94, 23, 235, 0.3);
  background: rgba(94, 23, 235, 0.02);
}

.pref-inv-card.selected {
  border-color: #5e17eb;
  background: rgba(94, 23, 235, 0.05);
}

.pref-inv-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(94, 23, 235, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #5e17eb;
}

.pref-inv-info {
  flex: 1;
  min-width: 0;
}

.pref-inv-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #09090b;
  margin-bottom: 3px;
  line-height: 1.3;
}

.pref-inv-desc {
  font-size: 12px;
  color: #71717a;
  margin-bottom: 6px;
  line-height: 1.4;
}

.pref-inv-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  line-height: 1.6;
}

.pref-badge-fast {
  background: #dcfce7;
  color: #166534;
}

.pref-badge-std {
  background: #ede9fe;
  color: #5b21b6;
}

.pref-inv-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 1px;
}

.pref-inv-card.selected .pref-inv-check {
  background: #5e17eb;
  border-color: #5e17eb;
}

/* ── Modal footer ── */
.pref-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  background: #f9f9fb;
  gap: 12px;
}

.pref-sel-info {
  font-size: 12.5px;
  color: #71717a;
  line-height: 1.4;
}

.pref-sel-info strong {
  color: #09090b;
  font-weight: 700;
}

.pref-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Buttons ── */
.pref-btn-next,
.pref-btn-back,
.pref-btn-finish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.pref-btn-next {
  background: #5e17eb;
  color: #fff;
}

.pref-btn-next:hover:not(:disabled) {
  background: #4c12c9;
}

.pref-btn-next:disabled {
  background: #c4b5fd;
  cursor: not-allowed;
  opacity: 0.7;
}

.pref-btn-back {
  background: transparent;
  color: #09090b;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.pref-btn-back:hover {
  background: #f4f4f6;
}

.pref-btn-finish {
  background: #059669;
  color: #fff;
}

.pref-btn-finish:hover {
  background: #047857;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .pref-country-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pref-inv-grid {
    grid-template-columns: 1fr;
  }

  .pref-modal-top {
    padding: 16px 16px 0;
  }

  .pref-modal-body {
    padding: 0 16px 8px;
  }

  .pref-modal-footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pref-footer-actions {
    justify-content: flex-end;
  }

  .pref-step-label {
    display: none;
  }

  .pref-title {
    font-size: 14px;
  }
}

@media (max-width: 400px) {
  .pref-country-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
