:root {
  --primary-color: #f50666;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --gray-color: #6c757d;
  --light-bg: #f5f5f5;
  --white-bg: #ffffff;
  --blue-color: #0984e3;
  --yellow-color: #d6b706;
  --pink-color: #f7089c;
  --purple-color: #9b59b6;
}

* {
  box-sizing: border-box;
}

body {
  padding: 10px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.container {
  width: 100%;
  max-width: 1400px;
  padding: 0 15px;
  margin: 0 auto;
  flex: 1;
}

.container-fluid {
  max-width: 1400px;
  margin: 0 auto;
}

.category-select-container {
  margin-bottom: 20px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.category-select-container h3 {
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 1.5rem;
}
.category-select-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.category-select {
  width: 100%;
  max-width: 250px;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}
.buttons-row {
  display: flex;
  gap: 10px;
}
.broadcast-status {
  margin-bottom: 15px;
}
.broadcast-status .badge {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
}
.bg-secondary { background-color: var(--gray-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }

.blinking-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: white;
  border-radius: 50%;
  margin-right: 6px;
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.map-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  height: 38px;
  line-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
}
.map-btn:hover {
  background-color: #d40558;
  color: white;
}
.donate-btn {
  background-color: #a0a0a0 !important;
}
.donate-btn:hover {
  background-color: #8a8a8a !important;
}

.table-responsive {
  width: 100%;
  margin-bottom: 20px;
  background-color: var(--white-bg);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow-x: auto;
}
.results-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}
.results-table th {
  background-color: #f8f9fa;
  position: sticky;
  top: 0;
  padding: 12px 8px;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}
.results-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-table tbody tr:hover td {
  background-color: #f8f9fa;
}
.results-table tr:nth-child(even) td {
  background-color: #fcfcfc;
}

/* === ФИКСИРОВАННЫЕ ШИРИНЫ ДЛЯ ВСЕХ КОЛОНОК, КРОМЕ ПОСЛЕДНЕЙ (Splits) === */
.results-table .col-rank { width: 40px; text-align: center; }
.results-table .col-bib { width: 40px; text-align: center; }
.results-table .col-team { width: 300px; white-space: normal; word-break: break-word; }
.results-table .col-cat { width: 70px; text-align: center; }
.results-table .col-start { width: 70px; text-align: center; }
.results-table .col-finish { width: 70px; text-align: center; }
.results-table .col-last-cp { width: 80px; text-align: center; }
.results-table .col-race-time { width: 80px; text-align: center; }
.results-table .col-cp { width: 40px; text-align: center; }
.results-table .col-points { width: 70px; text-align: center; }
.results-table .col-time { width: 80px; text-align: center; }
.results-table .col-time-bonus { width: 90px; text-align: left; }
.results-table .col-bonus-cp { width: 80px; text-align: center; }
.results-table .col-bonus { width: 80px; text-align: center; }
.results-table .col-diff { width: 80px; text-align: center; }
.results-table .col-status { width: 100px; text-align: left; }
.results-table .col-rank-abs { width: 70px; text-align: center; }
.results-table .col-result { width: 70px; text-align: left; }   /* добавлено */

/* Колонка Splits — резиновая */
.results-table .col-splits,
.results-table .splits-cell {
  width: auto;
  min-width: 60px;
  text-align: left;
  padding-left: 8px;
  white-space: nowrap;
}

/* Сбрасываем обрезание текста для колонки Result, чтобы время отображалось полностью */
.results-table td.result-column {
  overflow: visible;
  text-overflow: clip;
}

.time-column,
.result-column {
  color: var(--primary-color);
  font-weight: 700;
}

.status-inactive, .status-dns, .status-dnf, .status-dsq {
  color: var(--gray-color);
  font-style: italic;
}
.status-running { color: #17a2b8; font-weight: 500; }
.status-finished { color: var(--success-color); font-weight: 500; }
.status-registered { color: var(--success-color); font-weight: 500; }
.status-ready { color: var(--blue-color); font-weight: 700; }
.status-trained { color: var(--yellow-color); font-weight: 700; }
.status-at_start { color: var(--pink-color); font-weight: 700; }

.gpx-indicator {
  margin-left: 5px;
}
.gpx-indicator i {
  color: var(--purple-color);
  font-size: 14px;
}

.pdf-icon {
  color: var(--primary-color);
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.pdf-icon:hover {
  transform: scale(1.1);
}

.highlighted-row td {
  animation: fadeOutHighlight 5s ease-out forwards !important;
}
@keyframes fadeOutHighlight {
  0% { background-color: #FFEB3B !important; }
  70% { background-color: #FFEB3B !important; }
  100% { background-color: inherit !important; }
}

.update-info {
  font-size: 13px;
  color: var(--gray-color);
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-top: 20px;
  border: 1px solid #e9ecef;
}
.update-info .fw-bold {
  color: #495057;
}

.has-team-info {
  cursor: help;
  position: relative;
  border-bottom: 1px dashed #999;
}
.team-tooltip {
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  padding: 12px 16px;
  z-index: 10000;
  max-width: 280px;
  min-width: 220px;
  font-size: 14px;
  animation: fadeIn 0.2s ease-out;
  pointer-events: auto;
}
.tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}
.tooltip-bib {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 11px;
  color: #666;
}
.tooltip-members {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tooltip-member {
  display: flex;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed #f5f5f5;
}
.tooltip-member:last-child {
  border-bottom: none;
}

.tooltip-member .member-number {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    font-size: 11px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tooltip-member .member-name {
  font-size: 13px;
}
.tooltip-loading {
  color: #666;
  font-style: italic;
  padding: 8px;
  text-align: center;
}
.tooltip-error {
  color: var(--danger-color);
  padding: 8px;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  body { padding: 5px; }
  .container { padding: 0 5px; }
  .category-select-container { padding: 15px; margin-bottom: 15px; }
  .category-select-container h3 { font-size: 1.2rem; }
  .category-select { max-width: 100%; margin-bottom: 5px; }
  .buttons-row { width: 100%; gap: 8px; }
  .buttons-row .map-btn { flex: 1; }
  .table-responsive { margin: 0 -5px 15px -5px; width: calc(100% + 10px); }
  .results-table { font-size: 12px; }
  
  .results-table .col-rank { width: 40px; }
  .results-table .col-bib { width: 45px; }
  .results-table .col-team { width: 150px; white-space: normal; word-break: break-word; }
  .results-table .col-cat { width: 60px; }
  .results-table .col-start { width: 55px; }
  .results-table .col-finish { width: 55px; }
  .results-table .col-last-cp { width: 70px; }
  .results-table .col-race-time { width: 70px; }
  .results-table .col-cp { width: 35px; }
  .results-table .col-points { width: 50px; }
  .results-table .col-time { width: 60px; }
  .results-table .col-time-bonus { width: 75px; }
  .results-table .col-bonus-cp { width: 65px; }
  .results-table .col-bonus { width: 65px; }
  .results-table .col-diff { width: 70px; }
  .results-table .col-status { width: 80px; }
  .results-table .col-rank-abs { width: 50px; }
  .results-table .col-result { width: 60px; }   /* добавлено для мобильных */
  .results-table .col-splits,
  .results-table .splits-cell {
    width: auto;
    min-width: 45px;
    padding-left: 5px;
  }
  
  .update-info { padding: 12px; font-size: 12px; }
  .gpx-indicator i { font-size: 12px; }
  .pdf-icon { font-size: 1rem; }
}

@media (max-width: 480px) {
  .category-select-container h3 { font-size: 1.1rem; }
  .buttons-row { gap: 5px; }
  .buttons-row .map-btn { font-size: 13px; padding: 0 10px; }
  .results-table { font-size: 11px; }
  .results-table th, .results-table td { padding: 6px 3px; }
}

.banner-carousel {
    flex-shrink: 0;
}
.banner-slider {
    position: relative;
    height: 150px;
    overflow: hidden;
}
.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    visibility: hidden;
}
.banner-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}
.banner-slide a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.banner-link img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
@media (max-width: 768px) {
    .banner-carousel {
        width: 180px;
    }
    .banner-slider {
        height: 120px;
    }
}

.gpx-indicator-live {
    color: #666;
    margin-left: 5px;
    font-size: 0.9rem;
}

.team-with-gpx {
    background-color: #fff3e0 !important;
    border-left: 4px solid #FC4C02;
}
.gpx-indicator {
    color: #FC4C02;
    margin-left: 8px;
    font-size: 12px;
    font-weight: normal;
}
.gpx-track {
    stroke: #FC4C02;
    stroke-width: 4;
    stroke-opacity: 0.7;
    fill: none;
}

.time-exceeded-row {
    background-color: #fff0f0 !important;
}
.exceeded-time {
    color: #dc3545;
    font-weight: bold;
}
.exceeded-time::after {
    content: " ⚠️";
    font-size: 0.9em;
}