/* ==========================================================================
   Zvukogram Delta CSS for /video-audio/
   Подключать ПОСЛЕ /design/css/style.css, /assets/audio-extract/app.css
   и /assets/audio-extract/youtube-audio-zg.css (только при $this->videoPage).

   Базовый Hero, карточка 860px, плеер F3, модалка 860px, ошибки и все 7 секций
   лендинга наследуются напрямую из youtube-audio-zg.css без дублирования.
   Здесь только уникальная видео-специфика (#audio-extract.ae-video / .ae-hero-video).
   ========================================================================== */

/* 1. Фон Hero BG-1 (монтажный таймлайн: V1 слева -> A1 справа, тихий 50% opacity) */
.ae-hero-video .ae-bg-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 1440px;
  height: 520px;
  max-width: none;
  opacity: 0.5;
}

@media (max-width: 1120px) {
  .ae-hero-video .ae-bg-stage {
    display: none;
  }
}

/* 2. Переключатель источника: Загрузить видео | Ссылка или Диск */
#audio-extract.ae-video .ae-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}

#audio-extract.ae-video .ae-tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 3px;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f1f5f9;
  width: auto;
  max-width: 100%;
}

#audio-extract.ae-video .ae-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--zg-muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

#audio-extract.ae-video .ae-tabs button svg {
  flex-shrink: 0;
  opacity: 0.8;
}

#audio-extract.ae-video .ae-tabs button:hover {
  color: var(--zg-ink);
}

#audio-extract.ae-video .ae-tabs button[aria-selected="true"] {
  background: #ffffff;
  border-color: #d8e1ee;
  color: var(--zg-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

#audio-extract.ae-video .ae-tabs button[aria-selected="true"] svg {
  color: var(--zg-blue);
  opacity: 1;
}

#audio-extract.ae-video .ae-source-formats {
  font-size: 12.5px;
  color: var(--zg-muted);
  font-variant-numeric: tabular-nums;
}

#audio-extract.ae-video .ae-source-formats strong {
  color: var(--zg-lead);
  font-weight: 600;
}

/* 3. Прогрессивная дропзона файла по центральной оси (.ae-drop-shell + #ae-drop) */
#audio-extract.ae-video .ae-drop-shell {
  border: 1.5px dashed #94a3b8;
  border-radius: 12px;
  background: var(--zg-surface-inset);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#audio-extract.ae-video .ae-drop-shell:hover:not(.is-selected) {
  border-color: var(--zg-blue);
  background: #f4f7ff;
}

#audio-extract.ae-video .ae-drop-shell:has(.ae-drop.dragging) {
  border-style: solid;
  border-color: var(--zg-blue);
  background: #eef4ff;
  box-shadow: 0 0 0 3px rgba(46, 88, 239, 0.14);
}

#audio-extract.ae-video .ae-drop-shell:has(#ae-file:focus-visible) {
  outline: 3px solid var(--zg-blue);
  outline-offset: 2px;
}

#audio-extract.ae-video .ae-drop-shell.is-selected {
  border-style: solid;
  border-color: rgba(46, 88, 239, 0.42);
  background: #f4f8ff;
}

#audio-extract.ae-video .ae-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 24px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: center;
  cursor: pointer;
}

#audio-extract.ae-video .ae-drop:focus-within {
  outline: none;
}

#audio-extract.ae-video .ae-drop.dragging {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#audio-extract.ae-video .ae-drop-shell.is-selected .ae-drop {
  padding: 24px 24px 16px;
}

#audio-extract.ae-video .ae-demux-emblem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--zg-border);
  color: var(--zg-body);
  margin-bottom: 2px;
}

#audio-extract.ae-video .ae-demux-emblem .ae-ico-video {
  color: var(--zg-lead);
}

#audio-extract.ae-video .ae-demux-emblem .ae-ico-sep {
  color: #94a3b8;
}

#audio-extract.ae-video .ae-demux-emblem .ae-ico-wave {
  color: var(--zg-blue);
}

#audio-extract.ae-video .ae-drop-shell.is-selected .ae-demux-emblem {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

#audio-extract.ae-video .ae-drop-shell.is-selected .ae-demux-emblem .ae-ico-video,
#audio-extract.ae-video .ae-drop-shell.is-selected .ae-demux-emblem .ae-ico-wave {
  color: #047857;
}

#audio-extract.ae-video .ae-drop-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

#audio-extract.ae-video .ae-drop-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

#audio-extract.ae-video #ae-file-label {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--zg-ink);
  overflow-wrap: anywhere;
}

#audio-extract.ae-video .ae-drop-shell.is-selected #ae-file-label {
  color: #1e3a8a;
}

#audio-extract.ae-video .ae-drop-sub {
  font-size: 13px;
  line-height: 1.45;
  color: var(--zg-muted);
}

/* Шаг 1 (пусто): единственная главная синяя кнопка «Выбрать видеофайл» (#2e58ef, r8, 48px) */
#audio-extract.ae-video .ae-file-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 26px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--zg-blue);
  background: var(--zg-blue);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

#audio-extract.ae-video .ae-drop:hover .ae-file-pick {
  background: var(--zg-blue-hover);
  border-color: var(--zg-blue-hover);
  color: #ffffff;
}

#audio-extract.ae-video .ae-drop:active .ae-file-pick {
  transform: scale(0.98);
}

#audio-extract.ae-video .ae-drop-shell.is-selected .ae-file-pick {
  display: none;
}

/* Шаг 2 (файл выбран): #ae-start («Извлечь аудио») + «Другой файл» по центру внутри рамки */
#audio-extract.ae-video .ae-staged-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px 24px;
}

#audio-extract.ae-video.js-ae-ui .ae-drop-shell:not(.is-selected) .ae-staged-actions {
  display: none;
}

#audio-extract.ae-video .ae-start-slot {
  display: inline-flex;
  flex-shrink: 0;
}

#audio-extract.ae-video .ae-start-slot:empty {
  display: none;
}

#audio-extract.ae-video .ae-change-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--zg-body);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background-color 0.14s ease;
}

#audio-extract.ae-video .ae-change-file:hover {
  border-color: var(--zg-blue);
  color: var(--zg-blue);
  background: #ffffff;
}

/* 4. Вкладка «Ссылка или Диск» (тихий крестик очистки × + единые радиусы 8px) */
#audio-extract.ae-video .ae-url-field,
#audio-extract.ae-video #ae-start,
#audio-extract.ae-video .ae-primary,
#audio-extract.ae-video .ae-secondary,
#audio-extract.ae-video .ae-error-panel {
  border-radius: 8px;
}

#audio-extract.ae-video .ae-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

#audio-extract.ae-video .ae-clear-btn:hover {
  background: #e2e8f0;
  color: var(--zg-ink);
}

#audio-extract.ae-video .ae-cloud-hint {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--zg-muted);
}

#audio-extract.ae-video #ae-input[hidden] ~ .ae-card-foot {
  display: none;
}

#audio-extract.ae-video .ae-input-links a {
  color: var(--zg-muted);
  transition: color 0.14s ease;
}

#audio-extract.ae-video .ae-input-links a:hover {
  color: var(--zg-blue);
}

/* Спокойный контурный hover кнопки сброса ошибки (без красной заливки) */
#audio-extract.ae-video #ae-reset {
  border-color: #cbd5e1;
  color: var(--zg-ink);
}

#audio-extract.ae-video #ae-reset:hover {
  background: #ffffff;
  border-color: var(--zg-blue);
  color: var(--zg-blue);
}

/* 5. Чанковая загрузка до 1 ГБ (#ae-upload) */
#audio-extract.ae-video #ae-upload {
  background: #f8fafc;
  border: 1px solid var(--zg-border);
  border-radius: 12px;
  padding: 20px 22px;
}

#audio-extract.ae-video .ae-upload-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 12px;
}

#audio-extract.ae-video #ae-upload-name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--zg-muted);
  font-variant-numeric: tabular-nums;
}

#audio-extract.ae-video progress#ae-progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 10px;
  margin: 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

#audio-extract.ae-video progress#ae-progress::-webkit-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
}

#audio-extract.ae-video progress#ae-progress::-webkit-progress-value {
  background: var(--zg-blue);
  border-radius: 999px;
  transition: width 0.2s ease;
}

#audio-extract.ae-video progress#ae-progress::-moz-progress-bar {
  background: var(--zg-blue);
  border-radius: 999px;
}

#audio-extract.ae-video .ae-upload-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--zg-muted);
  font-variant-numeric: tabular-nums;
}

#audio-extract.ae-video .ae-upload-meta #ae-progress-text {
  color: var(--zg-ink);
  font-weight: 600;
}

#audio-extract.ae-video #ae-upload .ae-actions {
  margin: 16px 0 10px;
  gap: 14px;
}

#audio-extract.ae-video #ae-upload .ae-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--zg-muted);
}

/* 6. Докачка при обрыве связи (#ae-resume — сверху рабочей карточки) */
#audio-extract.ae-video #ae-resume.ae-resume {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  color: var(--zg-ink);
}

#audio-extract.ae-video #ae-resume strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #92400e;
}

#audio-extract.ae-video #ae-resume strong::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23b45309' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
}

#audio-extract.ae-video #ae-resume p {
  margin: 6px 0 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #78350f;
  font-variant-numeric: tabular-nums;
}

#audio-extract.ae-video .ae-resume-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

#audio-extract.ae-video #ae-resume button {
  margin-right: 0;
}

/* 7. Значок аудиодорожки в #ae-result, когда у локального видео нет обложки */
#audio-extract.ae-video .ae-audio-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: var(--zg-blue);
}

#audio-extract.ae-video .ae-player-heading:has(#ae-result-cover:not([hidden])) .ae-audio-badge-icon {
  display: none;
}

/* 8. Мобильная адаптивность до 370px и 360px (0 обрезаний, 0 переполнений) */
@media (max-width: 768px) {
  #audio-extract.ae-video .ae-tabs {
    width: 100%;
  }
  #audio-extract.ae-video .ae-tabs button {
    flex: 1 1 50%;
    justify-content: center;
    padding: 8px 10px;
    font-size: 13px;
  }
  #audio-extract.ae-video .ae-source-formats {
    display: none;
  }
  #audio-extract.ae-video .ae-drop,
  #audio-extract.ae-video .ae-drop-shell.is-selected .ae-drop {
    padding: 22px 16px 16px;
  }
  #audio-extract.ae-video .ae-file-pick {
    width: 100%;
  }
  #audio-extract.ae-video .ae-staged-actions {
    flex-direction: column;
    align-items: stretch;
    padding: 0 16px 18px;
  }
  #audio-extract.ae-video .ae-start-slot,
  #audio-extract.ae-video .ae-change-file {
    width: 100%;
  }
  #audio-extract.ae-video #ae-upload {
    padding: 16px;
  }
  #audio-extract.ae-video .ae-resume-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #audio-extract.ae-video #ae-resume-pick {
    width: 100%;
  }
  #audio-extract.ae-video #ae-resume-cancel {
    text-align: center;
    padding: 8px 0;
  }
  #audio-extract.ae-video .ae-player-card {
    padding: 14px 14px 16px;
  }
  #audio-extract.ae-video .ae-video-cover {
    width: 84px;
  }
  #audio-extract.ae-video .ae-playback {
    gap: 8px;
  }
  #audio-extract.ae-video .ae-time {
    font-size: 12px;
    min-width: 34px;
  }
}

@media (max-width: 560px) {
  .ae-hero-video .ae-quiet-spec__row {
    white-space: normal;
  }
  #audio-extract.ae-video .ae-meta-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  #audio-extract.ae-video .ae-meta-dot {
    display: none;
  }
  #audio-extract.ae-video dialog.ae-modal {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 24px);
    border-radius: 12px;
  }
  #audio-extract.ae-video .ae-work-top {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  #audio-extract.ae-video .ae-work-top .ae-work-head {
    order: 0;
    flex: 0 0 auto;
    flex-basis: auto;
    min-width: 0;
    gap: 12px;
  }
  #audio-extract.ae-video .ae-spinner {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
  }
  #audio-extract.ae-video .ae-spinner::after {
    inset: 8px;
  }
  #audio-extract.ae-video #ae-work-title {
    font-size: 17px;
    line-height: 1.25;
  }
  #audio-extract.ae-video #ae-work-description {
    font-size: 13.5px;
  }
  #audio-extract.ae-video .ae-work-cancel {
    order: 1;
    margin-left: 0;
    width: 100%;
    min-height: 40px;
  }
  #audio-extract.ae-video .ae-work-body .ae-video-summary {
    gap: 12px;
    padding: 12px 14px;
    font-size: 14px;
  }
  #audio-extract.ae-video .ae-work-body .ae-video-cover {
    width: 84px;
  }
}

@media (max-width: 400px) {
  .ae-hero-video .containerv2 {
    padding: 0 12px;
  }
  #audio-extract.ae-video h1.ae-h1 {
    font-size: 23px;
  }
  #audio-extract.ae-video .ae-tool.ae-workspace {
    padding: 16px 14px;
  }
  #audio-extract.ae-video .ae-tabs button {
    padding: 8px 6px;
    gap: 5px;
    font-size: 12.5px;
  }
  #audio-extract.ae-video .ae-tabs button svg {
    width: 14px;
    height: 14px;
  }
  #audio-extract.ae-video .ae-file-pick,
  #audio-extract.ae-video #ae-start,
  #audio-extract.ae-video .ae-transcribe-cta {
    padding: 11px 14px;
    font-size: 14px;
  }
  #audio-extract.ae-video .ae-video-cover,
  #audio-extract.ae-video .ae-work-body .ae-video-cover {
    width: 72px;
  }
}
