/* === Player Container === */
.myplayer-container {
  position: relative;
  max-width: 960px;
  margin: 2em auto;
  background: #000;
  font-family: 'Helvetica Neue', sans-serif;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.myplayer-container video,
.myplayer-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  z-index: 1;
}

.video {
  display: block;
  width: 100%;
  height: 100%;
  background: black;
}

#player {
  position: relative;
  width: 100%;
  height: 100%;
}

/* === Loader Spinner === */
#loader {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* === Center Play Button === */
#centerPlay {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 64px;
  color: white;
  cursor: pointer;
  transform: translate(-50%, -50%);
  z-index: 14;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}
#centerPlay:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.05);
}
#centerPlay.hidden {
  display: none !important;
}

/* === Controls Overlay === */
#controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em 1em;
  background: rgba(0, 0, 0, 0.75);
  opacity: 0;
  transition: opacity 0.3s ease;
  gap: 0.5em;
}

#controls.visible {
  opacity: 1;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75em;
  width: 100%;
}

.control-btn {
  background: none;
  border: 2px solid #3aa3e3;
  color: #3aa3e3;
  padding: 0.3em;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.control-btn:hover {
  background-color: #3aa3e3;
  color: #fff;
}

.control-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: all 0.3s ease;
}

/* === Seek Bar with Progress and Buffered Track === */
#seek {
  flex: 1 1 200px;
  max-width: 100%;
  height: 6px;
  appearance: none;
  background: linear-gradient(
    to right,
    #3aa3e3 0%,
    #3aa3e3 var(--played, 0%),
    #999 var(--played, 0%),
    #999 var(--buffered, 0%),
    #fff var(--buffered, 0%)
  );
  border-radius: 3px;
  cursor: pointer;
  border: none;
  outline: none;
  position: relative;
  z-index: 1;
}

#seek::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb,
#seek::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #3aa3e3;
  border: 2px solid #3aa3e3;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

#seek:hover,
.volume-slider:hover {
  background: #5bb8f5;
}

/* === Volume Button + Inline Slider === */
.volume-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.volume-slider {
  appearance: none;
  width: 90px;
  height: 6px;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  outline: none;
  position: static;
  opacity: 1;
  pointer-events: auto;
  writing-mode: horizontal-tb;
  direction: ltr;
  transition: none;
  z-index: auto;
}

/* === Time Display === */
#timeDisplay {
  color: #ccc;
  font-size: 12px;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* === Watermark === */
#watermarkCanvas {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

/* === Password Overlay === */
.video-password-prompt-overlay {
  position: absolute;
  z-index: 15;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.video-password-prompt {
  background: #222;
  padding: 2em;
  border-radius: 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 1em;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.video-password-input {
  padding: 0.5em 1em;
  border: none;
  border-radius: 4px;
  background: #333;
  color: #fff;
  font-size: 1em;
}

.video-password-input:focus,
.video-password-submit:focus {
  outline: 2px solid #3aa3e3;
  outline-offset: 2px;
}

.video-password-submit {
  padding: 0.6em 1em;
  background: #3aa3e3;
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.video-password-submit:hover {
  background: #1f85c2;
}

.video-password-error {
  color: #f66;
  font-size: 0.9em;
  display: none;
}

/* === Responsive Tweaks === */
@media (max-width: 768px) {
  #controls {
    padding: 0.4em 0.6em;
    gap: 0.4em;
  }

  .control-row {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.4em;
  }

  .control-btn {
    padding: 0.2em 0.4em;
    font-size: 12px;
    border-width: 1px;
  }

  .control-btn svg {
    width: 16px;
    height: 16px;
  }

  #seek,
  .volume-slider {
    flex: 1 1 80px;
    height: 4px;
  }

  #timeDisplay {
    font-size: 10px;
    min-width: 40px;
    text-align: center;
  }

  .volume-wrapper {
    gap: 0.3em;
  }

  .volume-slider {
    display: none;
  }

  #centerPlay {
    font-size: 48px;
  }
}

@media (max-width: 480px) {
  .video-password-prompt {
    padding: 1em;
    font-size: 0.95em;
  }

  .video-password-input,
  .video-password-submit {
    font-size: 1em;
  }
}

