/* ==========================================================================
   Root Harmonic Studio — Reference Image Specimen Analyzer (PaletteCentral Style)
   Features: Artwork Frame on Top + Attached Vertical Swatch Pillars on Bottom
   Standards: Strict Cascade Specificity | Zero Margin for Component Spacing
   ========================================================================== */

/* Compact Reference Extractor Trigger Bar inside Sidebar Controller */
.ref-dropzone-bar {
  background-color: var(--bg-input);
  border: 1px dashed rgba(16, 185, 129, 0.45);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ref-dropzone-bar:hover,
.ref-dropzone-bar.drag-active {
  border-color: var(--accent-emerald-text);
  background-color: rgba(16, 185, 129, 0.08);
}

.ref-dropzone-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ref-dropzone-left .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-emerald-text);
  flex-shrink: 0;
}

.ref-dropzone-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.demo-ref-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.demo-ref-btn:hover {
  background-color: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}

/* Specimen Card Container (PaletteCentral Poster Layout) */
.ref-specimen-wrap {
  display: flex;
  flex-direction: column;
}

.ref-specimen-wrap[hidden] {
  display: none;
}

.ref-specimen-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.ref-specimen-card.active-in-preview {
  border-color: #10B981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35), var(--shadow-md);
}

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

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

.specimen-badge {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald-text);
  border: 1px solid rgba(16, 185, 129, 0.38);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.ref-specimen-meta h3 {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-specimen-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.ref-specimen-actions .icon-btn .material-symbols-outlined {
  font-size: 15px;
}

/* Unified Poster Frame: [Artwork Thumbnail Top + Attached Swatch Pillars Bottom] */
.specimen-poster-frame {
  background-color: #FFFFFF;
  border: 1px solid var(--bg-surface-border);
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ref-artwork-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  background-color: #0E1116;
  overflow: hidden;
  border-radius: 5px 5px 0 0;
  cursor: crosshair;
}

.ref-artwork-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ref-pin-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ref-sample-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ref-sample-pin:hover,
.ref-sample-pin.active-pin {
  transform: translate(-50%, -50%) scale(1.24);
  box-shadow: 0 0 0 2px #0E1116, 0 4px 12px rgba(0, 0, 0, 0.8);
  z-index: 4;
}

/* Bottom Attached Vertical Swatch Pillars (Exact Match to Rooster Reference) */
.ref-pillars-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  height: 108px;
  background-color: #FFFFFF;
  border-radius: 0 0 5px 5px;
  overflow: hidden;
}

.ref-swatch-pillar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 5px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
  user-select: none;
  min-width: 0;
}

.ref-swatch-pillar:hover {
  filter: brightness(1.06);
}

.ref-swatch-pillar.active-pillar {
  outline: 2px solid #FFFFFF;
  outline-offset: -3px;
}

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

.pillar-index {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 800;
  opacity: 0.85;
}

.pillar-root-btn {
  border: none;
  border-radius: 3px;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ref-swatch-pillar:hover .pillar-root-btn {
  opacity: 1;
}

.pillar-root-btn:hover {
  transform: scale(1.12);
  background: #FFFFFF;
  color: #0E1116;
}

.pillar-root-btn .material-symbols-outlined {
  font-size: 11px;
}

.pillar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pillar-role {
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pillar-hex {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

/* Specimen Tonal Roll-Out Drawer */
.ref-tonal-drawer {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.25s ease;
}

.ref-tonal-drawer.is-open {
  max-height: 560px;
  opacity: 1;
  padding-top: 6px;
  border-top: 1px dashed var(--bg-surface-border);
}
