/* ==========================================================================
   Kodxx Color Swatches — Clean Professional Square Tiles
   Large square swatches with dark selection border + checkmark.
   ========================================================================== */

:root {
  --accent-color-faded: rgb(from var(--accent-color) r g b / 0.5);
}

/* --- Swatch List --- */
.md3-swatch-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

/* --- Swatch Tile --- */
.md3-swatch-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  padding: 0;
  font: inherit;
  transition: transform 0.2s ease;
  position: relative;
  user-select: none;
  width: 72px;
  flex-shrink: 0;
}

.md3-swatch-tile:hover {
  transform: scale(1.05);
}

/* --- Swatch Circle → Large square tile --- */
.md3-swatch-circle {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  margin-bottom: 6px;
  box-shadow: none;
  border: 2px solid #e5e5e5;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.md3-swatch-circle.round {
  border-radius: 12px;
}

/* Override base CSS circular styles — kodxx uses rounded squares */
.color-select-img {
  border-radius: 12px;
}

.color-select-button.round,
.color-select-img.round {
  border-radius: 12px;
}

.md3-swatch-circle.square {
  border-radius: 8px;
}

.md3-swatch-circle:hover {
  border-color: #bbb;
}

/* --- Active: dark border + checkmark badge --- */
.md3-swatch-tile .color-select-button.active,
.md3-swatch-circle.active {
  border-color: #1a1a1a;
  border-width: 3px;
  box-shadow: none;
  outline: none;
}

/* Checkmark badge on selected swatch */
.md3-swatch-circle.active::after {
  content: '\2713';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #1a1a1a;
  color: #ffffff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
}

.md3-swatch-tile .color-select-button.active + .md3-swatch-label {
  color: #1a1a1a;
  font-weight: 700;
}

/* --- Label --- */
.md3-swatch-label {
  color: #666;
  font-size: 0.72rem;
  text-align: center;
  font-weight: 500;
  transition: color 0.2s;
  letter-spacing: -0.01em;
  width: 100%;
  line-height: 1.2;
  margin-bottom: 0;
  margin-top: 2px;
  pointer-events: none;
  user-select: none;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* --- Tooltip (RAL codes) --- */
.color-tooltip-label {
  font-size: 0.58rem;
  margin-top: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  color: #999;
  font-weight: 400;
}

.md3-swatch-tile .color-select-button.active ~ .color-tooltip-label {
  color: #1a1a1a;
  font-weight: 600;
}

/* --- Range --- */
.color-select-range {
  color: #999;
  font-size: 0.75rem;
  text-align: center;
  margin-top: 2px;
  pointer-events: none;
  user-select: none;
}

.color-select-button-wrap .color-select-range {
  display: none;
}

.md3-swatch-tile .color-select-button.active ~ .color-select-range {
  color: #1a1a1a;
  font-weight: 600;
}

/* --- Focus --- */
.md3-swatch-tile:focus .md3-swatch-circle {
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.12);
}


/* ==========================================================================
   Thumbnail Buttons — Clean cards
   ========================================================================== */

.thumbnail-button {
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  cursor: pointer;
  padding: 8px 6px 6px;
  width: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: none;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

@media screen and (max-width: 1280px) {
  .thumbnail-button {
    padding: 6px 4px 4px;
  }
  .thumbnail-select {
    gap: 6px;
  }
}

.thumbnail-button.fullImage,
.thumbnail-button.fullImageMedium {
  padding: 2px;
}

.thumbnail-select:has(.thumbnail-button.fullImageMedium) {
  gap: 5px;
}

.thumbnail-button:hover {
  border-color: #bbb;
  background: #fafafa;
}

.thumbnail-button.active {
  background: #ffffff;
  border-color: #1a1a1a;
  border-width: 3px;
}

.thumbnail-button.active .thumbnail-label {
  color: #1a1a1a;
  font-weight: 700;
}

.thumbnail-label {
  font-size: 0.75rem;
  color: #333;
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}

.thumbnail-subtext {
  width: 100%;
  font-size: 0.62rem;
  color: #888;
}

.thumbnail-button.active .thumbnail-subtext {
  color: #1a1a1a;
}

.thumbnail-subdesc {
  width: 100%;
  font-size: 0.52rem;
  color: #aaa;
}

.thumbnail-button.active .thumbnail-subdesc {
  color: #666;
}

.thumbnail-icon {
  transition: transform 0.25s ease;
  border-radius: 8px;
}

.thumbnail-button:hover .thumbnail-icon {
  transform: scale(1.04);
}

/* Full-image variants */
.thumbnail-icon.fullImage,
.thumbnail-icon.fullImageMedium,
.thumbnail-icon.fullImageLarge {
  object-fit: contain;
  width: 100%;
  height: auto;
  margin-bottom: 0;
  border-radius: 8px;
  display: block;
}

.thumbnail-button.fullImageMedium {
  width: 82px;
}

.thumbnail-button.fullImageLarge {
  width: 162px;
}

.thumbnail-icon.fullImageLarge {
  width: 110px;
  height: 110px;
}

.thumbnail-button.fullImageMedium .thumbnail-label {
  transition: color 0.3s ease;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: 0;
  color: white;
  font-size: 14px;
  pointer-events: none;
  width: 100%;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.thumbnail-button.fullImage .thumbnail-label {
  transition: color 0.3s ease;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: 0;
  color: white;
  font-size: 20px;
  font-weight: bold;
  pointer-events: none;
  width: 100%;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.thumbnail-button.fullImage.active .thumbnail-label,
.thumbnail-button.fullImageMedium.active .thumbnail-label {
  color: black;
  text-shadow: none;
}

.thumbnail-button.fullImage,
.thumbnail-button.fullImageMedium {
  position: relative;
}

.thumbnail-button.fullImage .thumbnail-icon.fullImage {
  transition: background-color 0.3s ease, transform 0.25s ease;
}

.thumbnail-button.fullImage .thumbnail-icon.fullImage:hover {
  background-color: var(--accent-color-faded);
}

.thumbnail-button.fullImage.active .thumbnail-icon.fullImage {
  background-color: black;
}


/* ==========================================================================
   Expand Button (+N)
   ========================================================================== */

.color-select-expand {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed #d4d4d4;
  color: #999;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: transparent;
}

.color-select-expand:hover {
  border-color: #999;
  color: #666;
  background: #f7f7f7;
}

.color-select-expand.expanded {
  background: #f0f0f0;
  border-color: #999;
  border-style: solid;
  color: #333;
}
