/* =============================================
   Video to GIF Converter — SmarterSources
   ============================================= */

/* === File Info Bar === */
.file-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.file-info-bar .file-name {
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
}
.file-info-bar .file-details {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* === Preview Area === */
.preview-area {
  display: block;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  margin-bottom: 20px;
}
.canvas-wrapper {
  text-align: center;
  background: #1e293b;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-wrapper video {
  max-width: 100%;
  max-height: 50vh;
  display: block;
}
.canvas-wrapper canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 50vh;
  display: none;
}
.preview-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 0;
}
.preview-controls .time-display {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* === Section Labels === */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: block;
}

/* === Timeline / Trim === */
.trim-section {
  margin-bottom: 20px;
}
.timeline-container {
  position: relative;
  height: 48px;
  padding: 0 6px;
  user-select: none;
  -webkit-user-select: none;
}
.timeline-track {
  position: relative;
  height: 36px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  cursor: pointer;
}
.timeline-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(59, 91, 219, 0.15);
  border-top: 2px solid var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  pointer-events: none;
}
.timeline-handle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 14px;
  background: var(--color-primary);
  border-radius: 4px;
  cursor: ew-resize;
  z-index: 2;
  transform: translateX(-50%);
  transition: box-shadow var(--transition-fast);
}
.timeline-handle:hover,
.timeline-handle:active {
  box-shadow: 0 0 0 4px rgba(59, 91, 219, 0.25);
}
.timeline-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 16px;
  background: #fff;
  border-radius: 1px;
}
.timeline-playhead {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  background: #ef4444;
  z-index: 3;
  pointer-events: none;
  transform: translateX(-50%);
}
.trim-times {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 12px;
}
.trim-time-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trim-time-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.time-input {
  width: 76px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 4px 6px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
}
.trim-duration {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* === Meme Text Section === */
.meme-text-section {
  margin-bottom: 20px;
}
.meme-text-inputs {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.text-input-group {
  flex: 1;
  min-width: 160px;
}
.text-input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.text-size-group {
  min-width: 200px;
}

/* === Settings Section === */
.settings-section {
  margin-bottom: 20px;
}
.settings-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.settings-grid .control-group {
  flex: 1;
  min-width: 140px;
}
.control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.control-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: border-color var(--transition-fast);
}
.control-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.1);
}

/* === Slider with Value === */
.slider-with-value {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-with-value input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border-light);
  border-radius: 3px;
  outline: none;
}
.slider-with-value input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.slider-with-value input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.meme-color-input {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.meme-color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.meme-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
.meme-color-input::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}
.slider-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 36px;
  text-align: right;
}

/* === Estimate Bar === */
.estimate-bar {
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}
.estimate-warning {
  color: #b45309;
  font-weight: 600;
}

/* === Action Buttons === */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* === Progress Section === */
.progress-section {
  margin-bottom: 20px;
}
.progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}
.progress-bar-track {
  height: 10px;
  background: var(--color-border-light);
  border-radius: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 5px;
  transition: width 0.15s ease;
  min-width: 0;
}
.progress-detail {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* === Result Section === */
.result-section {
  margin-top: 24px;
}
.result-preview {
  text-align: center;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, transparent 0% 50%) 50% / 16px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 500px;
  overflow: auto;
}
.result-preview img {
  max-width: 100%;
  max-height: 460px;
  border-radius: 4px;
}
.result-preview canvas {
  max-width: 100%;
  max-height: 460px;
  border-radius: 4px;
  image-rendering: auto;
}

/* === Result Player Controls === */
.result-player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}
.player-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.player-btn:hover {
  background: var(--color-primary-hover, #2d4ab8);
}
.player-scrubber-wrap {
  flex: 1;
  min-width: 80px;
}
.player-scrubber {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border-light);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.player-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.player-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.player-frame-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 52px;
  text-align: center;
}
.player-mode-select,
.player-speed-select {
  padding: 4px 6px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.75rem;
  font-family: var(--font-body);
  cursor: pointer;
}
.player-mode-select:focus,
.player-speed-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.result-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

/* === Buttons === */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}
.btn-success {
  background: #16a34a;
  color: #fff;
  border: none;
}
.btn-success:hover {
  background: #15803d;
}

/* === Error Message === */
.video-error {
  padding: 20px;
  text-align: center;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
}
.video-error p {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
  .file-info-bar {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
  .file-info-bar .file-name {
    max-width: 100%;
  }
  .meme-text-inputs {
    flex-direction: column;
  }
  .settings-grid {
    flex-direction: column;
  }
  .trim-times {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .trim-time-group {
    justify-content: center;
  }
  .canvas-wrapper video,
  .canvas-wrapper canvas {
    max-height: 40vh;
  }
  .action-buttons {
    flex-direction: column;
  }
  .action-buttons .btn {
    width: 100%;
  }
  .result-player-controls {
    flex-wrap: wrap;
  }
  .result-player-controls .player-scrubber-wrap {
    order: 10;
    flex-basis: 100%;
  }
}
