/* Optimized Timeline Seekbar - Clean & Fast */

.timeline-seekbar {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: 'Bio Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
  position: relative;
  z-index: 10;
}

.timeline-seekbar:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Main Controls Row */
.timeline-main-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 40px;
}

.play-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #E12424;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(225, 36, 36, 0.3);
}

.play-btn:hover:not(:disabled) {
  background: #C41E3A;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(225, 36, 36, 0.4);
}

.play-btn:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.play-btn.loading {
  background: #F59E0B;
}

.loading-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Date & Time Controls */
.datetime-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 30;
}

.date-input-container {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  background: #F9FAFB;
  transition: all 0.2s ease;
  min-width: 140px;
}

.date-input-container:hover {
  border-color: #E12424;
  background: #FFFFFF;
}

.date-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.date-display {
  font-size: 14px;
  color: #374151;
  font-family: inherit;
  flex: 1;
}

.time-controls {
  position: relative;
  z-index: 40;
}

.time-controls-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #D1D5DB;
  border-radius: 6px;
  background: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  color: #374151;
  position: relative;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 41;
}

.time-controls-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.time-controls-btn:hover {
  border-color: #E12424;
  background: #FFFFFF;
  transform: scale(1.05);
  color: #E12424;
}

.time-controls-btn:hover svg circle {
  fill: #FEF2F2;
}

.time-controls-btn:hover svg path,
.time-controls-btn:hover svg polyline,
.time-controls-btn:hover svg line {
  stroke: #E12424;
}

.time-controls-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 999999;
  background: #FFFFFF;
  border: 2px solid #E12424;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  overflow: visible;
  transform: translateZ(0);
  will-change: transform;
}

.time-controls-tabs {
  display: flex;
  border-bottom: 1px solid #E5E7EB;
}

.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: #F9FAFB;
  color: #6B7280;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  background: #F3F4F6;
  color: #374151;
}

.tab-btn.active {
  background: #FFFFFF;
  color: #E12424;
  border-bottom-color: #E12424;
}

.quick-times-content,
.time-range-content {
  padding: 12px;
}

.quick-times-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-times-content button {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: #F3F4F6;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.quick-times-content button:hover {
  background: #E12424;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.time-range-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-input-group label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  min-width: 40px;
}

.time-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  font-size: 12px;
  color: #374151;
  background: #FFFFFF;
  transition: all 0.2s ease;
}

.time-input:focus {
  outline: none;
  border-color: #E12424;
  box-shadow: 0 0 0 2px rgba(225, 36, 36, 0.1);
}

.apply-range-btn {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: #E12424;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apply-range-btn:hover {
  background: #C41E3A;
  transform: translateY(-1px);
}

/* Time Display */
.time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 100px;
}

.current-time {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #1F2937;
  letter-spacing: 0.5px;
}

.current-date {
  font-size: 11px;
  color: #6B7280;
  font-weight: 500;
}

.time-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.loading-dots {
  color: #F59E0B;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-text {
  font-size: 10px;
  color: #F59E0B;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Status & Actions */
.status-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.detection-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #F3F4F6;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  border: 1px solid #E5E7EB;
}

.live-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid #E12424;
  border-radius: 20px;
  background: #FFFFFF;
  color: #E12424;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-btn:hover:not(:disabled) {
  background: #E12424;
  color: #FFFFFF;
  transform: scale(1.05);
}

.live-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.live-btn.active {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
  animation: pulse 2s infinite;
}

.skip-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid #F59E0B;
  border-radius: 20px;
  background: #FFFFFF;
  color: #F59E0B;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skip-btn:hover {
  background: #F59E0B;
  color: #FFFFFF;
  transform: scale(1.05);
}

.skip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Seekbar Row */
.seekbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-label {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: #6B7280;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.seekbar-container {
  flex: 1;
  height: 6px;
  position: relative;
}

.no-data-overlay {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.9);
  color: #FFFFFF;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.no-data-text {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.seekbar-track {
  width: 100%;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.seekbar-track:hover {
  background: #D1D5DB;
}

.seekbar-track.disabled {
  background: #F3F4F6;
  cursor: not-allowed;
}

.seekbar-track.disabled:hover {
  background: #F3F4F6;
}

.seekbar-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #E12424 0%, #F59E0B 100%);
  border-radius: 3px;
  transition: width 0.1s ease;
}

.seekbar-handle {
  position: absolute;
  top: -5px;
  width: 16px;
  height: 16px;
  background: #E12424;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  transform: translateX(-8px);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.seekbar-handle:hover {
  transform: translateX(-8px) scale(1.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.seekbar-handle:active {
  cursor: grabbing;
  transform: translateX(-8px) scale(1.1);
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .timeline-seekbar {
    padding: 10px 12px;
    gap: 10px;
  }
  
  .timeline-main-row {
    gap: 12px;
    flex-wrap: wrap;
  }
  
  .play-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .current-time {
    font-size: 16px;
  }
  
  .status-actions {
    margin-left: 0;
    order: 3;
    width: 100%;
    justify-content: space-between;
  }
  
  .datetime-controls {
    gap: 6px;
  }
  
  .date-input-container {
    min-width: 120px;
    padding: 6px 10px;
  }
  
  .time-controls-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  
  .time-controls-panel {
    min-width: 180px;
  }
}

@media (max-width: 480px) {
  .timeline-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .datetime-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .time-display,
  .status-actions {
    justify-content: center;
  }
  
  .seekbar-row {
    margin-top: 8px;
  }
  
  .date-input-container {
    min-width: 100px;
  }
  
  .time-controls-panel {
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
  }
}

/* Ensure popup visibility - override any parent overflow settings */
.timeline-seekbar,
.timeline-main-row,
.datetime-controls,
.time-controls {
  overflow: visible !important;
}

/* Additional popup visibility rules */
.time-controls-panel {
  /* Ensure it appears above everything */
  isolation: isolate;
  /* Prevent any clipping */
  clip-path: none !important;
  /* Ensure it's in its own stacking context */
  contain: layout style;
}

/* Make sure the popup is always visible on mobile too */
@media (max-width: 768px) {
  .time-controls-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    min-width: 180px;
  }
}

@media (max-width: 480px) {
  .time-controls-panel {
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: calc(100vw - 20px);
  }
}