/* ═══════════════════════════════════════════════════════════════════════════
   kitchen-pro-swatch-picker.css  —  GENERIC swatch picker (RC47)

   Shared by all three range shops. Deliberately a separate asset rather than
   a fourth copy of an inline <style> block: the existing kpbs- rules are
   already triplicated across the bella/zurfiz/valore shop sections, and that
   duplication is the drift this component exists to stop.

   Namespace is kpsp- throughout so nothing collides with the kpbs- rules
   still living inline in each section.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── shared tile ─────────────────────────────────────────────────────────── */
.kpsp-tile {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  cursor: pointer;
  display: block;
  color: inherit;
}
.kpsp-tile__inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kpsp-tile__name {
  font-size: 12.5px;
  line-height: 1.25;
  color: #111827;
  text-align: center;
  overflow-wrap: anywhere;
}
.kpsp-tile__meta { font-size: 11.5px; line-height: 1.2; color: #111827; text-align: center; }
.kpsp-tile__note { font-size: 11px; line-height: 1.2; color: #6b7280; text-align: center; }
.kpsp-tile.is-disabled { opacity: 0.45; cursor: not-allowed; }

/* the square box that normalises every source ratio */
.kpsp-swatch {
  display: block;
  position: relative;
  overflow: hidden;
  background: #F3F4F6;
  /* every finish gets a hairline so white/near-white never vanishes on white */
  box-shadow: inset 0 0 0 1px rgba(15, 23, 43, 0.18);
}
.kpsp-swatch__img,
.kpsp-swatch__fill {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* Bella 1:1, Zurfiz 2:3, Valore mixed — all normalise */
  object-position: center;
}
.kpsp-tile--circle .kpsp-swatch { border-radius: 50%; }
.kpsp-tile--rect   .kpsp-swatch { border-radius: 6px; }

/* selection ring — drawn outside the swatch so it never crops the material */
.kpsp-tile.is-selected .kpsp-swatch {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 43, 0.18),
              0 0 0 2px #fff,
              0 0 0 4px #DD2F2E;
}
.kpsp-tile.is-selected .kpsp-tile__name { font-weight: 600; }
.kpsp-tile:hover:not(.is-disabled) .kpsp-swatch {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 43, 0.18), 0 0 0 2px #fff, 0 0 0 4px rgba(221, 47, 46, 0.35);
}
.kpsp-tile:focus-visible { outline: none; }
.kpsp-tile:focus-visible .kpsp-swatch {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 43, 0.18), 0 0 0 2px #fff, 0 0 0 4px #111827;
}

/* ── inline strip ────────────────────────────────────────────────────────── */
.kpsp-strip { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.kpsp-tile--inline { width: 64px; }
.kpsp-tile--inline .kpsp-swatch { width: 44px; height: 44px; margin: 0 auto; }
.kpsp-tile--inline .kpsp-tile__name {
  font-size: 11px;
  /* two lines max inline; the full name is in the title attr and the picker */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kpsp-more {
  width: 64px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 1.5px dashed #9CA3AF;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  align-self: stretch;
  min-height: 68px;
}
.kpsp-more:hover { border-color: #DD2F2E; background: #FEF2F2; }
.kpsp-more:focus-visible { outline: 2px solid #111827; outline-offset: 2px; }
.kpsp-more__plus { font-size: 15px; font-weight: 600; color: #111827; line-height: 1; }
.kpsp-more__label { font-size: 10.5px; color: #6b7280; line-height: 1; }

/* ── full-screen picker ──────────────────────────────────────────────────── */
.kpsp-lock { overflow: hidden; }
.kpsp-lock-body { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

.kpsp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 43, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.kpsp-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 23, 43, 0.35);
}
.kpsp-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #E5E7EB;
}
.kpsp-head__title { margin: 0; font-size: 17px; line-height: 1.3; color: #111827; flex: 1 1 auto; }
.kpsp-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1.5px solid #D1D5DB;
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: #111827;
  cursor: pointer;
  font-family: inherit;
}
.kpsp-close:hover { border-color: #DD2F2E; }
.kpsp-close:focus-visible { outline: 2px solid #111827; outline-offset: 2px; }

.kpsp-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px; }
.kpsp-grid {
  display: grid;
  grid-template-columns: repeat(var(--kpsp-cols, 5), minmax(0, 1fr));
  gap: 18px 12px;
}
.kpsp-tile--grid .kpsp-swatch { width: 100%; height: auto; aspect-ratio: 1 / 1; }

.kpsp-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid #E5E7EB;
  background: #fff;
}
.kpsp-foot__count { flex: 1 1 auto; font-size: 13.5px; color: #6b7280; overflow-wrap: anywhere; }
.kpsp-commit {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 26px;
  border: 0;
  border-radius: 8px;
  background: #DD2F2E;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.kpsp-commit:hover:not(:disabled) { background: #C42625; }
.kpsp-commit:disabled { background: #D1D5DB; color: #6b7280; cursor: not-allowed; }
.kpsp-commit:focus-visible { outline: 2px solid #111827; outline-offset: 2px; }

/* ── mobile: the picker goes genuinely full-screen ───────────────────────── */
@media (max-width: 640px) {
  .kpsp-overlay { padding: 0; }
  .kpsp-panel { max-width: none; height: 100%; border-radius: 0; }
  .kpsp-body { padding: 14px; }
  .kpsp-grid { gap: 14px 8px; }
  .kpsp-tile__name { font-size: 11.5px; }
  .kpsp-foot { padding: 12px 14px; }
  .kpsp-commit { padding: 12px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .kpsp-tile, .kpsp-swatch { transition: none !important; }
}
