/* ═══════════════════════════════════════════════════
   Editor View — Fullscreen image + overlay controls
   ═══════════════════════════════════════════════════ */

.editor {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* Image fills entire editor behind everything */
.editor #editor-image {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Header overlay at top with gradient fade */
.editor #editor-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
  padding-bottom: 16px;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.editor .header {
  background: transparent;
}

/* Controls dock at bottom with gradient fade into image.
   Gradient extends 80px above content so it covers even when panels grow. */
.editor-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding-top: 80px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(0,0,0,0.3) 30px,
    rgba(0,0,0,0.6) 60px,
    rgba(0,0,0,0.85) 100px,
    rgba(0,0,0,0.92)
  );
  transition: background var(--duration-normal) var(--ease-out);
}

/* Content area: tool icons OR slider/panel */
#editor-content {
  max-height: 45vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Tabs — always visible, fixed position from bottom */
#editor-tabs {
  flex-shrink: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

/* ═══════════════════════════════════════════════════
   Auto-hide: controls fade while adjusting slider
   ═══════════════════════════════════════════════════ */

.editor--sliding #editor-header {
  opacity: 0;
  pointer-events: none;
}

.editor--sliding #editor-tabs {
  opacity: 0;
  pointer-events: none;
}

.editor--sliding .editor-controls {
  background: transparent;
}

.editor--sliding .slider-area {
  background: transparent;
}

.editor--sliding .slider-area__label {
  opacity: 0.5;
}

/* Panels transparent in slide mode */
.editor--sliding .blackmist-panel,
.editor--sliding .blur-panel,
.editor--sliding .curves-panel {
  background: transparent;
}

/* ═══════════════════════════════════════════════════
   Override slider/tools backgrounds for overlay mode
   ═══════════════════════════════════════════════════ */

.editor .slider-area {
  background: transparent;
}

.editor .tools-bar {
  background: transparent;
}

.editor .tab-switcher {
  background: transparent;
}

.editor .safe-area-bottom {
  background: rgba(0,0,0,0.92);
}

/* ═══════════════════════════════════════════════════
   Preset Strip
   ═══════════════════════════════════════════════════ */

.preset-panel {
  display: flex;
  flex-direction: column;
}

/* ── Preset folder tabs ── */
.preset-folders {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-12);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.preset-folder-tab {
  background: transparent;
  color: var(--text-tertiary);
  border: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.preset-folder-tab--active {
  background: var(--white-10);
  color: var(--text-primary);
}

.preset-strip {
  height: 80px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-12);
  gap: var(--space-8);
  flex-shrink: 0;
}

.preset-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.preset-item__thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid transparent;
  background: var(--elevated);
}

.preset-item--active .preset-item__thumb {
  border-color: var(--white-100);
}

.preset-item__thumb img,
.preset-item__thumb canvas,
.preset-item__color {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.preset-item__name {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.preset-item--active .preset-item__name {
  color: var(--text-primary);
}

/* ── Save / Delete for personal presets ── */
.preset-item--add { opacity: 0.6; }
.preset-item--add:active { opacity: 1; }
.preset-item__thumb--add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--white-20);
  color: var(--text-secondary);
}

.preset-item__delete {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--base);
  border: none;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.preset-item { position: relative; }

.preset-empty {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding: 0 var(--space-8);
}

/* ── Preset Save Dialog ── */
.preset-save-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preset-save-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.preset-save-dialog__content {
  position: relative;
  background: var(--elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  width: min(300px, 85vw);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.preset-save-dialog__content h3 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
}

.preset-save-dialog__input {
  background: var(--surface);
  border: 1px solid var(--white-10);
  border-radius: var(--radius-sm);
  padding: var(--space-12);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  outline: none;
}

.preset-save-dialog__input:focus {
  border-color: var(--accent);
}

.preset-save-dialog__actions {
  display: flex;
  gap: var(--space-8);
  justify-content: flex-end;
}

.preset-save-dialog__cancel,
.preset-save-dialog__confirm {
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-8) var(--space-16);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  cursor: pointer;
}

.preset-save-dialog__cancel {
  background: var(--surface);
  color: var(--text-secondary);
}

.preset-save-dialog__confirm {
  background: var(--accent);
  color: var(--base);
}

/* ═══════════════════════════════════════════════════
   HSL Panel
   ═══════════════════════════════════════════════════ */

.hsl-channels {
  display: flex;
  justify-content: center;
  gap: var(--space-12);
  padding: var(--space-8) var(--space-16);
}

.hsl-channel {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hsl-channel--active {
  border-color: var(--white-100);
}

.hsl-channel__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

/* ═══════════════════════════════════════════════════
   Split Tone Panel
   ═══════════════════════════════════════════════════ */

.split-tone-panel {
  padding: var(--space-4) var(--space-16);
}

.split-tone__section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) 0 0;
}

/* ═══════════════════════════════════════════════════
   Grain Panel
   ═══════════════════════════════════════════════════ */

.grain-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-4) 0;
}

.grain-toggle__btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  border: 1px solid var(--white-12);
}

.grain-toggle__btn--active {
  color: var(--text-primary);
  background: var(--white-12);
  border-color: var(--white-20);
}

/* ═══════════════════════════════════════════════════
   Crop Panel
   ═══════════════════════════════════════════════════ */

.crop-panel {
  padding: var(--space-4) var(--space-16);
}

.crop-ratios {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-4) 0;
}

.crop-ratio {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  border: 1px solid var(--white-12);
}

.crop-ratio--active {
  color: var(--text-primary);
  background: var(--white-12);
  border-color: var(--white-20);
}

.crop-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-12);
  padding: var(--space-8) 0;
}

.crop-action {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-16);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid var(--white-12);
}

.crop-action--primary {
  color: var(--base);
  background: var(--white-100);
  border-color: var(--white-100);
}

/* Crop Overlay */
.crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
  touch-action: none;
}

.crop-overlay__dim {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.crop-overlay__box {
  position: absolute;
  border: 1.5px solid var(--white-100);
  cursor: move;
}

.crop-overlay__grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(255,255,255,0.2) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.2) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  pointer-events: none;
}

.crop-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 2;
}

.crop-handle::after {
  content: '';
  position: absolute;
  background: var(--white-100);
}

.crop-handle--nw { top: -4px; left: -4px; cursor: nw-resize; }
.crop-handle--ne { top: -4px; right: -4px; cursor: ne-resize; }
.crop-handle--sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.crop-handle--se { bottom: -4px; right: -4px; cursor: se-resize; }

.crop-handle--nw::after, .crop-handle--ne::after,
.crop-handle--sw::after, .crop-handle--se::after {
  width: 16px;
  height: 16px;
  border: 2px solid var(--white-100);
  background: transparent;
}

.crop-handle--nw::after { top: 0; left: 0; border-right: none; border-bottom: none; }
.crop-handle--ne::after { top: 0; right: 0; border-left: none; border-bottom: none; }
.crop-handle--sw::after { bottom: 0; left: 0; border-right: none; border-top: none; }
.crop-handle--se::after { bottom: 0; right: 0; border-left: none; border-top: none; }

/* ═══════════════════════════════════════════════════
   Export View
   ═══════════════════════════════════════════════════ */

.export-view {
  padding: var(--space-24) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-12) var(--space-16);
  background: var(--elevated);
  border-radius: var(--radius-md);
}

.export-option__label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.export-option__value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.export-btn {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--white-100);
  color: var(--base);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
