*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: black;
  color: white;
  position: relative;
  user-select: none !important;
}

.video-container {
  position: absolute;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  margin-inline: auto;
  background-color: black;
  z-index: 1;
  user-select: none !important;
}

.play-pause-btn-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 88px;
  height: 88px;
  border: none;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  display: block; /* Hide initially */
  z-index: 1000;
}

.loading-indicator-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none; /* Hidden by default */
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid red;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.video-container.loading .play-pause-btn-center {
  display: none; /* Show play button when video is loading */
}
.video-container.paused .play-pause-btn-center {
  display: block; /* Show play button when video is paused */
  background-color: rgb(231, 231, 231);
}
.video-container.playing .play-pause-btn-center {
  display: none; /* Hide play button when video is playing */
}
.video-container.screenshot .play-pause-btn-center {
  display: none; /* Hide play button when video is playing */
}
.video-container.error .play-pause-btn-center {
  display: block; /* Hide play button when video is playing */
}
.video-container.drawing .play-pause-btn-center {
  opacity: 0; /* Hide play button when video is playing */
}
.video-container.paused .play-pause-btn-center {
  transition: transform 0.2s ease; /* Optional: adds smooth transition */
}
.video-container.paused .play-pause-btn-center:hover {
  background-color: rgb(208, 208, 208);
}

.video-container.loading .loading-indicator-center {
  display: block; /* Show play button when video is loading */
}
.video-container.paused .loading-indicator-center {
  display: none; /* Show play button when video is paused */
}
.video-container.playing .loading-indicator-center {
  display: none; /* Hide play button when video is playing */
}
.video-container.screenshot .loading-indicator-center {
  display: none; /* Hide play button when video is playing */
}
.video-container.error .loading-indicator-center {
  display: none; /* Show play button when video is error */
}

.controls {
  padding-bottom: 12px;
  padding-top: 12px;
  padding-left: 5px;
  padding-right: 5px;
}

.video-container.theater,
.video-container.full-screen {
  max-width: initial;
  width: 100%;
}

.video-container.theater {
  max-height: 90vh;
}

.video-container.full-screen {
  max-height: 100vh;
}

.video {
  width: 100%;
}

.video-controls-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: white;
  z-index: 100;
  opacity: 0;
  transition: opacity 150ms ease-in-out;
}

.video-container:hover .video-controls-container,
.video-container.paused .video-controls-container,
.video-container:focus-within .video-controls-container {
  opacity: 1;
}

.video-controls-container .controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.current-time,
.total-time {
  font-family: Arial, sans-serif;
  font-size: 2vw; /* Adjusts font size dynamically based on viewport width */
}

button {
  outline: none !important;
}

button:focus {
  outline: none !important;
}

.video-controls-container .controls button {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  height: 30px;
  width: 30px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 150ms ease-in-out;
}

.video-controls-container::before {
  content: "";
  position: absolute;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  width: 100%;
  aspect-ratio: 6 / 1;
  z-index: -1;
  pointer-events: none;
}

.video-controls-container .controls button:hover {
  opacity: 1;
}

.video-container.paused .pause-icon {
  display: none;
}

.video-container:not(.paused) .play-icon {
  display: none;
}

.video-container.theater .tall {
  display: none;
}

.video-container:not(.theater) .wide {
  display: none;
}

.video-container.full-screen .open {
  display: none;
}

.video-container:not(.full-screen) .close {
  display: none;
}

.volume-high-icon,
.volume-low-icon,
.volume-muted-icon {
  display: none;
}

.video-container[data-volume-level="high"] .volume-high-icon {
  display: block;
}

.video-container[data-volume-level="low"] .volume-low-icon {
  display: block;
}

.video-container[data-volume-level="muted"] .volume-muted-icon {
  display: block;
}

.volume-container {
  display: flex;
  align-items: center;
}

.volume-slider {
  width: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: width 150ms ease-in-out, transform 150ms ease-in-out;
  cursor: pointer;
}

.volume-container:hover .volume-slider,
.volume-slider:focus-within {
  width: 100px;
  transform: scaleX(1);
}

.duration-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-grow: 1;
  user-select: none;
}

.video-container.captions .captions-btn {
  border-bottom: 3px solid red;
}

.video-controls-container .controls button.wide-btn {
  width: 50px;
}

.timeline-container {
  height: 7px;
  margin-inline: 0.5rem;
  cursor: pointer;
}

.timeline {
  background-color: rgba(100, 100, 100, 0.5);
  height: 3px;
  width: 100%;
  position: relative;
  border-radius: 0.5rem;
}

.timeline::before {
  content: "";
  top: 0;
  bottom: 0;
  left: 0;
  right: calc(100% - var(--preview-position) * 100%);
  background-color: red;
  display: none;
  position: absolute;
}

.timeline::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: calc(100% - var(--progress-position) * 100%);
  background-color: red;
  display: none;
}

.timeline .thumb-indicator {
  --scale: 0;
  position: absolute;
  transform: translateX(-50%) scale(var(--scale));
  height: 200%;
  top: -50%;
  left: calc(var(--progress-position) * 100%);
  background-color: red;
  border-radius: 50%;
  transition: transform 150ms ease-in-out;
  aspect-ratio: 1 / 1;
}

.timeline .preview-img {
  position: absolute;
  height: 80px;
  aspect-ratio: 16 / 9;
  top: -1rem;
  transform: translate(-50%, -100%);
  left: calc(var(--preview-position) * 100%);
  border-radius: 0.25rem;
  border: 2px solid white;
  display: none;
}

.thumbnail-img {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  display: none;
  position: absolute;
}

.video-container.scrubbing .thumbnail-img {
  display: block;
}

.video-container.scrubbing .preview-img,
.timeline-container:hover .preview-img {
  display: block;
}

.video-container.scrubbing .thumb-indicator,
.video-container:focus-within .thumb-indicator:focus-within,
.timeline-container:hover .thumb-indicator {
  --scale: 1;
}

.video-container.scrubbing .timeline,
.timeline-container:hover .timeline {
  height: 100%;
  background-color: rgb(150, 150, 150);
}

.video-container.scrubbing .timeline::before,
.timeline-container:hover .timeline::before {
  display: block;
  background-color: red;
}

.popup {
  background-color: orange; /* Orange background */
  color: white; /* White text */
  padding: 6px; /* Padding */
  border-radius: 15px; /* Rounded corners */
  font-size: 14px; /* Font size */
  text-align: center; /* Center the text */
  position: absolute;
  opacity: 0; /* Start invisible */
  transition: opacity 0.3s ease; /* Fade in/out effect */
  pointer-events: none; /* Prevent the popup from interfering with clicks */
  z-index: 1000;
  font-family: "Courier New", Courier, monospace;
}

video::cue {
  font-size: 24px !important; /* Ensure font size is set */
  padding: 0px;
  opacity: 0 !important; /* Hide the cue with opacity */
  background-color: rgba(
    0,
    0,
    0,
    0
  ) !important; /* Ensure transparent background */
}
video::-webkit-media-text-track-display-backdrop {
  background-color: transparent !important;
  overflow: visible !important;
}

video::-webkit-media-text-track-display {
  overflow: visible !important;
  background-color: transparent !important;
}

video::-webkit-media-text-track-container {
  overflow: visible !important;
  transform: translateY(30%) !important;
}

#customSubtitles {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  border: none;
  padding: 4px;
  cursor: default;
  display: block; /* Make it visible */
  z-index: 1000;
  padding: 1px;
  background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
  font-size: 24px; /* Increase font size */
  font-family: Arial, sans-serif; /* Apply Arial font */
}

.video-container.error #err {
  display: block; /* hide err when video is error */
}

.video-container.loading #err {
  display: none; /* hide err when video is loading */
}

.video-container.paused #err {
  display: none; /* hide err when video is paused */
}

.video-container.playing #err {
  display: none; /* hide err when video is playing */
}

.video-container.screenshot #err {
  display: none; /* hide err when video is screenshot */
}

#err {
  position: absolute;
  bottom: 0;
  right: 50;
  transform: translateX(-50%, -50%);
  border: none;
  cursor: default;
  display: block; /* Make it visible */
  z-index: 1;
  padding-bottom: 90px;
  font-size: 20px; /* Increase font size */
  font-family: Arial, sans-serif; /* Apply Arial font */
  z-index: 1001;
  opacity: 0;
}
#er {
  background-color: #ff0000;
  padding: 4px;
  border-radius: 4px;
}

.video-controls-container .controls .w-support {
  background: none;
  border: none;
  color: white;
  padding: 0;
  height: 30px;
  width: 30px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 150ms ease-in-out;
  background-color: transparent;
  background-image: url("https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20coffee&emoji=%E2%98%95&slug=gabzlabs&button_colour=ff0000&font_colour=000000&font_family=Arial&outline_colour=000000&coffee_colour=ffffff");
  background-size: cover;
  background-position: right;
  transform: scale(0.8, 0.8);
  border-radius: 4px;
  margin-top: 3px;
}
