/* ============================================
   Configurator screen — Ivaldi
   ============================================ */

.cfg {
  padding-block: 32px 64px;
  min-height: calc(100vh - 60px);
}

.cfg-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 960px) {
  .cfg-layout { grid-template-columns: 1fr; gap: 32px; }
  .cfg-layout .cfg-preview-area { order: 1; }
  .cfg-layout .cfg-controls { order: 2; position: static; max-height: none; overflow: visible; }
}

/* ============ Controls (left column) — sticky при общем скролле страницы ============ */
.cfg-controls {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.cfg-controls h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.cfg-lead {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

.control-group {
  margin-bottom: 28px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 10px;
}

.control-value {
  color: var(--text-muted);
  font-size: 14px;
}

.control-value b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-main);
  font-size: 16px;
}

/* ============ Range slider — кастомный ============ */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: grab;
  transition: transform .1s ease;
}

input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: grab;
}

.range-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ Radio rows ============ */
.radio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-row label {
  position: relative;
  cursor: pointer;
  user-select: none;
  flex: 1;
  min-width: 0;
}

.radio-row input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-row label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1.5px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-main);
  transition: all .15s ease;
  white-space: nowrap;
}

.radio-row label > span em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  color: var(--text-muted);
}

.radio-row input[type="radio"]:checked + span {
  background: rgba(176, 133, 91, 0.18);
  border-color: var(--accent);
  color: var(--text-main);
}

.radio-row input[type="radio"]:checked + span em {
  color: var(--accent);
}

.radio-row label:hover > span:not([data-locked]) {
  border-color: var(--accent);
}

/* Финиш — палитра свотчей */
.finish-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.swatch {
  width: 16px !important;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block !important;
  padding: 0 !important;
  background: var(--bg-card);
  flex-shrink: 0;
}

.sw-clear { background: #D8B583; }
.sw-light { background: #C09569; }
.sw-dark { background: #75502E; }
.sw-extra { background: #3D2916; }
.sw-black { background: #1A1A1A; }
.sw-white { background: #EAE6DC; border-color: rgba(0,0,0,0.18); }

/* ============ Preview area (right column — обычный поток страницы) ============ */
.cfg-preview-area {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.cfg-preview {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  position: relative;
}

.cfg-canvas-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, #E8DFCB 0%, #DFD3B9 100%);
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.cfg-canvas-wrap:active { cursor: grabbing; }

#table-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cfg-canvas-hint {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-body);
  background: rgba(245, 240, 230, 0.92);
  padding: 5px 10px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.03em;
}

.cfg-spec {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(30, 24, 18, 0.1);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-muted);
  justify-content: center;
}

.cfg-spec b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-main);
}

/* ============ Price ============ */
.cfg-price-block {
  background: rgba(176, 133, 91, 0.16);
  border-radius: 14px;
  padding: 28px 32px;
  border-left: 4px solid var(--accent);
}

.cfg-price-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  font-weight: 500;
}

.cfg-price-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 12px;
  transition: color .15s ease;
}

.cfg-price-value.pulse {
  color: var(--accent);
}

.cfg-price-note {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============ Actions ============ */
.cfg-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfg-actions .btn {
  width: 100%;
  text-align: center;
  justify-content: center;
}

#copy-link.copied {
  background: rgba(176, 133, 91, 0.18);
  border-color: var(--accent);
  color: var(--accent);
}
