/* public/css/player.css — Custom Video Player Styles */

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,.92);
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #141414;
  border-radius: 10px;
  max-width: 960px;
  width: 96%;
  overflow: hidden;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
}

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 10;
  background: rgba(0,0,0,.8);
  border: none;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: #E50914; }

/* ===== PLAYER WRAPPER ===== */
.player-wrap {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 16/9;
}

/* YouTube iframe */
.player-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* HLS video element */
.player-wrap video#hlsPlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  outline: none;
}

/* ===== CUSTOM HLS CONTROLS ===== */
.custom-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 40px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transition: opacity .3s;
}
.player-wrap:hover .custom-controls,
.player-wrap.paused .custom-controls { opacity: 1; }

/* Progress bar */
.progress-wrap {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  cursor: pointer;
  transition: height .15s;
}
.progress-wrap:hover { height: 6px; }
.progress-bar {
  height: 100%;
  background: #E50914;
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width .1s linear;
}
.progress-thumb {
  position: absolute;
  top: 50%; right: -6px;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  display: none;
}
.progress-wrap:hover .progress-thumb { display: block; }

/* Controls row */
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
  transition: opacity .2s, transform .15s;
  line-height: 1;
}
.ctrl-btn:hover { opacity: 1; transform: scale(1.1); }

/* Play/Pause big button */
.ctrl-btn.play-pause { font-size: 1.4rem; }

/* Volume */
.volume-wrap { display: flex; align-items: center; gap: 8px; }
.volume-slider {
  -webkit-appearance: none;
  width: 70px; height: 4px;
  background: rgba(255,255,255,.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
}

/* Time display */
.time-display {
  font-size: .78rem;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  font-family: monospace;
  margin-left: 4px;
}

/* Quality selector */
.quality-wrap { position: relative; margin-left: auto; }
.quality-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .5px;
}
.quality-menu {
  display: none;
  position: absolute;
  bottom: 32px; right: 0;
  background: rgba(20,20,20,.97);
  border: 1px solid #333;
  border-radius: 6px;
  min-width: 100px;
  overflow: hidden;
  z-index: 10;
}
.quality-menu.open { display: block; }
.quality-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: #ccc;
  font-size: .8rem;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.quality-menu button:hover { background: rgba(255,255,255,.1); color: #fff; }
.quality-menu button.active { color: #E50914; font-weight: 700; }

/* Fullscreen */
.ctrl-btn.fullscreen { margin-left: 4px; }

/* Loading spinner */
.player-spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  z-index: 5;
}
.player-spinner.show { display: flex; }
.spinner-ring {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: #E50914;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error message */
.player-error {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: #0a0a0a;
  color: #ccc;
  font-size: .9rem;
  z-index: 6;
}
.player-error.show { display: flex; }
.player-error span { font-size: 2rem; }

/* ===== MODAL INFO ===== */
.modal-info { padding: 20px 24px 24px; }
.modal-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; color: #fff; }
.modal-meta {
  display: flex; gap: 14px;
  font-size: .82rem; color: #999;
  margin-bottom: 12px; flex-wrap: wrap;
}
.modal-meta span { display: flex; align-items: center; gap: 4px; }
.modal-desc { font-size: .9rem; color: #bbb; line-height: 1.6; }
.modal-tags { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.modal-tag {
  background: rgba(255,255,255,.08);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: .75rem;
  color: #ccc;
}
.video-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(229,9,20,.15);
  border: 1px solid rgba(229,9,20,.4);
  color: #ff6b6b;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .volume-wrap { display: none; }
  .quality-btn { padding: 2px 7px; font-size: .68rem; }
  .modal-info { padding: 14px 16px; }
  .modal-title { font-size: 1.1rem; }
}
.ua-rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ccc;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.6;
}