/* GLOBAL RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* CARDS & CONTAINERS */
.header,
.grade-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.grade-section {
  display: none;
}

.grade-section.active {
  display: block;
}

/* UI ELEMENTS */
.race-input {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.race-input input {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-small {
  padding: 8px 14px;
  font-size: 14px;
}

/* NAVIGATION */
.grade-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.grade-nav a {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.05);
  color: #333;
  text-decoration: none;
  border-radius: 20px;
  font-weight: 500;
}

.grade-nav a.active {
  background: #2563eb;
  color: white;
}

/* TIMER & TIMESTAMP BOX */
.timer-flex-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 15px 0;
  flex-wrap: nowrap;
}

.timer-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f2937;
  padding: 10px 20px;
  border-radius: 20px;
}

.timer-display {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'Courier New', monospace;
  min-width: 90px;
  text-align: center;
}

.timer-display.warning {
  color: #fbbf24;
}

.timer-display.danger {
  color: #ef4444;
  animation: pulse 1s infinite;
}

.timer-input {
  width: 70px;
  padding: 6px 10px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.timestamp-info-row {
  background-color: #ffffff;
  padding: 8px 15px;
  border: 3px solid #2563eb;
  border-radius: 8px;
  display: none;
  align-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  white-space: nowrap;
}

.timer-timestamps {
  font-size: 1.4rem;
  font-weight: 800;
  color: #111827;
}

.timestamp-label {
  color: #4b5563;
  font-weight: 600;
  font-size: 0.8rem;
  margin-right: 5px;
  text-transform: uppercase;
}

.timestamp-separator {
  margin: 0 15px;
  color: #2563eb;
  font-weight: bold;
}

/* DATA TABLES */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-top: 15px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f8fafc;
  font-weight: 600;
}

tr:hover {
  background: #f8fafc;
}

tr.checked-in {
  background: #f0fdf4;
}

.editable {
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
}

.editable:hover {
  background: #e0e7ff;
}

.editing input {
  width: 100%;
  padding: 4px;
  border: 2px solid #2563eb;
}

/* ALERTS */
.error {
  color: #dc2626;
  background: #fee2e2;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #dc2626;
}

.success {
  color: #16a34a;
  background: #dcfce7;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #16a34a;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Base style for result cells */
td[data-field="Result"] {
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

/* 1st - Blue Ribbon */
.res-highlight-1st {
  background: linear-gradient(90deg, #bbdefb 0%, #f7faff 100%) !important;
  color: #0d47a1 !important;
  border-bottom: 2px solid #90caf9 !important; /* Adds a thin separator */
}

/* 2nd - Red Ribbon */
.res-highlight-2nd {
  background: linear-gradient(90deg, #ffcdd2 0%, #fffafa 100%) !important;
  color: #b71c1c !important;
  border-bottom: 2px solid #ef9a9a !important;
}

/* 3rd - Green Ribbon */
.res-highlight-3rd {
  background: linear-gradient(90deg, #c8e6c9 0%, #fafffa 100%) !important;
  color: #1b5e20 !important;
  border-bottom: 2px solid #a5d6a7 !important;
}
