/* ============================================================
   DORAMAS PLAYER — componente autônomo de vídeo HLS
   Tema: #07100d · acentos pink #F56FA5
   ============================================================ */

.dp {
  --yellow: #F56FA5;
  --ink: #09090D;
  --white: #ffffff;
  --stage-bg: #000000;
  --page-bg: #09090D;

  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--stage-bg);
  border: 1px solid rgba(255, 255, 255, 0.10);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--white);
  line-height: 1;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

/* ---- Stage / vídeo ---- */
.dp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--stage-bg);
  border-radius: 0;
}

/* Conteúdo retrato: player 9/16 centralizado (max 480px) */
.dp.is-portrait {
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
}

/* ---- Overlay superior ---- */
.dp-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 5;
}

.dp-track {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--yellow);
}

.dp-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

/* ---- Botão play central ---- */
.dp-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 0 30px rgba(245, 111, 165, 0.40);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.3s ease;
  padding: 0;
}
.dp-play svg { width: 26px; height: 26px; display: block; }
.dp-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 0 46px rgba(245, 111, 165, 0.65);
}
.dp.is-playing .dp-play .dp-ic-play { display: none; }
.dp.is-paused .dp-play .dp-ic-pause { display: none; }
.dp:not(.is-playing):not(.is-paused) .dp-play .dp-ic-pause { display: none; }

/* Botão play/pausa da barra de controles */
.dp.is-playing .dp-btn-play .dp-ic-play { display: none; }
.dp.is-paused .dp-btn-play .dp-ic-pause { display: none; }
.dp:not(.is-playing):not(.is-paused) .dp-btn-play .dp-ic-pause { display: none; }

/* ---- Spinner ---- */
.dp-spinner {
  position: absolute;
  top: 50%; left: 50%;
  width: 42px; height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.20);
  border-top-color: var(--yellow);
  animation: dp-spin 0.9s linear infinite;
  z-index: 7;
  display: none;
}
.dp[data-state="loading"] .dp-spinner { display: block; }
@keyframes dp-spin { to { transform: rotate(360deg); } }

/* ---- Controles inferiores ---- */
.dp-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px 18px 12px;
  z-index: 8;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.dp-controls * { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }

.dp-time {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--white);
  margin-bottom: 6px;
  display: flex;
  justify-content: flex-end;
}

/* Timeline */
.dp-timeline {
  position: relative;
  height: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.dp-timeline-track {
  position: absolute; left: 0; right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.dp-timeline-buffer {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.35);
}
.dp-timeline-progress {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--yellow);
}
.dp-timeline-thumb {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--white);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.dp-timeline:hover .dp-timeline-thumb { opacity: 1; }
.dp-timeline:hover .dp-timeline-track { height: 6px; }

/* Linha de controles */
.dp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.dp-group-left, .dp-group-right { display: flex; align-items: center; gap: 18px; }

.dp-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.dp-btn:hover { transform: scale(1.1); color: var(--yellow); filter: drop-shadow(0 0 8px rgba(245, 111, 165, 0.5)); }
.dp-btn svg { width: 23px; height: 23px; display: block; }

/* Volume: alterna entre ícone de som e mudo */
.dp-btn-mute .dp-ic-muted { display: none; }
.dp-btn-mute.is-muted .dp-ic-volume { display: none; }
.dp-btn-mute.is-muted .dp-ic-muted { display: block; }

/* Volume */
.dp-volume { display: flex; align-items: center; gap: 0; }
.dp-volume-slider {
  width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.25s ease, opacity 0.25s ease, margin-left 0.25s ease;
  margin-left: 0;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  accent-color: var(--yellow);
  cursor: pointer;
}
.dp-volume:hover .dp-volume-slider,
.dp-volume.is-open .dp-volume-slider {
  width: 80px;
  opacity: 1;
  margin-left: 8px;
}
.dp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(245, 111, 165, 0.5);
  cursor: pointer;
}
.dp-volume-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(245, 111, 165, 0.5);
  cursor: pointer;
  border: none;
}

/* ---- Menu de configurações (glassmorphism) ---- */
.dp-settings {
  position: absolute;
  right: 18px;
  bottom: 84px;
  min-width: 280px;
  max-width: 340px;
  z-index: 10;
  background: rgba(10, 14, 22, 0.45);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(245, 111, 165, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  font-family: 'Montserrat', sans-serif;
}
.dp-settings.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.dp-settings-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 14px;
}
.dp-settings-close {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.dp-settings-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--yellow); }

.dp-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

/* Qualidade */
.dp-quality { margin-bottom: 16px; }
.dp-quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 8px;
}
.dp-quality-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}
.dp-quality-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.dp-quality-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-shadow: none;
}
.dp-quality-option:hover { background: rgba(255, 255, 255, 0.10); }
.dp-quality-option .dp-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.dp-tag-hd { background: var(--yellow); color: var(--ink); }
.dp-tag-sd { background: rgba(255, 255, 255, 0.15); color: var(--white); }
.dp-quality-option .dp-check {
  color: var(--yellow);
  font-weight: 800;
  display: none;
}
.dp-quality-option.is-active {
  background: linear-gradient(135deg, rgba(245, 111, 165, 0.9), rgba(245, 111, 165, 0.9));
  border-color: var(--yellow);
  font-weight: 800;
  box-shadow: 0 0 18px rgba(245, 111, 165, 0.25);
}
.dp-quality-option.is-active .dp-check { display: inline; }
.dp-quality-option.is-active .dp-tag { background: rgba(20, 32, 13, 0.85); color: var(--white); }

/* Velocidade */
.dp-speed { margin-bottom: 16px; }
.dp-speed-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.dp-speed-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-shadow: none;
}
.dp-speed-pill:hover { background: rgba(255, 255, 255, 0.12); }
.dp-speed-pill.is-active {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
  font-weight: 800;
  box-shadow: 0 0 14px rgba(245, 111, 165, 0.3);
}

/* Preferências / toggle */
.dp-pref-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dp-pref-title { font-size: 13px; font-weight: 600; }
.dp-pref-desc { font-size: 11px; color: rgba(255, 255, 255, 0.55); margin-top: 3px; }

.dp-switch {
  position: relative;
  width: 40px; height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  padding: 0;
}
.dp-switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.2s ease;
}
.dp-switch.is-on { background: var(--yellow); box-shadow: 0 0 14px rgba(245, 111, 165, 0.45); }
.dp-switch.is-on .dp-switch-knob { transform: translateX(18px); }

/* ---- Estado de erro ---- */
.dp-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(7, 16, 13, 0.9);
  z-index: 20;
  text-align: center;
  padding: 20px;
}
.dp-error p { font-size: 14px; color: rgba(255, 255, 255, 0.85); max-width: 320px; }
.dp-error-retry {
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  background: var(--yellow);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(245, 111, 165, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dp-error-retry:hover { transform: scale(1.05); box-shadow: 0 0 28px rgba(245, 111, 165, 0.5); }
.dp[data-state="error"] .dp-error { display: flex; }
.dp[data-state="error"] .dp-play,
.dp[data-state="error"] .dp-controls,
.dp[data-state="error"] .dp-top { opacity: 0; pointer-events: none; }

/* ---- Auto-hide ---- */
.dp.ui-hidden .dp-top,
.dp.ui-hidden .dp-controls,
.dp.ui-hidden .dp-play { opacity: 0; pointer-events: none; }
.dp.ui-hidden { cursor: none; }
.dp.ui-hidden .dp-settings.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---- Transmissão (Cast / AirPlay) ---- */
.dp-btn-cast.is-disconnected { opacity: 0.45; }

/* Barra "Transmitindo para <dispositivo>" */
.dp-castbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.dp.is-casting .dp-castbar { opacity: 1; pointer-events: auto; }
.dp-castbar-icon { color: var(--yellow); display: flex; align-items: center; }
.dp-castbar-icon svg { width: 18px; height: 18px; }
.dp-castbar-text { font-size: 13px; font-weight: 600; flex: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.dp-castbar-device { color: var(--yellow); }
.dp-castbar-stop {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: none; border-radius: 50%;
  color: var(--white);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.dp-castbar-stop:hover { background: rgba(255, 255, 255, 0.28); }
.dp-castbar-stop svg { width: 16px; height: 16px; }

/* Aviso transitório */
.dp-notice {
  position: absolute;
  left: 50%; bottom: 84px;
  transform: translateX(-50%) translateY(8px);
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(10, 14, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12px; font-weight: 600; color: var(--white);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 14;
  text-align: center;
}
.dp-notice.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Fullscreen ---- */
.dp:fullscreen {
  background: #000;
  border: none;
  max-width: none !important;
}
.dp:fullscreen .dp-video { object-fit: contain; }

/* ---- Responsivo ---- */
@media (max-width: 820px) {
  .dp-volume-slider { display: none; }
  .dp-volume:hover .dp-volume-slider { width: 0; opacity: 0; margin-left: 0; }
  .dp-btn-pip { display: none; }
  .dp-group-left, .dp-group-right { gap: 8px; }
}
@media (max-width: 680px) {
  .dp-settings {
    left: 8px; right: 8px;
    bottom: 80px;
    min-width: 0;
    max-width: none;
  }
  .dp-time { font-size: 16px; }
  .dp-controls { padding: 6px 12px 10px; }
}
