/**
 * =============================================================================
 * @encoding UTF-8
 * @author [Zerohold](//zerohold.sd1.su)
 * @project [SD1](services.sd1.su)
 * @summary SD1 › API Tester - Стили
 * @created 2026-10
 * @modified 2026-10
 *
 * @file D:\node\sd1.su\services.sd1.su\api-tester\css/styles.css
 *
 * @remarks
 * - Адаптивные стили для формы тестирования API.
 * - Monospace шрифт для всех полей ввода.
 * - Компактное отображение метода HTTP с URL (как в Postman).
 * =============================================================================
 */

/* Контейнер API тестера */
.api-tester
{
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

/* Панели ввода и результатов */
.input-panel,
.results-panel
{
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.panel-title
{
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #333333;
}

/* Группы полей ввода */
.input-group
{
  margin-bottom: 20px;
}

.input-label
{
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333333;
  font-size: 0.95rem;
}

.required-mark
{
  color: #dc3545;
  margin-left: 4px;
}

.optional-mark
{
  color: #6c757d;
  margin-left: 4px;
  cursor: help;
}

/* Иконка информации в метке опционального поля: размер по высоте текста метки */
.optional-mark.icon
{
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: middle;
}

/* Контейнер для метода HTTP и URL (как в Postman) */
.url-method-container
{
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* Обёртка-метка вокруг выпадающего списка метода HTTP */
.method-label
{
  display: flex;
  margin: 0;
}

/* Скрытие текста метки визуально, но сохранение для скринридеров */
.visually-hidden
{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Выпадающий список метода HTTP */
.method-select
{
  min-width: 110px;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #f8f9fa;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Courier New', Courier, monospace;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s;
}

.method-select:hover
{
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.method-select:focus
{
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Поле ввода URL */
.url-input
{
  flex: 1;
}

/* Стили полей ввода */
.input-style,
.textarea-style
{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: 'Courier New', Courier, monospace;
  color: #495057;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.input-style:focus,
.textarea-style:focus
{
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.textarea-style
{
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

/* Легенда полей */
.legend-container
{
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #6c757d;
}

.legend-item
{
  display: flex;
  align-items: center;
}

/* Контейнер кнопок */
.button-container
{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Единый контейнер результата */
.result-single
{
  display: flex;
  flex-direction: column;
}

.result-label
{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333333;
  font-size: 0.95rem;
}

/* Единый Textarea для запроса и ответа (Markdown) */
.result-textarea-combined
{
  width: 100%;
  padding: 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Courier New', Courier, monospace;
  color: #212529;
  background-color: #f8f9fa;
  resize: vertical;
  min-height: 500px;
  line-height: 1.5;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.result-textarea-combined:focus
{
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Цветная метка HTTP-статуса ответа */
.http-status-badge
{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Courier New', Courier, monospace;
  border-left: 4px solid #6c757d;
  background-color: #f8f9fa;
  color: #495057;
}

/* Цветной индикатор (кружок) статуса */
.http-status-dot
{
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #6c757d;
}

/* Подпись "HTTP код:" */
.http-status-label
{
  font-weight: 500;
  color: #6c757d;
}

/* Значение HTTP-кода */
.http-status-code
{
  font-weight: 700;
  font-size: 1rem;
}

/* Текстовое пояснение статуса */
.http-status-text
{
  font-weight: 500;
  opacity: 0.85;
}

/* Успешный статус (2xx) - зелёный */
.http-status-badge.is-2xx
{
  border-left-color: #28a745;
  background-color: #e8f5e9;
  color: #155724;
}

.http-status-badge.is-2xx .http-status-dot
{
  background-color: #28a745;
}

.http-status-badge.is-2xx .http-status-label
{
  color: #155724;
}

/* Статус перенаправления (3xx) - жёлтый */
.http-status-badge.is-3xx
{
  border-left-color: #ffc107;
  background-color: #fff8e1;
  color: #856404;
}

.http-status-badge.is-3xx .http-status-dot
{
  background-color: #ffc107;
}

.http-status-badge.is-3xx .http-status-label
{
  color: #856404;
}

/* Клиентская ошибка (4xx) - оранжевый */
.http-status-badge.is-4xx
{
  border-left-color: #fd7e14;
  background-color: #fff3e0;
  color: #b34700;
}

.http-status-badge.is-4xx .http-status-dot
{
  background-color: #fd7e14;
}

.http-status-badge.is-4xx .http-status-label
{
  color: #b34700;
}

/* Серверная ошибка (5xx) - красный */
.http-status-badge.is-5xx
{
  border-left-color: #dc3545;
  background-color: #fdecea;
  color: #a71d2a;
}

.http-status-badge.is-5xx .http-status-dot
{
  background-color: #dc3545;
}

.http-status-badge.is-5xx .http-status-label
{
  color: #a71d2a;
}

/* Подсказка под результатом */
.result-hint
{
  margin-top: 12px;
  padding: 12px;
  background-color: #e7f3ff;
  border-left: 4px solid #007bff;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #004085;
  line-height: 1.5;
}

/* Сетка результатов (оставляем для совместимости, если понадобится) */
.results-grid
{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.result-item
{
  display: flex;
  flex-direction: column;
}

/* Textarea результатов (старый стиль, оставляем для совместимости) */
.result-textarea
{
  width: 100%;
  padding: 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Courier New', Courier, monospace;
  color: #212529;
  background-color: #f8f9fa;
  resize: vertical;
  min-height: 300px;
  line-height: 1.5;
  box-sizing: border-box;
}

.result-textarea:focus
{
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Мини-кнопка копирования (квадратная 24x24) */
.btn-copy-mini
{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

/* Иконка копирования: отмена внешнего отступа и размера, которые проставляет общая функция initCopyIcons */
.btn-copy-mini .icon
{
  width: 16px !important;
  height: 16px !important;
  margin-left: 0 !important;
}

.btn-copy-mini:hover
{
  background-color: #f8f9fa;
  border-color: #007bff;
}

.btn-copy-mini:active
{
  background-color: #e9ecef;
}

/* Скрытие элемента без удаления из разметки */
.api-tester .is-hidden
{
  display: none;
}

/* Подсказка под полем ввода */
.field-hint
{
  margin-top: 6px;
  font-size: 0.8rem;
  color: #6c757d;
  line-height: 1.4;
}

/* Обёртка поля URL с кнопками истории */
.url-input-wrapper
{
  position: relative;
  flex: 1;
}

/* Поле URL внутри обёртки: отступ справа под две кнопки внутри поля */
.url-input-wrapper .url-input
{
  padding-right: 84px;
}

/* Кнопки истории URL (запоминание и стрелка) внутри поля */
.btn-url-history,
.btn-url-remember
{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background-color: transparent;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

/* Кнопка запоминания - левее стрелки */
.btn-url-remember
{
  right: 40px;
}

/* Кнопка стрелки - у правого края поля */
.btn-url-history
{
  right: 6px;
}

.btn-url-history:hover,
.btn-url-remember:hover
{
  background-color: #e7f3ff;
  color: #007bff;
}

.btn-url-history:focus,
.btn-url-remember:focus
{
  outline: none;
  color: #007bff;
}

/* Иконки внутри кнопок истории: сброс внешних отступов */
.btn-url-history .icon,
.btn-url-remember .icon
{
  width: 18px;
  height: 18px;
  margin-left: 0;
}

/* Выпадающий список истории URL */
.url-history-list
{
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  margin: 0;
  padding: 4px;
  list-style: none;
  overflow-y: auto;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Пункт списка истории */
.url-history-item
{
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Кнопка-значение адреса в истории */
.url-history-value
{
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background-color: transparent;
  font-size: 0.85rem;
  font-family: 'Courier New', Courier, monospace;
  color: #495057;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.2s;
}

.url-history-value:hover
{
  background-color: #e7f3ff;
  color: #0056b3;
}

/* Кнопка удаления адреса из истории */
.url-history-remove
{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background-color: transparent;
  color: #adb5bd;
  cursor: pointer;
  transition: all 0.2s;
}

.url-history-remove:hover
{
  background-color: #fdecea;
  color: #dc3545;
}

.url-history-remove .icon
{
  width: 16px;
  height: 16px;
  margin-left: 0;
}

/* Пояснение при пустой истории */
.url-history-empty
{
  padding: 10px;
  font-size: 0.85rem;
  font-style: italic;
  color: #6c757d;
  text-align: center;
}

/* Контейнер поля с кнопкой-глазиком */
.password-field-container
{
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-field-container .input-style
{
  padding-right: 44px;
}

/* Кнопка-глазик показа и скрытия токена */
.btn-toggle-password
{
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background-color: transparent;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.btn-toggle-password:hover
{
  background-color: #e7f3ff;
  color: #007bff;
}

.btn-toggle-password:focus
{
  outline: none;
  color: #007bff;
}

.btn-toggle-password .icon
{
  width: 18px;
  height: 18px;
  margin-left: 0;
}

/* Маскированный токен рядом с меткой поля */
.bearer-mask
{
  margin-left: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  font-weight: 400;
  color: #6c757d;
  cursor: help;
}

/* Спиннер внутри кнопки отправки */
.btn-spinner
{
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: sdf-spin 0.7s linear infinite;
}

/* Кнопка в состоянии загрузки */
.btn.is-loading
{
  cursor: progress !important;
  opacity: 0.85;
}

/* Вращение спиннера */
@keyframes sdf-spin
{
  from
  {
    transform: rotate(0deg);
  }

  to
  {
    transform: rotate(360deg);
  }
}

/* Адаптивность для планшетов */
@media (max-width: 992px)
{
  .results-grid
  {
    grid-template-columns: 1fr;
  }

  .result-textarea
  {
    min-height: 250px;
  }
}

/* Адаптивность для мобильных */
@media (max-width: 576px)
{
  .input-panel,
  .results-panel
  {
    padding: 15px;
  }

  .panel-title
  {
    font-size: 1.1rem;
  }

  .url-method-container
  {
    flex-direction: column;
  }

  .method-select
  {
    width: 100%;
  }

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

  .button-container .btn
  {
    width: 100%;
  }

  .result-textarea
  {
    min-height: 200px;
    font-size: 0.8rem;
  }

  .result-textarea-combined
  {
    min-height: 400px;
    font-size: 0.8rem;
  }

  .result-hint
  {
    font-size: 0.85rem;
    padding: 10px;
  }

  .legend-container
  {
    flex-direction: column;
    gap: 8px;
  }
}
