/**
 * Trazada — CSS Design System
 * Theme support: data-theme="dark" (default) and data-theme="light"
 */

/* ============================================
   Timer Panel
   ============================================ */
.trazada-timer {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(145deg, #0f0f23 0%, #1a1a35 100%);
  color: #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  margin-top: 12px;
  max-width: 500px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.trazada-timer-header {
  text-align: center;
  margin-bottom: 16px;
}

.trazada-timer-display {
  font-size: 2.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.03em;
  transition: color 0.3s, text-shadow 0.3s;
}

.trazada-timer-display.trazada-timer-running {
  color: #4cff9f;
  text-shadow: 0 0 20px rgba(76,255,159,0.3);
}

.trazada-timer-lap-counter {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.trazada-timer-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.trazada-timer-hint {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.2);
  margin-bottom: 14px;
}

/* ============================================
   Best Lap
   ============================================ */
.trazada-timer-best {
  text-align: center;
  margin-bottom: 12px;
  font-size: 0.95rem;
  padding: 8px;
  background: rgba(245,179,36,0.06);
  border-radius: 8px;
  border: 1px solid rgba(245,179,36,0.1);
}

.trazada-timer-best:empty {
  display: none;
}

.trazada-best-label {
  color: #f5b324;
  font-weight: 600;
}

.trazada-best-time {
  font-weight: 700;
  color: #f5b324;
  font-variant-numeric: tabular-nums;
}

.trazada-stats {
  color: rgba(255,255,255,0.35);
  font-size: 0.82rem;
}

/* ============================================
   Last Lap Flash
   ============================================ */
.trazada-timer-last-lap {
  text-align: center;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 28px;
}

.trazada-timer-last-lap:empty {
  display: none;
}

.trazada-last-lap-time {
  font-variant-numeric: tabular-nums;
  color: #e0e0e0;
}

.trazada-last-lap-best {
  color: #4cff9f !important;
}

.trazada-best-badge {
  color: #f5b324;
  font-size: 0.9rem;
  animation: trazada-pulse 0.6s ease-out;
}

@keyframes trazada-pulse {
  0% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.trazada-flash {
  animation: trazada-flash-anim 0.4s ease-out;
}

@keyframes trazada-flash-anim {
  0% { background: rgba(76,255,159,0.15); }
  100% { background: transparent; }
}

/* ============================================
   Laps List
   ============================================ */
.trazada-timer-laps {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.trazada-timer-empty {
  text-align: center;
  color: rgba(255,255,255,0.2);
  font-style: italic;
  padding: 20px 0;
}

.trazada-timer-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}


/* ============================================
   Lap Row
   ============================================ */
.trazada-lap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  gap: 6px;
}

.trazada-lap:hover {
  background: rgba(255,255,255,0.03);
}

.trazada-lap-best {
  background: rgba(245,179,36,0.08) !important;
  border-left: 3px solid #f5b324;
}

.trazada-lap-invalid {
  opacity: 0.3;
}

.trazada-lap-invalid .trazada-lap-time {
  text-decoration: line-through;
}

.trazada-lap-num {
  font-weight: 600;
  min-width: 32px;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
}

.trazada-lap-source {
  font-size: 0.8rem;
  min-width: 20px;
}

.trazada-lap-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  text-align: center;
}

.trazada-lap-delta {
  min-width: 70px;
  text-align: right;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.trazada-delta-slower {
  color: #f56b6b;
}

.trazada-delta-best {
  color: #f5b324;
  font-size: 1rem;
}


/* ============================================
   Buttons
   ============================================ */
.trazada-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  gap: 4px;
  line-height: 1;
  user-select: none;
}

.trazada-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.18);
}

.trazada-btn:active {
  transform: scale(0.95);
}

.trazada-btn-toggle {
  width: 36px;
  height: 30px;
  padding: 0;
  font-size: 16px;
}

.trazada-btn-start {
  background: rgba(76,175,80,0.12);
  border-color: rgba(76,175,80,0.25);
  color: #81c784;
}
.trazada-btn-start:hover { background: rgba(76,175,80,0.22); }

.trazada-btn-stop {
  background: rgba(255,152,0,0.12);
  border-color: rgba(255,152,0,0.25);
  color: #ffb74d;
}
.trazada-btn-stop:hover { background: rgba(255,152,0,0.22); }

.trazada-btn-lap {
  background: rgba(33,150,243,0.12);
  border-color: rgba(33,150,243,0.25);
  color: #64b5f6;
  transition: all 0.15s, box-shadow 0.3s;
}
.trazada-btn-lap:hover { background: rgba(33,150,243,0.22); }
.trazada-btn-lap-active {
  box-shadow: 0 0 12px rgba(33,150,243,0.3);
  border-color: rgba(33,150,243,0.5);
}
.trazada-btn-lap-flash {
  animation: trazada-lap-flash 0.3s ease-out;
}
@keyframes trazada-lap-flash {
  0% { background: rgba(33,150,243,0.4); transform: scale(1.1); }
  100% { background: rgba(33,150,243,0.12); transform: scale(1); }
}

.trazada-btn-finish {
  background: rgba(33,150,243,0.12);
  border-color: rgba(33,150,243,0.25);
  color: #64b5f6;
}

.trazada-btn-reset { color: rgba(255,255,255,0.3); }

.trazada-btn-delete {
  color: #f56b6b;
  border-color: rgba(245,107,107,0.2);
}

/* Import label as button */
.trazada-btn-import { cursor: pointer; }


/* ============================================
   Sessions Panel
   ============================================ */
.trazada-sessions-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.trazada-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.trazada-session-info {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
}

.trazada-session-agent {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

.trazada-session-date {
  color: rgba(255,255,255,0.25);
  font-size: 0.75rem;
}


/* ============================================
   Container-level styling
   ============================================ */
.trazada-container {
  margin: 0 auto;
}

trazada-track {
  display: block;
  margin: 0 auto;
}


/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .trazada-timer {
    padding: 12px;
    border-radius: 10px;
  }
  .trazada-timer-display {
    font-size: 2rem;
  }
  .trazada-timer-controls {
    gap: 6px;
  }
  .trazada-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .trazada-timer-hint {
    display: none;
  }
}
