/* ── Controls layout ── */
.background-controls {
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

/* Background-specific color input sizing */
#tool-background .color-label input[type="color"] {
  width: 44px;
  height: 36px;
  border: 1px solid #333;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

/* ── Aspect ratio preset buttons ── */
.aspect-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.aspect-btn {
  padding: 0.22rem 0.55rem;
  background: #27272a;
  border: 1px solid #333;
  border-radius: 5px;
  color: #777;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.aspect-btn:hover { color: #ccc; background: #333; }

.aspect-btn.active {
  background: rgba(99,102,241,0.15);
  border-color: #6366f1;
  color: #a5b4fc;
}

/* ── Scale / margin slider rows ── */
.slider-row {
  display: grid;
  grid-template-columns: 46px 1fr 54px 18px;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.slider-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  text-align: right;
}

.unit-label {
  font-size: 0.75rem;
  color: #555;
}

.slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  background: #818cf8;
  transform: scale(1.15);
}

.slider-row input[type="number"] {
  width: 100%;
  padding: 0.3rem 0.35rem;
  background: #09090b;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e8e8ea;
  font-size: 0.85rem;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

.slider-row input[type="number"]:focus { border-color: #6366f1; }

/* ── Image info label ── */
.background-image-info {
  font-size: 0.82rem;
  color: #666;
}

/* ── Canvas area ── */
.background-canvas-wrap {
  position: relative;
  margin: 1.5rem 0 0;
  background: repeating-conic-gradient(#1a1a1d 0% 25%, #111114 0% 50%) 0 0 / 20px 20px;
  border-radius: 10px;
  border: 1px solid #27272a;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#backgroundCanvas {
  display: block;
  cursor: default;
  box-shadow: 0 2px 24px rgba(0,0,0,0.5);
  border-radius: 1px;
}

.background-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: #444;
  font-size: 0.9rem;
  pointer-events: none;
}

.background-empty.hidden { display: none; }

/* ── Footer ── */
.background-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.position-display {
  font-size: 0.82rem;
  color: #666;
  font-variant-numeric: tabular-nums;
  min-width: 200px;
}

.background-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Snap indicator pills ── */
.snap-indicators {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  gap: 0.3rem;
}

.snap-pill {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(99,102,241,0.85);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.snap-pill.visible { opacity: 1; }
