/* ============================================================
   ANILORE VIDEO SNIPPER & SCISSORS (Нарезка клипов v2)
   100% Full Theme Synchronization with User Palettes:
   - Obsidian Noir, Cyber Neon, Tokyo Sunset, Violet Phantom,
   - Midnight Blue, Tokyo Crimson, Emerald Ronin, Sunset Shonen,
   - Neo Sakura, Studio Light & Custom Themes!
   ============================================================ */

/* Trigger Buttons */
.video-snipper-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-subtle, rgba(230, 57, 70, 0.14));
  color: var(--accent-secondary, var(--text-accent, #ff4d6d));
  border: 1px solid var(--border-hover, rgba(230, 57, 70, 0.45));
  padding: 6px 14px;
  border-radius: var(--radius-full, 9999px);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--accent-glow, 0 2px 10px rgba(0, 0, 0, 0.2));
  user-select: none;
}

.video-snipper-btn:hover {
  background: var(--accent-gradient, linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)));
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}

.av-btn--scissors {
  color: var(--accent-secondary, var(--text-accent, #ff4d6d)) !important;
}

.av-btn--scissors:hover {
  color: #fff !important;
  filter: drop-shadow(0 0 8px var(--accent-primary, #e63946));
}

/* Modal Backdrop */
.snipper-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-overlay, rgba(0, 0, 0, 0.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.snipper-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Dialog */
.snipper-modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 94vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-card, #101010);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 22px;
  box-shadow: var(--shadow-lg, 0 25px 60px rgba(0, 0, 0, 0.8)), 0 0 35px var(--accent-subtle, rgba(230, 57, 70, 0.15));
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  color: var(--text-primary, #fff);
}

.snipper-modal-backdrop.active .snipper-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Header */
.snipper-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  box-sizing: border-box;
}

.snipper-modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.snipper-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-gradient, linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--accent-glow, 0 4px 14px rgba(230, 57, 70, 0.4));
}

.snipper-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  margin: 0;
  line-height: 1.2;
}

.snipper-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snipper-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #9ca3af);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.snipper-modal-close-btn:hover {
  background: var(--accent-subtle, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #fff);
}

/* Body */
.snipper-modal-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
  width: 100%;
}

/* Format & Aspect Ratio Selector */
.snipper-format-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.snipper-format-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-format-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  color: var(--text-muted, #9ca3af);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.snipper-format-tab-btn:hover {
  background: var(--bg-secondary, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #fff);
  border-color: var(--border-hover, rgba(255, 255, 255, 0.25));
}

.snipper-format-tab-btn.active {
  background: var(--accent-subtle, rgba(230, 57, 70, 0.14));
  border-color: var(--accent-primary, #e63946);
  color: var(--text-primary, #fff);
  box-shadow: var(--accent-glow, 0 0 16px rgba(230, 57, 70, 0.2));
}

.snipper-format-tag {
  font-size: 10px;
  color: var(--accent-secondary, var(--text-accent, #ff4d6d));
  font-weight: 700;
}

/* Crop Pan Controls Row */
.snipper-pan-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary, #0a0a0a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding: 8px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.snipper-pan-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.snipper-pan-slider {
  flex: 1;
  min-width: 120px;
  accent-color: var(--accent-primary, #e63946);
  cursor: pointer;
}

.snipper-pan-preset-btn {
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  color: var(--text-primary, #fff);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.snipper-pan-preset-btn:hover {
  background: var(--accent-primary, #e63946);
  border-color: var(--accent-primary, #e63946);
  color: #fff;
}

/* Video Preview Container */
.snipper-preview-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.snipper-preview-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

/* Live Crop Frame Mask Over Video */
.snipper-crop-mask-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.snipper-crop-mask-overlay.active {
  display: block;
}

.snipper-crop-window {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px solid var(--accent-primary, #e63946);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), var(--accent-glow, 0 0 20px rgba(230, 57, 70, 0.5));
  pointer-events: auto;
  cursor: grab;
  transition: left 0.06s ease, width 0.06s ease;
  box-sizing: border-box;
}

.snipper-crop-window:active {
  cursor: grabbing;
}

.snipper-crop-corner-bracket {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: #fff;
  border-style: solid;
  pointer-events: none;
}

.snipper-crop-corner-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.snipper-crop-corner-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.snipper-crop-corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.snipper-crop-corner-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

/* Watermark Badge */
.snipper-watermark-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--bg-glass, rgba(10, 10, 10, 0.85));
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.2));
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 10;
}

.snipper-watermark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary, #e63946);
  box-shadow: 0 0 6px var(--accent-primary, #e63946);
}

.snipper-preview-overlay-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--bg-glass, rgba(0, 0, 0, 0.75));
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary, var(--text-accent, #ff4d6d));
  border: 1px solid var(--border-hover, rgba(230, 57, 70, 0.45));
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.snipper-preview-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary, #e63946);
  box-shadow: 0 0 6px var(--accent-primary, #e63946);
  animation: snipper-pulse 1.5s infinite;
}

@keyframes snipper-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.snipper-preview-play-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-gradient, linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)));
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow, 0 6px 20px rgba(0, 0, 0, 0.6));
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 12;
}

.snipper-preview-play-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Timeline & Dual Handle Range */
.snipper-timeline-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.03));
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  box-sizing: border-box;
  width: 100%;
}

.snipper-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.snipper-timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  display: flex;
  align-items: center;
  gap: 6px;
}

.snipper-duration-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--accent-subtle, rgba(230, 57, 70, 0.14));
  color: var(--accent-secondary, var(--text-accent, #ff4d6d));
  border: 1px solid var(--border-hover, rgba(230, 57, 70, 0.45));
}

.snipper-duration-pill.limit-reached {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Track Box */
.snipper-track-wrap {
  position: relative;
  width: 100%;
  height: 48px;
  background: var(--bg-secondary, #0a0a0a);
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  display: flex;
  align-items: center;
  user-select: none;
  cursor: pointer;
  box-sizing: border-box;
  overflow: hidden;
}

.snipper-track-bg-ticks {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0px,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 20px
  );
  pointer-events: none;
}

.snipper-track-active-range {
  position: absolute;
  height: 100%;
  background: var(--accent-gradient, linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)));
  opacity: 0.45;
  box-shadow: var(--accent-glow, 0 0 16px rgba(230, 57, 70, 0.25));
  pointer-events: none;
  box-sizing: border-box;
}

.snipper-track-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-tertiary, #ff758f);
  box-shadow: 0 0 8px var(--accent-tertiary, #ff758f);
  pointer-events: none;
  z-index: 8;
}

/* Draggable Handles */
.snipper-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  background: var(--accent-primary, #e63946);
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow, 0 0 10px rgba(230, 57, 70, 0.6));
  touch-action: none;
}

.snipper-handle-start {
  border-radius: 8px 0 0 8px;
  transform: translateX(-100%);
}

.snipper-handle-end {
  border-radius: 0 8px 8px 0;
  background: var(--accent-secondary, #ff4d6d);
  box-shadow: var(--accent-glow, 0 0 10px rgba(255, 77, 109, 0.6));
}

.snipper-handle::after {
  content: '';
  width: 2px;
  height: 18px;
  background: #fff;
  border-radius: 1px;
}

/* Start / End Input Cards - Strict containment */
.snipper-time-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-time-card {
  background: var(--bg-card, #101010);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  transition: background-color 0.2s, border-color 0.2s;
}

.snipper-time-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  gap: 6px;
}

.snipper-set-current-btn {
  background: var(--accent-subtle, rgba(230, 57, 70, 0.12));
  border: 1px solid var(--border-hover, rgba(230, 57, 70, 0.3));
  color: var(--accent-secondary, var(--text-accent, #ff4d6d));
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  flex-shrink: 0;
}

.snipper-set-current-btn:hover {
  background: var(--accent-primary, #e63946);
  color: #fff;
}

.snipper-time-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-time-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: var(--bg-secondary, #0a0a0a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.16));
  border-radius: 8px;
  color: var(--text-primary, #fff);
  font-family: monospace, sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  box-sizing: border-box;
}

.snipper-time-input:focus {
  outline: none;
  border-color: var(--accent-primary, #e63946);
  box-shadow: 0 0 0 2px var(--accent-subtle, rgba(230, 57, 70, 0.25));
}

.snipper-step-btn {
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  color: var(--text-primary, #fff);
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  box-sizing: border-box;
  user-select: none;
}

.snipper-step-btn:hover {
  background: var(--accent-subtle, rgba(255, 255, 255, 0.22));
  border-color: var(--border-hover);
  color: var(--text-primary, #fff);
}

/* Metadata Fields */
.snipper-meta-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #9ca3af);
}

.snipper-text-input {
  width: 100%;
  background: var(--bg-secondary, #0a0a0a);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-primary, #fff);
  font-size: 13.5px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.snipper-text-input:focus {
  outline: none;
  border-color: var(--accent-primary, #e63946);
  box-shadow: 0 0 0 2px var(--accent-subtle, rgba(230, 57, 70, 0.25));
}

/* Social Share Bar */
.snipper-share-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.snipper-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;
}

.snipper-share-btn:hover {
  transform: translateY(-1.5px);
  filter: brightness(1.15);
}

.snipper-share-btn--tiktok {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.snipper-share-btn--shorts {
  background: #ff0000;
  color: #fff;
}

.snipper-share-btn--tg {
  background: #229ed9;
  color: #fff;
}

.snipper-share-btn--vk {
  background: #0077ff;
  color: #fff;
}

.snipper-share-btn--wa {
  background: #25d366;
  color: #fff;
}

.snipper-share-btn--copy {
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #fff);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
}

/* Action Buttons Footer */
.snipper-modal-footer {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
}

.snipper-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: var(--bg-card-hover, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.18));
  color: var(--text-primary, #fff);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

.snipper-download-btn:hover {
  background: var(--accent-subtle, rgba(255, 255, 255, 0.16));
  border-color: var(--border-hover, rgba(255, 255, 255, 0.3));
  color: var(--text-primary, #fff);
}

.snipper-publish-anitok-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--accent-gradient, linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%));
  border: none;
  color: #fff;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--accent-glow, 0 4px 18px rgba(230, 57, 70, 0.45));
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.snipper-publish-anitok-btn:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--accent-glow, 0 6px 24px rgba(230, 57, 70, 0.6));
  filter: brightness(1.08);
}

/* Progress bar for recorder */
.snipper-recording-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary, rgba(255, 255, 255, 0.1));
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
  display: none;
  box-sizing: border-box;
}

.snipper-recording-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient, linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)));
  transition: width 0.1s linear;
}

@media (max-width: 600px) {
  .snipper-modal-dialog {
    border-radius: 20px 20px 0 0;
    max-height: 96vh;
    margin-top: auto;
  }
  .snipper-time-controls-grid {
    grid-template-columns: 1fr;
  }
  .snipper-modal-footer {
    flex-direction: column-reverse;
  }
  .snipper-download-btn,
  .snipper-publish-anitok-btn {
    width: 100%;
    justify-content: center;
  }
}
