/* Стили для ReDoc документации Huntio */
.custom-header {
  background: #000000;
  color: #ffea3b;
  padding: 0.8rem 1rem; /* Уменьшили padding для мобильных */
  border-bottom: 2px solid #ffea3b;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px; /* Фиксированная высота */
  box-sizing: border-box;
  gap: 1rem; /* Добавим gap для мобильных */
}

/* Контейнер для логотипа и текста */
.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0; /* Для правильного обрезания текста */
  flex: 1; /* Занимает доступное пространство */
}

/* Логотип */
.header-logo {
  height: 35px; /* Компактный размер */
  width: auto;
  flex-shrink: 0; /* Не сжимается */
}

/* Текстовая часть */
.header-text {
  min-width: 0; /* Для правильного обрезания текста */
  flex: 1; /* Растягивается */
}

.header-text h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffea3b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Обрезаем длинные заголовки */
}

.header-text .subtitle {
  color: #cccccc;
  font-size: 0.85rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Обрезаем длинные подзаголовки */
}

/* Кнопка "На главную" */
.header-back {
  display: flex;
  align-items: center;
  flex-shrink: 0; /* Не сжимается */
}

.back-link {
  color: #ffea3b;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  white-space: nowrap;
}

.back-link:hover {
  color: #ffc400;
  text-decoration: underline;
}

/* Контейнер для ReDoc */
.redoc-container {
  margin-top: 60px; /* Соответствует высоте header */
}

/* Убираем стандартные отступы body */
body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

/* ========== АДАПТИВНОСТЬ ========== */

/* Планшеты (768px - 1024px) */
@media (max-width: 1024px) {
  .custom-header {
    padding: 0.7rem 1rem;
    height: 55px;
  }

  .header-logo {
    height: 30px;
  }

  .header-text h1 {
    font-size: 1.1rem;
  }

  .header-text .subtitle {
    font-size: 0.8rem;
  }

  .back-link {
    font-size: 0.85rem;
  }

  .redoc-container {
    margin-top: 55px;
  }
}

/* Мобильные устройства (480px - 768px) */
@media (max-width: 768px) {
  .custom-header {
    padding: 0.6rem 0.8rem;
    height: 50px;
    gap: 0.8rem;
  }

  .header-content {
    gap: 0.8rem;
  }

  .header-logo {
    height: 25px;
  }

  .header-text h1 {
    font-size: 1rem;
  }

  .header-text .subtitle {
    font-size: 0.75rem;
  }

  .back-link {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 234, 59, 0.1);
    border-radius: 4px;
  }

  .redoc-container {
    margin-top: 50px;
  }
}

/* Маленькие мобильные (до 480px) */
@media (max-width: 480px) {
  .custom-header {
    padding: 0.5rem 0.6rem;
    height: 45px;
    gap: 0.6rem;
  }

  .header-content {
    gap: 0.6rem;
  }

  .header-logo {
    height: 22px;
  }

  .header-text h1 {
    font-size: 0.9rem;
  }

  .header-text .subtitle {
    display: none; /* Скрываем подзаголовок на очень маленьких экранах */
  }

  .back-link {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .back-link span {
    display: none; /* Скрываем текст, оставляем только стрелку */
  }

  .back-link::before {
    content: "←";
  }

  .redoc-container {
    margin-top: 45px;
  }
}

/* Очень маленькие экраны (до 360px) */
@media (max-width: 360px) {
  .custom-header {
    padding: 0.4rem 0.5rem;
    height: 40px;
  }

  .header-logo {
    height: 20px;
  }

  .header-text h1 {
    font-size: 0.8rem;
  }

  .back-link {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .redoc-container {
    margin-top: 40px;
  }
}

/* Ландшафтная ориентация мобильных */
@media (max-height: 500px) and (orientation: landscape) {
  .custom-header {
    height: 45px;
    padding: 0.5rem 1rem;
  }

  .header-logo {
    height: 25px;
  }

  .redoc-container {
    margin-top: 45px;
  }
}

/* Высокопиксельные экраны (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .header-logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Темная тема системных настроек */
@media (prefers-color-scheme: dark) {
  /* Уже используем темную тему, но можно добавить дополнительные стили */
  .custom-header {
    background: #000000;
  }
}

/* Адаптация для touch устройств */
@media (hover: none) and (pointer: coarse) {
  .back-link:hover {
    color: #ffea3b; /* Отключаем hover эффекты для тач устройств */
    text-decoration: none;
  }

  .back-link:active {
    color: #ffc400;
    background: rgba(255, 234, 59, 0.2);
  }
}
