/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Header & Navigation */
header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.language-switcher a {
  display: inline-block;
  padding: 6px 12px;
  margin-left: 8px;
  background: #fff;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: background 0.2s;
}

.language-switcher a:hover,
.language-switcher a.active {
  background: #2196f3;
  color: #fff;
}

/* Heat Header */
.heat-header {
  background: #fff;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.heat-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  margin-left: 8px;
}

.badge-live {
  background: #f44336;
  color: #fff;
  animation: pulse 1.5s infinite;
}

.badge-planned {
  background: #2196f3;
  color: #fff;
}

.badge-finalized {
  background: #4caf50;
  color: #fff;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Heat Times */
.heat-times {
  margin-top: 8px;
  color: #666;
}

/* Message */
.heat-message {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 12px;
  margin-top: 12px;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 16px;
  color: #666;
}

.breadcrumb a {
  color: #2196f3;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Filter Bar */
.filter-bar {
  background: #fff;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-bar label {
  margin-right: 8px;
  font-weight: 500;
}

.filter-bar select {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.btn-only-selected {
  padding: 6px 16px;
  margin-left: 12px;
  background: #fff;
  border: 2px solid #2196f3;
  border-radius: 4px;
  color: #2196f3;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-only-selected:hover:not(:disabled) {
  background: #e3f2fd;
}

.btn-only-selected:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ccc;
  color: #999;
}

.btn-only-selected.active {
  background: #2196f3;
  color: #fff;
}

.btn-only-selected.active:hover {
  background: #1976d2;
}

/* Table */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table th,
.results-table td {
  padding: 3px 4px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.results-table th {
  background: #f5f5f5;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Alternating row colors for better readability */
.results-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.results-table tbody tr:nth-child(odd) {
  background-color: #fff;
}

/* Row selection highlight */
.results-table tbody tr.row-selected:nth-child(even) {
  background-color: #fff9c4;
}

.results-table tbody tr.row-selected:nth-child(odd) {
  background-color: #fffde7;
}

.col-checkbox {
  width: 40px;
  text-align: center;
  padding: 3px 4px !important;
}

.col-checkbox input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.col-position {
  width: 50px;
  text-align: center;
}

.col-laps {
  width: 60px;
  text-align: center;
}

/* Row Highlight Animation */
.row-updated {
  animation: flash-update 2s ease-out;
}

@keyframes flash-update {
  0% { background-color: #c8e6c9; }
  100% { background-color: transparent; }
}

/* Reconnecting Banner */
.banner-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ff9800;
  color: #fff;
  padding: 8px;
  text-align: center;
  font-weight: bold;
  z-index: 1000;
}

/* Lists */
.competition-list,
.organization-list,
.heat-list {
  list-style: none;
  margin: 16px 0;
}

.competition-list li,
.organization-list li,
.heat-list li {
  background: #fff;
  margin-bottom: 8px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.competition-list a,
.organization-list a,
.heat-list a {
  display: block;
  padding: 12px;
  text-decoration: none;
  color: #333;
  transition: background 0.2s;
}

.competition-list a:hover,
.organization-list a:hover,
.heat-list a:hover {
  background: #f5f5f5;
}

.org-name {
  display: block;
  color: #666;
  font-size: 12px;
  margin-top: 4px;
}

.heat-name {
  font-weight: 600;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  margin-top: 16px;
  background: #2196f3;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1976d2;
}

.btn-secondary {
  background: #666;
}

.btn-secondary:hover {
  background: #555;
}

/* Empty State */
.empty-state {
  background: #fff;
  padding: 40px 20px;
  text-align: center;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  color: #666;
}

/* Footer */
footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  color: #666;
  font-size: 12px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }

  .results-table {
    font-size: 12px;
  }

  .results-table th,
  .results-table td {
    padding: 3px 4px;
  }

  .heat-header h1 {
    font-size: 20px;
  }
}

/* Desktop Enhancements */
@media (min-width: 769px) {
  body {
    font-size: 16px;
  }

  .results-table th,
  .results-table td {
    padding: 3px 4px;
  }
}
