/* ===== Vee Player TV ===== */
:root {
  --brand: #E53935;
  --bg: #0b0b10;
  --surface: rgba(255, 255, 255, .06);
  --surface-2: rgba(255, 255, 255, .1);
  --border: rgba(255, 255, 255, .1);
  --text: #f4f4f7;
  --muted: #a3a3b2;
  --live: #ff3b30;
  --radius: 18px;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.ico { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* ---------- Fondo ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg__img {
  position: absolute; inset: -40px;
  background-size: cover; background-position: center;
  filter: blur(40px) saturate(1.2) brightness(.45);
  transform: scale(1.1);
}
.bg__glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 15% 0%, color-mix(in srgb, var(--brand) 35%, transparent), transparent 70%),
    radial-gradient(50% 45% at 100% 100%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(40% 40% at 85% 10%, rgba(90, 80, 255, .16), transparent 70%),
    linear-gradient(180deg, rgba(11, 11, 16, .2), var(--bg) 85%);
}
/* Fallback para navegadores sin color-mix */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .bg__glow {
    background:
      radial-gradient(60% 50% at 15% 0%, rgba(229, 57, 53, .35), transparent 70%),
      radial-gradient(50% 45% at 100% 100%, rgba(229, 57, 53, .22), transparent 70%),
      linear-gradient(180deg, rgba(11, 11, 16, .2), var(--bg) 85%);
  }
}

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 18px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand__logo { height: 44px; width: auto; max-width: 160px; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__text strong { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.brand__text small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Redes ---------- */
.social { display: flex; flex-wrap: wrap; gap: 8px; }
.social__btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); transition: background .2s, transform .2s, color .2s;
}
.social__btn .ico { width: 18px; height: 18px; }
.social__btn:hover { transform: translateY(-2px); }
.social__btn--facebook:hover { background: #1877f2; }
.social__btn--instagram:hover { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.social__btn--youtube:hover { background: #ff0000; }
.social__btn--tiktok:hover { background: #000; box-shadow: -2px -2px 0 #25f4ee, 2px 2px 0 #fe2c55; }
.social__btn--x:hover { background: #000; }
.social__btn--whatsapp:hover { background: #25d366; }
.social__btn--web:hover { background: var(--brand); }

/* ---------- Escenario ---------- */
.stage {
  flex: 1;
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 8px 24px 32px;
}

/* ---------- Alertas de configuración ---------- */
.alert {
  margin: 0 0 16px; padding: 14px 18px; border-radius: 14px;
  background: rgba(255, 82, 82, .12); border: 1px solid rgba(255, 82, 82, .35);
  color: #ffb4ab; font-weight: 500;
}
@media (max-width: 720px) { .alert { margin: 0 16px 16px; } }

/* ---------- Player ---------- */
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@supports not (aspect-ratio: 16 / 9) {
  .player { height: 0; padding-top: 56.25%; }
}
.player:focus-visible { box-shadow: var(--shadow), 0 0 0 3px var(--brand); }
.player__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.player:fullscreen, .player:-webkit-full-screen { border-radius: 0; aspect-ratio: auto; width: 100%; height: 100%; }

.player__watermark {
  position: absolute; top: 16px; right: 16px;
  height: 9%; min-height: 28px; max-height: 64px; width: auto;
  opacity: .55; pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5));
}

/* Spinner */
.player__spinner {
  position: absolute; inset: 0; display: none; place-items: center; pointer-events: none;
}
.player__spinner span {
  width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
.player.is-loading:not(.is-offline):not(.needs-play) .player__spinner { display: grid; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Botón play grande */
.player__bigplay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: none; place-items: center;
  width: 88px; height: 88px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), 0 0 0 10px rgba(255, 255, 255, .08);
  transition: transform .2s;
}
.player__bigplay .ico { width: 44px; height: 44px; margin-left: 4px; }
.player__bigplay:hover { transform: translate(-50%, -50%) scale(1.06); }
.player.needs-play .player__bigplay { display: grid; }
.player.needs-play .player__video { filter: brightness(.6); }

/* Aviso de sonido */
.player__unmute {
  position: absolute; top: 16px; left: 16px;
  display: none; align-items: center; gap: 8px;
  padding: 10px 16px 10px 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .95); color: #111; font-weight: 600; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
  animation: pop .35s ease-out;
}
.player__unmute .ico { width: 20px; height: 20px; }
.player.show-unmute .player__unmute { display: inline-flex; }
.player.needs-play .player__unmute,
.player.is-offline .player__unmute { display: none; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

/* Fuera del aire */
.player__offline {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 24px;
  background: radial-gradient(circle at center, #1b1b24, #050507);
}
.player__offline-ico { width: 56px; height: 56px; color: var(--muted); margin-bottom: 8px; animation: pulse 2s ease-in-out infinite; }
.player__offline strong { font-size: 18px; }
.player__offline > span { color: var(--muted); }
.player.is-offline .player__offline { display: flex; }
.dots::after { content: ""; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Controles ---------- */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 4px;
  padding: 40px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, .4) 60%, transparent);
  transition: opacity .3s, transform .3s;
}
.player.is-idle .controls,
.player.needs-play .controls,
.player.is-offline .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player.is-idle { cursor: none; }
.player.is-idle .player__watermark { opacity: .35; }

.controls__spacer { flex: 1; }

.ctl {
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
  transition: background .15s, transform .15s;
}
.ctl:hover { background: rgba(255, 255, 255, .14); }
.ctl:active { transform: scale(.92); }
.ctl:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Alternancia de íconos */
.i-pause, .i-muted, .i-fs-exit { display: none; }
.player.is-playing .i-play { display: none; }
.player.is-playing .i-pause { display: block; }
.player.is-muted .i-vol { display: none; }
.player.is-muted .i-muted { display: block; }
.player.is-fs .i-fs { display: none; }
.player.is-fs .i-fs-exit { display: block; }

/* Volumen */
.volume { display: flex; align-items: center; }
.volume__range {
  -webkit-appearance: none; appearance: none;
  width: 0; height: 4px; margin: 0; opacity: 0;
  border-radius: 4px; cursor: pointer;
  background: linear-gradient(to right, #fff var(--vol, 100%), rgba(255, 255, 255, .3) var(--vol, 100%));
  transition: width .2s, opacity .2s, margin .2s;
}
.volume:hover .volume__range, .volume:focus-within .volume__range { width: 90px; opacity: 1; margin: 0 10px 0 4px; }
.volume__range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.volume__range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.volume__range::-moz-range-track { background: transparent; }

/* Etiqueta EN VIVO */
.live {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 6px; padding: 6px 12px; border: 0; border-radius: 999px;
  background: var(--live); color: #fff; cursor: default;
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
}
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.player.is-behind .live { background: rgba(255, 255, 255, .16); cursor: pointer; }
.player.is-behind .live:hover { background: rgba(255, 255, 255, .26); }
.player.is-behind .live__dot { animation: none; color: #bbb; }

/* ---------- Info debajo del player ---------- */
.info {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-top: 24px; padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.info__main { min-width: 0; flex: 1 1 320px; }
.info h1 { margin: 10px 0 4px; font-size: clamp(22px, 3vw, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.info p { margin: 0; color: var(--muted); max-width: 60ch; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 59, 48, .15); color: #ff6b62;
  font-size: 11px; font-weight: 800; letter-spacing: .1em;
}
.info__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
  transition: background .15s, transform .15s, filter .15s;
}
.btn .ico { width: 18px; height: 18px; }
.btn:hover { background: rgba(255, 255, 255, .16); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn--primary { background: var(--brand); border-color: transparent; color: #fff; }
.btn--primary:hover { background: var(--brand); filter: brightness(1.1); }
.btn--wa { background: #25d366; border-color: transparent; color: #06280f; }
.btn--wa:hover { background: #2fe072; }
.btn--ghost { background: transparent; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 24px 24px 32px; color: var(--muted); font-size: 13px; text-align: center;
}
.footer p { margin: 0; }

/* ---------- Modal insertar ---------- */
.modal {
  width: min(560px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 24px;
  background: #16161e; color: var(--text); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0, 0, 0, .65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal__box { padding: 20px 24px 24px; margin: 0; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal p { color: var(--muted); margin: 6px 0 14px; }
.modal__code {
  width: 100%; resize: none; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: #0b0b10; color: #cfd3ff;
  font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.modal__code:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.modal__actions { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---------- Snackbar ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 12px;
  background: #f4f4f7; color: #111; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  transition: opacity .25s, transform .25s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Modo embed ---------- */
body.is-embed { background: #000; overflow: hidden; }
body.is-embed .stage { max-width: none; padding: 0; height: 100vh; height: 100dvh; }
body.is-embed .player { aspect-ratio: auto; height: 100%; border-radius: 0; box-shadow: none; padding-top: 0; }

/* ---------- Celular ---------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .brand__logo { height: 36px; }
  .social--top { display: none; }
  .stage { padding: 0 0 24px; }
  .player { border-radius: 0; }
  .player__watermark { top: 10px; right: 10px; }
  .player__unmute { top: 10px; left: 10px; padding: 8px 14px 8px 10px; font-size: 13px; }
  .player__bigplay { width: 72px; height: 72px; }
  .player__bigplay .ico { width: 36px; height: 36px; }
  .controls { padding: 30px 6px 4px; gap: 0; }
  .volume__range { display: none; }
  .info { margin: 16px 16px 0; padding: 18px; }
  .info__actions { width: 100%; }
  .info__actions .btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
