/* --- Секция загрузки видео и субтитров --- */
.upload-section {
  background: #ffffff;
  padding: 30px 25px;
  border-radius: 14px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
  max-width: 720px;
  margin: 0 auto 40px auto;
  font-size: 16px;
  color: #2c2c2c;
}

.upload-step {
  margin-bottom: 28px;
}

.upload-step h2 {
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 1.4rem;
  color: #222;
}

.file-label {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #0d6efd;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.file-label:hover {
  color: #084298;
}

.file-input {
  display: block;
  margin-top: 10px;
  font-size: 1rem;
  cursor: pointer;
}

/* Прогресс бар */
.progress-container {
  background: #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  height: 18px;
  margin: 15px 0 8px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #81c784);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 12px 0 0 12px;
}

.info-text {
  font-size: 0.95rem;
  color: #444;
  min-height: 20px;
  font-style: italic;
}

/* --- Контейнер видео и стилей субтитров --- */
.video-style-wrapper {
  display: flex;
  gap: 25px;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}



.video-container {
  position: relative; 
  flex: 0 0 640px;
  height: 360px;
  transition: width .3s, height .3s;
}
/* портретный режим */
.video-container.portrait {
  flex: 0 0 360px;   
  height: 640px;    
}

#video {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 12px;
}

/* Субтитры на видео */
.subtitle-overlay {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  width: 100%;          
  box-sizing: border-box; 
  padding: 0 15px;

 
}
/* Редактор стиля субтитров */
.style-editor {

  max-width: 100%;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  padding: 20px;


  gap: 16px;
  font-size: 1rem;
  color: #333;
  height: 360px;
  box-sizing: border-box;
}


/* Адаптивность для style-editor: одна колонка на мобильных */
@media (max-width: 720px) {
  .style-editor {
    flex-direction: column;
    height: auto;
  }
  .style-editor > * {
    width: 100%;
  }
}

/* Подписи */
.editor-label {
  display: block;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.editor-hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: #666;
  margin-top: 2px;
}

.editor-value {
  float: right;
  font-weight: 700;
  color: #222;
}

/* Элементы управления */
.color-input,
.range-input,
.select-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1.8px solid #ccc;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.color-input:hover,
.range-input:hover,
.select-input:hover {
  border-color: #0d6efd;
  cursor: pointer;
}

.range-input {
  -webkit-appearance: none;
  height: 10px;
  background: #ddd;
  border-radius: 6px;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #0d6efd;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  margin-top: -5px;
  transition: background 0.3s ease;
}

.range-input::-webkit-slider-thumb:hover {
  background: #084298;
}

.select-input {
  cursor: pointer;
}

/* Кнопка сброса стиля */
.reset-button {
  width: 100%;
  padding: 10px 0;
  background: #e0e7ff;
  border: none;
  border-radius: 8px;
  color: #333;
  font-weight: 400;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.3s ease, color 0.3s ease;
}

.reset-button:hover,
.reset-button:focus {
  background: #c7d2fe;
  color: #000;
}

.subtitle-editor {
  background: #fafafa;
  border-radius: 14px;
  padding: 27px 32px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  font-size: 1.55rem;
  color: #333;
  min-height: 243px;
  flex: 1 1 380px;
  max-width: 40%;
  overflow-y: auto;
  line-height: 1.6;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.subtitle-editor:hover,
.subtitle-editor:focus-within {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background-color: #fff;
}

.subtitle-editor--limited {
  max-width: 800px;
  margin: 27px auto;
  padding: 27px 32px;
  border-radius: 14px;
  color: #555;
  background: #f9f9f9;
  box-sizing: border-box;
  min-height: 243px;
  overflow-y: auto;
  font-style: normal;
}

.subtitle-editor em {
  color: #888;
  font-style: italic;
  user-select: none;
  font-size: 1.55rem;
}


/* --- Кнопки действий --- */
.action-buttons {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 20px 0 40px;
  flex-wrap: wrap;
}

.action-buttons button {
  min-width: 220px;
  padding: 14px 22px;
  font-size: 1.1rem;
  border-radius: 14px;
  background: #198754;
  color: #fff;
  box-shadow: 0 6px 18px rgba(25,135,84,0.5);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.action-buttons button:disabled {
  background: #b5b5b5;
  box-shadow: none;
  cursor: not-allowed;
}

.action-buttons button:hover:not(:disabled) {
  background: #145c32;
  box-shadow: 0 8px 24px rgba(20,92,50,0.7);
}

.action-buttons i {
  margin-right: 10px;
  font-size: 1.2rem;
  vertical-align: middle;
}

/* --- Видео и управление воспроизведением --- */
.controls-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.video-time-display {
  background: #e9ecef;
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 1.3rem;
  color: #212529;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  min-width: 180px;
  text-align: center;
}

.btn-circle {
  font-size: 36px;
  padding: 20px 32px;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(13,110,253,0.5);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.btn-circle:hover {
  background: #084298;
  box-shadow: 0 8px 24px rgba(8,66,152,0.7);
}

#playPauseBtn::before {
  content: "\f04b";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

#playPauseBtn.pause::before {
  content: "\f04c";
}

/* --- Адаптивность на узких экранах --- */
@media (max-width: 960px) {
  .video-style-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .video-container,
  .style-editor,
  .subtitle-editor {
    width: 100% !important;
    max-width: 100% !important;
    flex: none;
    margin-bottom: 20px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 18px;
  }

  .action-buttons button {
    min-width: 100%;
  }
}

/* --- Общее для body и заголовков --- */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f2f6fb;
  margin: 0;
  padding: 20px 25px 60px;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-header {
  text-align: center;
  margin-bottom: 35px;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a1a;
}

.page-header .subtitle-desc {
  font-size: 1.1rem;
  color: #555;
  margin-top: 12px;
  font-weight: 400;
}

/* --- Подсказки и информация --- */
.help-section {
  max-width: 720px;
  margin: 40px auto 0 auto;
  background: #fff;
  padding: 30px 30px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.07);
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
}

.help-section h2,
.help-section h3 {
  color: #2c2c2c;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
}

.help-section ul {
  margin-left: 18px;
  margin-bottom: 20px;
  color: #444;
}

.help-section li {
  margin-bottom: 8px;
}

.nav-back {
  margin-bottom: 20px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: #f0f0f0;
  color: #333;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
}

.btn-back i {
  font-size: 1.3rem;
  transition: transform 0.3s ease;
}

.btn-back:hover,
.btn-back:focus {
  background-color: #007bff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,123,255,0.5);
  outline: none;
}

.btn-back:hover i,
.btn-back:focus i {
  transform: translateX(-4px);
}
.embed-result {
  border: 1px solid #d0d7de;
  background-color: #f9f9f9;
  padding: 24px 28px;
  border-radius: 10px;
  font-size: 1.4rem;
  color: #222;
  line-height: 1.6;
  margin-top: 24px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
  font-weight: 500;
}
.editor-container {
  display: flex;
  gap: 24px; /* Отступ между колонками */
  max-width: 900px; /* или другой подходящий max-width */
  margin: 27px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 20px; /* расстояние между кнопкой и таймкодом */
  min-width: 180px; /* минимальная ширина для контролов */
  align-items: center; /* центрируем элементы по горизонтали */
}

/* Сделаем subtitleEditor занимать оставшееся место */
.subtitle-editor {
  flex: 1 1 auto;
  max-width: none; /* снимаем ограничение max-width 40%, чтобы он занимал больше места */
  min-width: 0; /* чтобы flex корректно работал */
  margin: 0; /* сбрасываем марджин, т.к. задал общий для контейнера */
}

/* Можно уменьшить max-width для limited, чтобы не мешать разметке */
.subtitle-editor--limited {
  max-width: none;
  background: #f9f9f9;
}

.notice-box {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}
.translate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background-color: transparent;
  color: #4a90e2;
  text-decoration: underline;
  border-radius: 0;
  font-weight: normal;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.95rem;
  box-shadow: none;
  transition: color 0.2s ease;
  user-select: none;
}

.translate-link:hover {
  color: #357abd;
  text-decoration: none;
}
.translate-link i {
  font-size: 1.75rem;
  line-height: 1;
}

.centered-info {
  text-align: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;

  max-width: 480px;
  margin: 20px auto;
  line-height: 1.5;
}

.centered-info i {
  vertical-align: middle;

  margin: 0 6px;
  transition: transform 0.3s ease;
}

.warning-icon {
  font-size: 1.3em;
  color: #f44336; 
}

.rocket-icon {
  font-size: 1.2em;
  color: #4caf50;
}

.language-icon {
  font-size: 1.5em; 
  color: #2196f3;
  margin-right: 8px;
}

.highlight-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.highlight-link:hover,
.highlight-link:focus {
  color: #0056b3;
  border-color: #0056b3;
  outline: none;
  cursor: pointer;
}

.translate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 1.05rem;
}

.centered-info i:hover {
  transform: scale(1.2);
}



.video-slider-wrapper {
  width: 640px;
  margin: 8px auto 8px auto; /* центрируем по горизонтали */
  padding: 0;
}

.video-slider {
  width: 100%;
  height: 30px; /* увеличили высоту */
  border-radius: 6px;
  background-color: #ddd;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* Для Chrome, Safari, Edge */
.video-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
  margin-top: -2px; /* выравниваем по центру полосы */
}

/* Для Firefox */
.video-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #333;
  cursor: pointer;
}

/* Общие стили для мобильных устройств */
@media (max-width: 768px) {

  body {
    font-size: 16px;
    padding: 0 10px;
  }

  .header-center,
  .nav-back,
  .page-header {
    text-align: center;
  }

  .nav-back {
    margin-top: 10px;
  }

  .nav-back .btn-back {
    display: inline-block;
    font-size: 1rem;
    padding: 8px 12px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .page-header p.subtitle-desc {
    font-size: 0.95rem;
  }

  .video-style-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .video-container {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  #video {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .style-editor {
    width: 100%;
    height: auto;
    padding: 16px;
    font-size: 0.95rem;
  }

  .subtitle-editor--limited {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    font-size: 1.2rem;
  }

  .video-slider-wrapper {
    padding: 0 10px;
  }

  .controls-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
  }

  .action-buttons button {
    width: 100%;
    max-width: 90%;
    font-size: 1rem;
  }

  .help-section {
    padding: 0 10px;
  }

  .centered-info {
    text-align: center;
    font-size: 0.95rem;
  }
}
/* Корректируем ширину ползунка и редактора на мобильных */
@media (max-width: 960px) {
  /* Убираем фиксированную ширину контейнера ползунка */
  .video-slider-wrapper {
    width: 100% !important;
    margin: 8px auto;
    padding: 0 10px;
  }
  /* Ползунок растягиваем по ширине родителя */
  .video-slider {
    width: 100% !important;
  }

  /* На мобильных пусть редактор субтитров и контролы идут в колонку */
  .editor-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  /* Редактор субтитров во всю ширину */
  .subtitle-editor,
  .subtitle-editor--limited {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px;
    font-size: 1.2rem;
  }

  /* Контейнер с кнопками управления видео */
  .controls-section {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
}
@media (max-width: 960px) {
  /* уже есть flex-direction: column для .video-style-wrapper */
  .video-style-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Стили для панели редактирования стиля: пусть будет первой */
  .style-editor {
    order: -1;
    width: 100% !important;
    margin-bottom: 20px;
  }

  /* Видео после панели */
  .video-container {
    order: 0;
    width: 100% !important;
    height: auto;
    aspect-ratio: 16 / 9;
    margin-bottom: 20px;
  }
}
.subs-timeline-wrapper {
  margin: 14px auto 10px;
  text-align: center;
  user-select: none;
}
#subsTimeline {
  cursor: pointer;
  border: 1.5px solid #bbb;
  border-radius: 12px;
  transition: box-shadow .15s;
  box-shadow: 0 1px 12px #0001;
}
#subsTimeline:active { box-shadow: 0 0 0 3px #abd4ff88; }ine:active { box-shadow: 0 0 0 3px #abd4ff88; }Timeline:active { box-shadow: 0 0 0 2px #bdf7!important; }

@media (max-width:700px) {
  .subs-timeline-wrapper,
  .subs-timeline-wrapper > div,
  .subs-timeline-wrapper canvas {
    max-width: 100vw!important;
    min-width: 0;
    width: 100vw!important;
    height: 75px!important;
    max-height:80px;
    touch-action: pan-x; /* чтобы можно было свайпать */
  }
}
@media (max-width:440px) {
  .subs-timeline-wrapper canvas {
    height: 58px!important;
    max-height:66px;
  }
}
.subs-timeline-wrapper {
  margin: 8px auto 8px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}
#subsTimeline {
  width: 100%;
  height: 150px;
  max-width:1700px;
  background: #23252618;
  border-radius: 10px;
  border: 1.5px solid #bbb;
  display: block;
  box-shadow: 0 1px 12px #0001;
  transition: box-shadow .15s;
}
@media (max-width:1000px){
  #subsTimeline { height: 90px;}
}

.upload-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.upload-block {
  flex: 1 1 45%;
  background-color: #f9f9f9;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.upload-block h2 {
  margin-top: 0;
}

.divider {
  text-align: center;
  font-weight: bold;
  margin: 1rem 0;
}

.centered-info {
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.warning-icon, .rocket-icon, .language-icon {
  margin: 0 5px;
  color: #f39c12;
}

@media (max-width: 768px) {
  .upload-columns {
    flex-direction: column;
  }

  .upload-block {
    flex: 1 1 100%;
  }
}

 .language-switch {
            font-size: 24px;
            font-weight: bold;
            margin: 20px;
            display: inline-flex;
            align-items: center;
            text-decoration: none;
            color: #333;
        }
        .language-switch i {
            margin-right: 10px;
        }
        .language-switch:hover {
            color: #007BFF;
        }
