/* Контейнер для всех блоков */
.rv-summary-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.rv-info-message {
  padding: 18px 20px;
  margin: 16px 0;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.5;
}

.rv-info-message--warning {
  color: #8a2d00;
  background: #fff4e5;
  border: 1px solid #ffc078;
}

.rv-info-message--error {
  color: #8f1d1d;
  background: #fff0f0;
  border: 1px solid #e6a7a7;
}

/* Каждый блок категории */
.rv-category-block {
  padding: 0 0 20px 0;
  margin: 0;
  background: #fff;
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-bottom: 24px;
}

/* Заголовок блока */
.rv-category-title {
  font-size: 1.3em;
  font-weight: bold;
  color: #d00;
  margin: 16px 0 8px 16px;
}

.rv-category-distance {
  margin: -2px 16px 10px;
  color: #50575e;
  font-size: 0.95em;
  line-height: 1.4;
}

/* Таблица */
.rv-summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.95em;
}

.rv-summary-table th,
.rv-summary-table td {
  border: 1px solid #e0e0e0;
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.rv-summary-table th {
  background: #f8f9fa;
  font-weight: 600;
}

.rv-summary-table .rv-stage-col--primary {
  background: #fcfcfc;
}

.rv-summary-table th.rv-stage-col--primary {
  background: #f3f5f7;
}

.rv-summary-table .rv-stage-col--secondary {
  color: #777;
  background: #fafafa;
  font-size: 0.92em;
}

.rv-summary-table th.rv-stage-col--secondary {
  color: #666;
  background: #f7f7f7;
  font-weight: 500;
}

.rv-summary-table .rv-stage-col--rank {
  text-align: center;
}

.rv-summary-table tr:not(:last-child) td {
  border-bottom: 1px solid #eee;
}

/* Призовые места */
.rv-prize {
  font-weight: bold;
  color: #d2691e;
  background: #fffbe6;
}

/* Стили для вкладок */
#results-viewer-root .rv-tab,
#results-viewer-root button.rv-tab,
#results-viewer-root a.rv-tab,
#results-viewer-root a.rv-tab:link,
#results-viewer-root a.rv-tab:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #b71c1c !important;
  border: 1px solid #b71c1c;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 0.9em;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#results-viewer-root .rv-tab.active,
#results-viewer-root .rv-tab:hover,
#results-viewer-root .rv-tab:focus,
#results-viewer-root .rv-tab:active,
#results-viewer-root a.rv-tab:hover,
#results-viewer-root a.rv-tab:focus,
#results-viewer-root a.rv-tab:active {
  background: #b71c1c;
  color: #fff !important;
  text-decoration: none !important;
}

/* Адаптивность для планшетов */
@media (max-width: 1100px) {
  .rv-summary-container {
    gap: 16px;
  }

  .rv-category-block {
    margin-bottom: 16px;
  }
}

/* Для мобильных устройств */
@media (max-width: 700px) {
  .rv-summary-container {
    gap: 8px;
  }

  .rv-category-block {
    padding: 0 0 12px 0;
    margin-bottom: 8px;
  }

  .rv-category-title {
    font-size: 1.1em;
    margin: 12px 0 6px 10px;
  }

  .rv-category-distance {
    margin: -1px 10px 8px;
    font-size: 0.9em;
  }

  .rv-summary-table th,
  .rv-summary-table td {
    padding: 4px 5px;
    font-size: 0.68em;
  }

  .rv-summary-table .rv-stage-col--secondary {
    font-size: 0.64em;
  }

  .rv-summary-table .rv-mobile-hide {
    display: none;
  }

  .rv-tab {
    font-size: 0.8em;
    padding: 8px 12px;
    margin-bottom: 10px;
  }
}

/* Навигация по группам */
.rv-navigation-block {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  background: #f8f9fa;
}

.rv-navigation-title {
  font-size: 1.2em;
  font-weight: bold;
  color: #b71c1c;
  margin-bottom: 12px;
}

.rv-navigation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rv-nav-link {
  background: #fff;
  color: #b71c1c;
  border: 1px solid #b71c1c;
  border-radius: 4px;
  padding: 6px 12px;
  text-decoration: none;
  font-size: 0.8em;
  transition: background 0.2s, color 0.2s;
}

.rv-nav-link:hover {
  background: #b71c1c !important;
  color: #fff !important;
}

/* Адаптивность для мобильных */
@media (max-width: 700px) {
  .rv-navigation-links {
    flex-direction: column;
  }

  .rv-nav-link {
    text-align: center;
  }
}

.rv-search-panel,
.rv-search-result-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  background: #fff;
}

.rv-search-panel {
  background: #f8f9fa;
}

.rv-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#rv-search-input {
  flex: 1 1 320px;
  min-width: 240px;
  padding: 8px 12px;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#rv-search-btn,
#rv-search-reset-btn {
  padding: 8px 16px;
  font-size: 1em;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

#rv-search-btn {
  background: #b71c1c;
  color: #fff;
}

#rv-search-reset-btn {
  background: #fff;
  color: #555;
  border: 1px solid #ccc;
}

#rv-search-reset-btn:hover {
  background: #f1f1f1;
}

.rv-search-hint,
.rv-search-result-meta {
  color: #666;
  font-size: 0.92em;
}

.rv-search-hint {
  margin-top: 10px;
}

.rv-search-result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Карточки для мобильных */
.rv-cards-container {
  display: none;
}

.rv-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.rv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.rv-card-place {
  font-size: 1.4em;
  font-weight: bold;
  color: #b71c1c;
  min-width: 40px;
}

.rv-card-name {
  font-weight: bold;
  font-size: 1.1em;
  color: #333;
  text-align: right;
}

.rv-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.9em;
}

.rv-card-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #f5f5f5;
}

.rv-card-row:last-child {
  border-bottom: none;
}

.rv-card-label {
  color: #666;
  font-weight: 500;
  font-size: 0.85em;
}

.rv-card-value {
  font-weight: bold;
  color: #333;
  text-align: right;
}

.rv-card-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.rv-card-number {
  background: #f8f9fa;
  color: #b71c1c;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.9em;
}

.rv-card-finish-time {
  font-weight: bold;
  color: #d2691e;
  font-size: 1.1em;
}

/* Переключение между таблицей и карточками */
@media (max-width: 700px) {
  .rv-summary-table {
    display: none !important;
  }

  .rv-cards-container {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .rv-card {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
  }

  .rv-card-header {
    flex-direction: row;
    gap: 10px;
  }

  .rv-card-name {
    font-size: 15px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .rv-card-place {
    min-width: 32px !important;
    font-size: 1.1em !important;
  }

  .rv-card-label,
  .rv-card-value {
    font-size: 13px !important;
  }

  .rv-card-finish-time {
    font-size: 15px !important;
  }
}

@media (max-width: 480px) {
  .rv-card {
    padding: 8px !important;
  }

  .rv-card-header {
    gap: 6px;
  }

  .rv-card-name {
    font-size: 13px !important;
  }

  .rv-card-place {
    min-width: 24px !important;
    font-size: 1em !important;
  }
}

@media (min-width: 701px) {
  .rv-cards-container {
    display: none !important;
  }

  .rv-summary-table {
    display: table !important;
  }
}

/* Разделитель между мужчинами и женщинами в навигации */
.rv-gender-separator {
  height: 1px;
  background-color: #ddd;
  margin: 8px 0;
  width: 100%;
}

/* Разделитель между разными типами групп */
.rv-gender-group-separator {
  height: 40px;
  border-bottom: 2px solid #b71c1c;
  margin: 30px 0;
  position: relative;
}

.rv-gender-group-separator[data-label="Юниоры"]::after {
  content: "Юниоры";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 0 15px;
  color: #b71c1c;
  font-weight: bold;
  font-size: 14px;
}

.rv-gender-group-separator[data-label="Женщины"]::after {
  content: "Женщины";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 0 15px;
  color: #b71c1c;
  font-weight: bold;
  font-size: 14px;
}

/* Обертка для горизонтальной прокрутки таблицы */
.rv-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#results-viewer-root.rv-wide-mode {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: clamp(16px, 3vw, 48px);
  padding-right: clamp(16px, 3vw, 48px);
  box-sizing: border-box;
}

/* Для мобильных устройств в горизонтальной ориентации */
@media (max-width: 700px) and (orientation: landscape) {
  .rv-summary-table {
    display: table !important;
    min-width: 800px;
    /* Минимальная ширина таблицы */
    font-size: 0.75em;
  }

  .rv-cards-container {
    display: none !important;
  }

  .rv-table-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 16px;
  }

  .rv-summary-table th,
  .rv-summary-table td {
    padding: 6px 8px;
    white-space: nowrap;
    min-width: 60px;
  }

  .rv-summary-table th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
  }
}

/* Для очень маленьких экранов в горизонтальной ориентации */
@media (max-width: 480px) and (orientation: landscape) {
  .rv-summary-table {
    font-size: 0.7em;
    min-width: 700px;
  }

  .rv-summary-table th,
  .rv-summary-table td {
    padding: 4px 6px;
    min-width: 50px;
  }
}

.rv-broadcast-context {
  margin: 0 0 12px;
  padding: 0;
}

.rv-broadcast-heading {
  min-height: 36px;
}

.rv-broadcast-heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.rv-broadcast-heading h2 {
  margin: 0;
  color: #1d2327;
  font-size: 1.05rem;
  line-height: 1.35;
  text-align: left;
}

.rv-broadcast-heading p {
  margin: 0;
  color: #50575e;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .rv-broadcast-heading > div:first-child {
    flex-wrap: wrap;
  }
}
