/* Filter Studio styles. Everything is namespaced under .fs-root so it can be
   dropped into a larger page without clashing. Tweak the variables to theme. */

.fs-root {
  --fs-bg: #0d0d10;
  --fs-panel: #17171c;
  --fs-text: #f2f2f5;
  --fs-muted: #9a9aa5;
  --fs-accent: #ffd400;
  --fs-danger: #ff3b4a;
  --fs-radius: 14px;

  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  min-height: 0;
  background: var(--fs-bg);
  color: var(--fs-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.fs-root *, .fs-root *::before, .fs-root *::after { box-sizing: border-box; }

/* ---------- Top bar ---------- */
.fs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.fs-title { font-weight: 700; letter-spacing: 0.02em; }
.fs-sources { display: flex; gap: 8px; }

.fs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid #2c2c35;
  border-radius: 999px;
  background: var(--fs-panel);
  color: var(--fs-text);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.fs-btn:hover { background: #22222a; }
.fs-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fs-btn.active { border-color: var(--fs-accent); color: var(--fs-accent); }
.fs-btn[hidden] { display: none; }
.fs-icon { width: 44px; height: 44px; justify-content: center; padding: 0; font-size: 18px; }

/* ---------- Stage ---------- */
.fs-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  touch-action: pan-y;
}
.fs-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--fs-radius);
  background: #000;
}
.fs-stage.drag { outline: 2px dashed var(--fs-accent); outline-offset: -8px; }
.fs-stage.flash canvas { filter: brightness(2); transition: filter 0.05s; }

.fs-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--fs-muted);
  pointer-events: none;
}
.fs-placeholder[hidden] { display: none; }
.fs-hint { font-size: 13px; opacity: 0.7; }
.fs-basic-note { color: var(--fs-accent); max-width: 32em; }

.fs-filter-name {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.fs-filter-name.show { opacity: 1; }

.fs-rec {
  position: absolute;
  top: 16px;
  right: 20px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--fs-danger);
  font-size: 13px;
  font-weight: 700;
}
.fs-rec[hidden] { display: none; }

.fs-toast {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #2a2a33;
  font-size: 14px;
}
.fs-toast[hidden] { display: none; }

/* ---------- Controls ---------- */
.fs-controls {
  padding: 8px 0 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.fs-amount {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 8px;
  font-size: 13px;
  color: var(--fs-muted);
}
.fs-amount input { flex: 1; accent-color: var(--fs-accent); }

.fs-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 16px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.fs-strip::-webkit-scrollbar { display: none; }

.fs-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fs-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  scroll-snap-align: center;
}
.fs-swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.fs-chip[aria-selected="true"] { color: var(--fs-text); }
.fs-chip[aria-selected="true"] .fs-swatch { border-color: var(--fs-accent); }

.fs-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 8px;
  padding: 3px;
  width: max-content;
  border-radius: 999px;
  background: var(--fs-panel);
}
.fs-tab {
  padding: 6px 18px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--fs-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.fs-tab[aria-selected="true"] { background: var(--fs-accent); color: #000; }

[data-ref="lensStrip"] .fs-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fs-panel);
}
.fs-emoji { font-size: 26px; line-height: 1; }
.fs-chip.fs-unavailable { opacity: 0.35; }

.fs-lens-opts {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 8px;
}
.fs-lens-opts[hidden] { display: none; }
.fs-small { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.fs-amount.fs-inline { flex: 1; padding: 0; }

.fs-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 72px;
}
.fs-shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.fs-shutter:active { transform: scale(0.94); }
.fs-shutter:disabled { opacity: 0.35; cursor: not-allowed; }
.fs-recbtn { color: var(--fs-danger); }
.fs-btn.busy { opacity: 0.5; animation: fs-pulse 0.8s ease-in-out infinite alternate; }
@keyframes fs-pulse { to { opacity: 1; } }
.fs-recbtn.active { background: var(--fs-danger); color: #fff; border-color: var(--fs-danger); }

/* ---------- Result sheet ---------- */
.fs-sheet {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
}
.fs-sheet[hidden] { display: none; }
.fs-sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  max-height: 100%;
}
.fs-preview { min-height: 0; display: flex; justify-content: center; }
.fs-preview img, .fs-preview video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--fs-radius);
}
.fs-sheet-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.fs-hidden-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
