/* Bộ chọn pattern màu (công cụ xem cho khách, không thuộc giao diện website).
   Dùng màu trung tính cố định để không lẫn với palette đang xem. */
.pal-switcher {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 90;
  font-family: var(--font-body, system-ui, sans-serif);
  color: #1F1B19;
}
body.has-sticky-bar .pal-switcher { bottom: 82px; }
@media (min-width: 768px) { body.has-sticky-bar .pal-switcher { bottom: 16px; } }

.pal-switcher__toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 16px 6px 8px;
  border-radius: 9999px;
  background: #FFFFFF;
  border: 1px solid rgba(31, 27, 25, 0.16);
  box-shadow: 0 8px 24px rgba(31, 27, 25, 0.14);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.pal-switcher__toggle::-webkit-details-marker { display: none; }
.pal-switcher__toggle:focus-visible,
.pal-option input:focus-visible + .pal-option__swatches,
.pal-switcher__compare:focus-visible { outline: 2px solid #1F1B19; outline-offset: 2px; }
.pal-switcher__label strong { font-weight: 600; }

.pal-switcher__dots { display: inline-flex; }
.pal-switcher__dots i,
.pal-option__swatches i {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px rgba(31, 27, 25, 0.18);
}
.pal-switcher__dots i + i { margin-left: -8px; }

.pal-switcher__panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(340px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 14px;
  background: #FFFFFF;
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 25, 0.12);
  box-shadow: 0 18px 48px rgba(31, 27, 25, 0.2);
}
.pal-switcher fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.pal-switcher legend {
  padding: 0 4px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5F5650;
}

.pal-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.pal-option:hover { background: #F5F3EF; }
.pal-option:has(input:checked) { background: #F5F3EF; border-color: #1F1B19; }
.pal-option input { position: absolute; opacity: 0; pointer-events: none; }
.pal-option__swatches { display: inline-flex; flex-shrink: 0; border-radius: 9999px; }
.pal-option__swatches i + i { margin-left: -7px; }
.pal-option__text { display: grid; line-height: 1.3; }
.pal-option__name { font-size: 14px; font-weight: 600; }
.pal-option__tag { font-size: 12px; color: #5F5650; }

.pal-switcher__compare {
  display: block;
  margin-top: 10px;
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(31, 27, 25, 0.1);
  font-size: 13px;
  font-weight: 600;
  color: #1F1B19;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Trong khung so sánh: ẩn nút nổi của website để khung gọn hơn. */
.is-palette-embed .floating-dock { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  html[data-palette] body { transition: background-color 320ms ease, color 320ms ease; }
}
