/* ============================================================
   SAVAGE DESIGNS — DEFRINGE PANEL
   ============================================================

   Styles the INSIDE of the shared defringe panel only. Where the panel sits —
   floating over the board, docked in a sidebar, pushed inline — stays with each
   tool, because that is genuinely the tool's business and the two disagree.
   Both pages already load css/styles.css, so the custom properties below
   resolve without anything extra.
   ============================================================ */

.df-panel { width: 100%; }

.df-wrap {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.df-col { display: flex; flex-direction: column; gap: 0.35rem; }
.df-col-ctl  { flex: 1 1 250px; min-width: 230px; }
.df-col-prev { flex: 1 1 290px; min-width: 240px; }

.df-head { margin-bottom: 0.35rem; }
.df-title { font-size: 0.9rem; color: var(--text); display: block; }
.df-sub {
  font-size: 0.72rem; color: var(--text-muted);
  line-height: 1.5; margin: 0.2rem 0 0;
}

.df-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-dim); margin-top: 0.35rem;
}

.df-hint {
  font-size: 0.7rem; color: var(--text-muted);
  line-height: 1.5; margin: 0.1rem 0 0.2rem;
}
.df-hint-tight { margin: 0.3rem 0 0.1rem; }

/* ── Sliders ─────────────────────────────────────────────────────────────── */

.df-ctl {
  display: flex; align-items: center; gap: 0.55rem;
  margin-top: 0.15rem;
  transition: opacity 0.15s;
}
.df-ctl input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 0; }
.df-inline-label {
  font-size: 0.72rem; color: var(--text-muted);
  white-space: nowrap; min-width: 5.2rem;
}
.df-num {
  font-family: var(--ff-mono); color: var(--accent);
  font-size: 0.72rem; min-width: 2.6rem; text-align: right;
}

/* ── Matte swatches ──────────────────────────────────────────────────────── */

.df-swatches { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.15rem; }

.df-swatch {
  width: 30px; height: 30px; padding: 0;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, transform 0.1s;
  /* A white swatch on a white card is invisible without this. */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.df-swatch:hover  { border-color: var(--accent); transform: translateY(-1px); }
.df-swatch.active { border-color: var(--accent); }
.df-swatch.active::after {
  content: '✓';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.85);
}

.df-swatch-custom {
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  background:
    conic-gradient(from 0deg, #e0203a, #f5a623, #f8e71c, #2ecc71, #1f6feb, #7b2ff7, #e0203a);
}
.df-swatch-custom input[type="color"] {
  opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0;
}

/* ── Preview stage ───────────────────────────────────────────────────────── */

.df-stage {
  position: relative;
  width: 100%;
  height: 190px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.df-stage canvas { display: block; }

.df-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--accent); color: #fff;
  pointer-events: none;
}
.df-badge-before { background: var(--text-muted); }

.df-backdrops { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.4rem; }

.df-bd {
  width: 24px; height: 24px; padding: 0;
  border-radius: 5px;
  border: 2px solid var(--border);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s, transform 0.1s;
}
.df-bd:hover  { border-color: var(--accent); transform: translateY(-1px); }
.df-bd.active { border-color: var(--accent); }
.df-bd-checker {
  background-image:
    linear-gradient(45deg, #d9d2c8 25%, transparent 25%),
    linear-gradient(-45deg, #d9d2c8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9d2c8 75%),
    linear-gradient(-45deg, transparent 75%, #d9d2c8 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: #fff;
}

.df-compare {
  margin-top: 0.4rem;
  font-size: 0.7rem; font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  align-self: flex-start;
  transition: border-color 0.15s, color 0.15s;
}
.df-compare:hover { border-color: var(--accent); color: var(--accent); }

/* ── Actions ─────────────────────────────────────────────────────────────── */

.df-actions {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.df-status {
  flex: 1;
  font-size: 0.72rem; color: var(--text-muted); font-style: italic;
}
.df-apply { border-color: var(--accent) !important; color: var(--accent) !important; }
.df-actions .toolbar-btn:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
  .df-stage { height: 150px; }
  .df-inline-label { min-width: 4.4rem; }
}
