/* =========================
   Global Styles
   ========================= */
body {
  margin: 0;
  padding: 20px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #121212;
  color: #ffffff;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 10px;
  color: #e5e7eb;
}

.hidden {
  display: none !important;
}

/* =========================
   Camera Selection Styles
   ========================= */
.camera-selector {
  background-color: #1e1e1e;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.camera-selector h2 {
  margin: 0 0 15px 0;
  color: #e5e7eb;
  font-size: 1.1rem;
  font-weight: 500;
}

.camera-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.camera-option {
  position: relative;
  background-color: #2d2d2d;
  border-radius: 8px;
  padding: 15px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #3d3d3d;
}

.camera-option:hover {
  background-color: #3d3d3d;
  transform: translateY(-2px);
}

.camera-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.camera-icon {
  font-size: 24px;
  margin-bottom: 8px;
  color: #9ca3af;
  transition: all 0.3s ease;
}

.check-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  background-color: #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.check-mark svg {
  width: 12px;
  height: 12px;
  fill: white;
}

.camera-option input:checked ~ .camera-icon {
  color: #3b82f6;
}

.camera-option input:checked ~ .check-mark {
  opacity: 1;
  transform: scale(1);
  animation: pulse 1.5s infinite;
}

.camera-option input:checked ~ .camera-label {
  color: white;
  font-weight: 500;
}

.camera-label {
  color: #e5e7eb;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* =========================
   Time Filter Form
   ========================= */
.time-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  background-color: #1e1e1e;
  padding: 1rem;
  border-radius: 8px;
  color: #fff;
  margin-bottom: 10px;
}

.time-filter-form label {
  font-size: 0.9rem;
  color: #ccc;
}

.time-filter-form input[type="datetime-local"] {
  background-color: #2b2b2b;
  color: #fff;
  border: 1px solid #444;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s;
}

.time-filter-form input[type="datetime-local"]:focus {
  border-color: #4caf50;
}

.time-filter-form button {
  background-color: #4caf50;
  color: #fff;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.time-filter-form button:hover {
  background-color: #43a047;
}

/* =========================
   Video Player Styles
   ========================= */
.video-wrapper {
  background-color: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

video {
  width: 100%;
  height: 100%; /* ✅ prevents cutting */
  max-height: 90vh; /* ✅ never exceed viewport height */
  object-fit: contain; /* ✅ keep full video visible */
  display: block;
  border-radius: 8px;
}

/* Single Player Full Width */
.single-player-container {
  display: flex;
  width: 100%;
  margin-bottom: 20px;
}

.single-player-container .video-wrapper {
  flex: 1;
  aspect-ratio: 16 / 9;
}

/* Dual Player Container */
.dual-player-container {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

.dual-player-container .video-wrapper {
  flex: 1;
  aspect-ratio: 16 / 9;
}

/* =========================
   Playlist Styles
   ========================= */
.playlist-container {
  margin-top: 20px;
}

.playlist-container h2 {
  color: #e5e7eb;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.playlist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

@media (min-width: 768px) {
  .playlist {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .playlist {
    grid-template-columns: repeat(4, 1fr);
  }
}

.playlist-item {
  background-color: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
}

.playlist-item:hover {
  transform: translateY(-5px);
}
.playlist-item.active {
  box-shadow: 0 0 0 2px #3b82f6;
}

.playlist-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.playlist-info {
  padding: 12px;
}

.playlist-info h5 {
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-info p {
  margin: 5px 0 0;
  font-size: 0.75rem;
  color: #9ca3af;
}

.live-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulseLive 2s infinite;
}

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

/* =========================
   Video Controls
   ========================= */
.video-controls {
  background-color: #1a1a1a;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  border-radius: 0 0 8px 8px;
  border-top: 1px solid #2d2d2d;
}

.control-btn {
  background-color: #333;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.control-btn:hover {
  background-color: #444;
  transform: translateY(-1px);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn .icon {
  font-size: 16px;
}
.control-btn .btn-text {
  display: none;
}

@media (min-width: 640px) {
  .control-btn .btn-text {
    display: inline;
  }
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 768px) {
  .dual-player-container {
    flex-direction: column;
    gap: 10px;
  }
  .dual-player-container .video-wrapper {
    aspect-ratio: auto; /* ✅ let video define size */
    width: 100%;
  }
  h1 {
    font-size: 1rem;
  }
}

/* No video style */
.no-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #bbb;
  font-size: 1.2rem;
  text-align: center;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.6);
  padding: 12px 20px;
  border-radius: 8px;
  pointer-events: none; /* so clicks pass through */
}
.video-wrapper {
  position: relative; /* needed for overlay */
}
