/* ============================================================
   TOOLS.CSS — Image Enhancer with filters, AI tools, crop
   ============================================================ */

/* ─── Tool Card ───────────────────────────────────────────── */
.tool-card { margin-bottom: var(--space-lg); }

/* ─── Drop Zone ───────────────────────────────────────────── */
.enhance-drop-zone {
  margin: var(--space-md);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.enhance-drop-zone:hover,
.enhance-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.enhance-drop-zone.drag-over { border-style: solid; }
.drop-zone-content { pointer-events: none; }
.drop-zone-icon { font-size: 32px; margin-bottom: var(--space-sm); opacity: 0.5; }
.enhance-drop-zone:hover .drop-zone-icon,
.enhance-drop-zone.drag-over .drop-zone-icon { opacity: 1; }
.drop-zone-text { font-size: 14px; color: var(--text-muted); }
.drop-zone-browse {
  color: var(--accent); cursor: pointer; font-weight: 600; pointer-events: auto;
}
.drop-zone-browse:hover { text-decoration: underline; }
.drop-zone-hint { font-size: 12px; color: var(--text-faint); margin-top: var(--space-xs); }

/* ─── Editor ──────────────────────────────────────────────── */
.editor { padding: var(--space-md); }

/* Canvas */
.editor-canvas-wrap {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 520px;
  margin-bottom: var(--space-md);
  position: relative;
}
.editor-canvas-wrap canvas {
  max-width: 100%;
  max-height: 520px;
  display: block;
}

/* Mask canvas (overlays editor canvas during object removal) */
#mask-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  z-index: 5;
}

/* Crop canvas (overlays editor canvas during crop) */
#crop-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  z-index: 5;
}

/* Section labels */
.editor-section { margin-bottom: var(--space-md); }
.editor-section-label {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: var(--space-sm);
}

/* ─── Filter Presets ──────────────────────────────────────── */
.preset-row,
.restyle-presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.preset-row::-webkit-scrollbar,
.restyle-presets::-webkit-scrollbar { display: none; }

.preset-btn {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.preset-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}
.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Adjustment Sliders ──────────────────────────────────── */
.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-lg);
}
.slider-row {
  display: grid;
  grid-template-columns: 80px 1fr 32px;
  align-items: center;
  gap: var(--space-sm);
}
.slider-row label {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}
.slider-val {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-align: right; font-variant-numeric: tabular-nums;
}

/* Range input styling */
.adj-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--border); outline: none; cursor: pointer;
}
.adj-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: pointer; transition: transform 100ms ease;
}
.adj-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.adj-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3); cursor: pointer;
}

/* ─── AI Tools Row ────────────────────────────────────────── */
.ai-tools-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.ai-tool-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-glow);
}
.ai-tool-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
.ai-tool-btn.ai-tool-primary {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.ai-tool-btn.ai-tool-primary:hover {
  background: var(--accent);
  color: #fff;
}
.ai-tool-icon { font-size: 14px; }
.ai-tool-status {
  display: block;
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--accent);
  min-height: 18px;
}
.ai-tool-status:empty { display: none; }
.ai-tool-status.error { color: var(--danger); }
.ai-tool-status.processing { animation: pulse-status 1.5s ease infinite; }

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── AI Tool Panels (expandable settings) ────────────────── */
.ai-tool-panel {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

/* ─── Mask Toolbar (Object Removal) ───────────────────────── */
.mask-toolbar {
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.mask-instructions {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.mask-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ─── Restyle Panel ───────────────────────────────────────── */
.restyle-presets {
  margin-bottom: var(--space-sm);
}
.restyle-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font);
  margin-bottom: var(--space-sm);
}
.restyle-input:focus { outline: none; border-color: var(--accent); }
.restyle-strength {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ─── Expand Panel ────────────────────────────────────────── */
.expand-options {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.expand-custom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.expand-dim-input {
  width: 60px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text-primary);
  text-align: center;
}
.expand-dim-input:focus { outline: none; border-color: var(--accent); }

/* ─── Chip controls ───────────────────────────────────────── */
.enhance-setting { display: flex; align-items: center; gap: var(--space-sm); }
.enhance-setting-label {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.enhance-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.enhance-chip {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.enhance-chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.enhance-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ─── Editor Actions ──────────────────────────────────────── */
.editor-actions {
  display: flex; align-items: center; gap: var(--space-sm);
  padding-top: var(--space-md); border-top: 1px solid var(--border); flex-wrap: wrap;
}
.editor-actions-right {
  margin-left: auto; display: flex; gap: var(--space-sm);
}

/* ─── Pipeline Modal ──────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
}
.modal-overlay.open { display: block; }
.pipeline-modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 90%; max-width: 580px; max-height: 90vh;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); z-index: 1001;
  overflow: hidden; flex-direction: column;
}
.pipeline-modal.open { display: flex; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md); border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: var(--space-md); overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: var(--space-sm); justify-content: flex-end;
  padding: var(--space-md); border-top: 1px solid var(--border);
}
.pipeline-preview {
  width: 100%; max-height: 200px; overflow: hidden;
  border-radius: var(--radius); margin-bottom: var(--space-md);
  background: var(--bg-primary); display: flex; align-items: center; justify-content: center;
}
.pipeline-preview img { max-width: 100%; max-height: 200px; object-fit: contain; }
.pipeline-fields { display: flex; flex-direction: column; gap: var(--space-md); }
.pipeline-field label {
  display: block; font-size: 12px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--space-xs);
}
.pipeline-field input,
.pipeline-field textarea {
  width: 100%; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px;
  color: var(--text-primary); font-family: var(--font); resize: vertical;
}
.pipeline-field input:focus,
.pipeline-field textarea:focus { outline: none; border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   VIDEO CHOPPER
   ═══════════════════════════════════════════════════════════════ */

/* ─── Ready Actions (Process button after file drop) ─────── */
.vc-ready-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-md) var(--space-md);
  justify-content: center;
}

/* ─── Session Options ────────────────────────────────────── */
.vc-session-options {
  display: flex;
  align-items: flex-end;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-md) 0;
  flex-wrap: wrap;
}
.vc-option-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.vc-option-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vc-guest-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font);
  width: 220px;
}
.vc-guest-input:focus { outline: none; border-color: var(--accent); }

/* ─── Processing State ───────────────────────────────────── */
.vc-processing-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
}
.vc-progress-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.vc-progress-ring svg { transform: rotate(-90deg); }
.vc-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 5;
}
.vc-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  transition: stroke-dashoffset 0.4s ease;
}
.vc-progress-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.vc-progress-info { flex: 1; }
.vc-progress-step {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.vc-progress-detail {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Segment Review ─────────────────────────────────────── */
.vc-segments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) 0;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.vc-segments-info { display: flex; align-items: baseline; gap: var(--space-sm); }
.vc-segment-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.vc-segments-actions { display: flex; gap: var(--space-xs); }

.vc-segment-list {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 600px;
  overflow-y: auto;
}

.vc-segment-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  opacity: 0.5;
}
.vc-segment-card.selected {
  opacity: 1;
  border-color: var(--border-strong);
}

.vc-seg-toggle { flex-shrink: 0; padding-top: 2px; }
.vc-seg-check {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--bg-primary);
  color: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.vc-seg-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.vc-seg-body { flex: 1; min-width: 0; }
.vc-seg-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.vc-seg-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.vc-seg-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.vc-seg-summary {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.4;
}
.vc-seg-platform {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-right: 6px;
}
.vc-seg-confidence {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.vc-seg-confidence.high { color: var(--success); background: rgba(52, 211, 153, 0.1); }
.vc-seg-confidence.med { color: var(--warning); background: rgba(251, 191, 36, 0.1); }
.vc-seg-confidence.low { color: var(--text-faint); background: var(--bg-primary); }

/* Transcript toggle */
.vc-seg-transcript-wrap { margin-top: 8px; }
.vc-seg-transcript-toggle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  cursor: pointer;
  list-style: none;
}
.vc-seg-transcript-toggle::-webkit-details-marker { display: none; }
.vc-seg-transcript-toggle::before {
  content: '▸ ';
  display: inline;
}
details[open] > .vc-seg-transcript-toggle::before { content: '▾ '; }
.vc-seg-transcript {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
  padding: var(--space-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Cut point adjustment */
.vc-seg-adjust {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: 8px;
}
.vc-seg-adjust label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.vc-time-input {
  width: 70px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.vc-time-input:focus { outline: none; border-color: var(--accent); }

/* Segments footer */
.vc-segments-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.vc-segments-footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.vc-selected-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── Results / Clip Grid ────────────────────────────────── */
.vc-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) 0;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.vc-results-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.vc-results-actions { display: flex; gap: var(--space-xs); }

.vc-clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
  padding: var(--space-md);
}

.vc-clip-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.vc-clip-card:hover { border-color: var(--border-strong); }

.vc-clip-preview {
  position: relative;
  background: #000;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vc-clip-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.vc-clip-play {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.vc-clip-play:hover { opacity: 1; }
.vc-clip-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.vc-clip-info { padding: var(--space-sm) var(--space-md); }
.vc-clip-title {
  width: 100%;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font);
}
.vc-clip-title:hover { border-color: var(--border); }
.vc-clip-title:focus { outline: none; border-color: var(--accent); background: var(--bg-primary); }
.vc-clip-platform {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-top: 4px;
}

.vc-clip-actions {
  display: flex;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-sm);
  justify-content: flex-end;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sliders-grid { grid-template-columns: 1fr; }
  .editor-actions { flex-direction: column; align-items: stretch; }
  .editor-actions-right { margin-left: 0; justify-content: stretch; }
  .editor-actions-right .btn { flex: 1; }
  .editor-canvas-wrap { max-height: 300px; }
  .editor-canvas-wrap canvas { max-height: 300px; }
  .pipeline-modal { width: 95%; max-height: 95vh; }
  .ai-tools-row { gap: 6px; }
  .ai-tool-btn { padding: 6px 10px; font-size: 11px; }
  .ai-tool-panel { gap: var(--space-sm); }

  /* Video Chopper responsive */
  .vc-processing-wrap { flex-direction: column; text-align: center; }
  .vc-segment-card { flex-direction: column; }
  .vc-seg-adjust { flex-wrap: wrap; }
  .vc-clip-grid { grid-template-columns: 1fr; }
  .vc-segments-header,
  .vc-results-header { flex-direction: column; align-items: flex-start; }
}
