/* Общие стили */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  color: #333;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Поля ввода */
textarea {
  width: 100%;
  padding: 8px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1em;
  resize: vertical;
}

/* --- Кнопки --- */
button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  transition: background 0.2s ease, transform 0.1s ease;
}

button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* Контейнер кнопок */
.buttons-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 30px 0;
}

/* --- ПК версия --- */
@media (min-width: 769px) {
  .buttons-container {
    flex-direction: row;
    align-items: stretch;
  }

  #translateBtn {
    flex: 1 1 100%;
    background: #1976d2;
  }

  .buttons-pair {
    display: flex;
    flex: 1 1 50%;
    gap: 12px;
  }

  .buttons-pair button {
    flex: 1;
  }
}

/* --- Мобильная версия --- */
@media (max-width: 768px) {
  .container {
    padding: 20px;
    margin: 10px;
  }

  .buttons-container {
    flex-direction: column;
  }

  #translateBtn {
    width: 100%;
    background: #1976d2;
  }

  .buttons-pair {
    display: flex;
    gap: 12px;
    width: 100%;
  }

  .buttons-pair button {
    flex: 1;
  }
}

/* --- Индивидуальные кнопки --- */
#stopBtn { background: #e53935; }
#resumeBtn { background: #2196f3; }
#resetBtn { background: #4caf50; }
#downloadBtn { background: #ff9800; }

/* --- Иконки через псевдоэлементы --- */
#translateBtn::before { content: "🌍"; }
#stopBtn::before { content: "⏹"; }
#resumeBtn::before { content: "▶️"; }
#resetBtn::before { content: "♻"; }
#downloadBtn::before { content: "💾"; }

/* Прогресс */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  font-size: 0.9em;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

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

/* Блоки результатов */
.language-block {
  border: 1px solid #eee;
  padding: 24px;
  margin: 20px 0;
  border-radius: 6px;
  background: #f9f9f9;
}

.language-block h3 {
  margin: 0 0 0 0;
  color: #007cba;
  font-size: 1.1em;
}

/* Заголовки текстов */
.text-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95em;
}

.text-header strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.copy-btn {
  margin: 16px 0;
  padding: 6px 10px;
  background: #1976d2;
  color: white;
  border-radius: 4px;
  font-size: 0.9em;
  white-space: nowrap;
  width: auto;
}

.copy-btn:hover {
  background: #0d47a1;
}

.copy-btn.copied {
  background: #388e3c;
}

/* Текст перевода */
.translated-text pre {
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.95em;
  line-height: 1.4;
}

/* --- Кнопка "Наверх" --- */
#scrollTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scrollTopBtn:hover {
  background: #0d47a1;
  transform: translateY(-2px);
}

#scrollTopBtn.show {
  opacity: 1;
  visibility: visible;
}

/* --- Адаптив для мобильных --- */
@media (max-width: 768px) {
  #scrollTopBtn {
    width: 56px;
    height: 56px;
    bottom: 16px;
    right: 16px;
    font-size: 1.6em;
  }
}