/* Модалка «Обрезать аудио» (Seedance 2.5 Omni, выбор отрезка 2–30 с) */

.audio-trim-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  overflow-y: auto;
  padding: 16px;
  animation: audioTrimFadeIn 0.2s ease-out;
}

.audio-trim-overlay.closing {
  animation: audioTrimFadeOut 0.2s ease-out forwards;
  pointer-events: none;
}

@keyframes audioTrimFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes audioTrimFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes audioTrimSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes audioTrimShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* margin:auto вместо align-items:center — высокая модалка на низком экране скроллится */
.audio-trim-modal {
  margin: auto;
  width: 100%;
  max-width: 520px;
  background: var(--card, #1a1a22);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  color: var(--text, #f6f7fb);
  animation: audioTrimSlideUp 0.2s ease-out;
}

.audio-trim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-trim-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.audio-trim-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #f6f7fb);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.audio-trim-close:hover,
.audio-trim-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.audio-trim-subtitle {
  margin: 6px 0 16px;
  color: var(--muted, #8b8d98);
  font-size: 15px;
}

.audio-trim-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.audio-trim-play {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #f6f7fb);
  cursor: pointer;
}

.audio-trim-play:hover,
.audio-trim-play:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}

.audio-trim-wave-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.audio-trim-wave-wrap.is-loading {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: audioTrimShimmer 1.2s linear infinite;
}

.audio-trim-wave {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.audio-trim-wave-wrap.is-dragging .audio-trim-wave {
  cursor: grabbing;
}

.audio-trim-times {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.audio-trim-time {
  color: var(--gold, #ffd146);
  font-weight: 600;
}

.audio-trim-time-sep,
.audio-trim-time-total {
  color: var(--muted, #8b8d98);
}

.audio-trim-time-total {
  margin-left: auto;
}

.audio-trim-hint {
  margin: 8px 0 0;
  color: var(--muted, #8b8d98);
  font-size: 13px;
}

.audio-trim-error {
  margin: 10px 0 0;
  color: var(--danger, #ff5c7a);
  font-size: 14px;
}

.audio-trim-footer {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.audio-trim-btn {
  flex: 1 1 0;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.audio-trim-btn--primary {
  background: var(--primary, #6366f1);
  color: #fff;
}

.audio-trim-btn--secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #f6f7fb);
}

.audio-trim-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.audio-trim-modal.is-busy .audio-trim-wave {
  pointer-events: none;
  opacity: 0.6;
}

/* Слот загрузки, когда суммарный бюджет аудио исчерпан */
.upload-slot--exhausted {
  opacity: 0.5;
  cursor: not-allowed;
  border-style: dotted;
}

@media (max-width: 360px) {
  .audio-trim-modal {
    padding: 16px;
  }

  .audio-trim-footer {
    flex-direction: column-reverse;
  }
}
