/* ==========================================================================
   Root Harmonic Studio — Compact Swatch Cards & Tonal Roll-Out Drawer
   Standards: Strict Cascade Specificity | Zero Margin for Component Spacing
   ========================================================================== */

.palettes-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  contain: layout style;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.palette-card:not(.active-in-preview) {
  content-visibility: auto;
  contain-intrinsic-size: 0 76px;
}

.palette-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.palette-card.active-in-preview {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}

.palette-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.palette-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.palette-number-badge {
  background-color: var(--bg-surface-elevated);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-surface-border);
  flex-shrink: 0;
}

.category-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.category-tag.tag-pastel {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.category-tag.tag-theory {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue-text);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.category-tag.tag-ui {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.category-tag.tag-tonal {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.category-tag.tag-mood {
  background: rgba(236, 72, 153, 0.12);
  color: var(--accent-pink-text);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.palette-info {
  min-width: 0;
}

.palette-info h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-info p {
  display: none;
}

.palette-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.palette-actions .export-btn {
  font-size: 0.65rem;
  padding: 2px 6px;
  gap: 3px;
}

.palette-actions .export-btn span:last-child {
  display: none;
}

.palette-actions .reroll-btn {
  padding: 3px;
  width: 22px;
  height: 22px;
}

.palette-actions .reroll-btn .material-symbols-outlined {
  font-size: 13px;
}

/* Compact Swatches Row Container */
.swatches-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  min-height: 44px;
}

.swatch-item {
  position: relative;
  border-radius: 4px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--swatch-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
  overflow: hidden;
  user-select: none;
}

.swatch-item:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.swatch-item.is-root {
  outline: 2px solid #FFFFFF;
  outline-offset: -2px;
}

.swatch-item.selected-swatch {
  outline: 2px solid #FFFFFF;
  box-shadow: 0 0 0 3px #0E1116, var(--shadow-md);
  outline-offset: -2px;
}

.swatch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
}

.swatch-role-pill {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 1px 3px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48px;
}

.swatch-item.light-swatch-content .swatch-role-pill {
  background: rgba(0, 0, 0, 0.08);
  color: #0E1116;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

.swatch-item.dark-swatch-content .swatch-role-pill {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.swatch-item.is-root .swatch-role-pill {
  background: #FFFFFF;
  color: #000000;
  border: 1px solid #000000;
}

.swatch-lock-btn {
  border: none;
  border-radius: var(--radius-pill);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.swatch-item.light-swatch-content .swatch-lock-btn {
  background: rgba(0, 0, 0, 0.08);
  color: #0E1116;
}

.swatch-item.dark-swatch-content .swatch-lock-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

.swatch-item:hover .swatch-lock-btn,
.swatch-lock-btn.is-locked {
  opacity: 1;
}

.swatch-lock-btn .material-symbols-outlined {
  font-size: 10px;
}

.swatch-lock-btn.is-locked {
  background: #FFFFFF;
  color: #000000;
}

.swatch-bottom {
  display: flex;
  flex-direction: column;
}

.swatch-hex {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.swatch-copy-hint,
.swatch-hsl-label {
  display: none;
}

/* Sidebar Active Palette Tonal Drawer (Roll / Expand Animation) */
.palette-tonal-drawer {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.palette-card.active-in-preview .palette-tonal-drawer {
  max-height: 600px;
  opacity: 1;
  padding-top: 8px;
  border-top: 1px dashed var(--bg-surface-border);
}

.sidebar-tonal-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 5px;
  align-items: center;
}

.sidebar-tonal-orig {
  border-radius: 4px;
  padding: 3px 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-mono);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
  border: 1px solid var(--swatch-border);
  cursor: pointer;
  transition: transform 0.12s ease;
  min-width: 0;
}

.sidebar-tonal-orig:hover {
  transform: scale(1.02);
}

.sidebar-tonal-orig .orig-badge {
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tonal-orig .orig-hex {
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

.sidebar-tonal-aside {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}

.sidebar-tonal-variant {
  border-radius: 3px;
  padding: 3px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: var(--font-mono);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--swatch-border);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.sidebar-tonal-variant:hover {
  transform: translateY(-1px) scale(1.06);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.sidebar-tonal-variant .var-step {
  font-size: 0.48rem;
  font-weight: 800;
  opacity: 0.8;
  line-height: 1;
}

.sidebar-tonal-variant .var-hex {
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 1;
}
