/* =========================================================
   NikichitonJesús TV — Estilos globales
   ========================================================= */
:root {
  --bg: #0a0a0a;
  --bg-2: #141414;
  --surface: #1c1c1f;
  --surface-2: #26262b;
  --text: #ffffff;
  --text-dim: #b3b3b3;
  --muted: #7a7a7a;
  --primary: #ff2d55;
  --primary-2: #ff5577;
  --border: rgba(255,255,255,.08);
  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 60px;
  --cats-h: 44px;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
  --player-bg: #0a0a0a;
  --player-bg-soft: #151515;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HEADER ---------- */
#app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,10,.92);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.brand span { color: var(--primary); }
.main-nav { display: flex; gap: 18px; }
.main-nav a { font-size: 14px; color: var(--text-dim); padding: 6px 4px; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { color: var(--text); border-color: var(--primary); }
.search-box { margin-left: auto; flex: 0 1 360px; }
.search-box input {
  width: 100%; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none; font-size: 14px;
}
.search-box input:focus { border-color: var(--primary); }
.categories-bar {
  height: var(--cats-h); display: flex; align-items: center; gap: 8px;
  padding: 0 20px; overflow-x: auto; scrollbar-width: none;
  border-top: 1px solid var(--border);
}
.categories-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); color: var(--text-dim); font-size: 13px;
  border: 1px solid var(--border); white-space: nowrap;
}
.cat-chip:hover { background: var(--surface-2); color: var(--text); }
.cat-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- CONTAINER ---------- */
.app-container { min-height: calc(100vh - var(--header-h) - var(--cats-h)); }

/* ---------- FEED ---------- */
.feed { padding: 24px 20px 80px; }
.feed-section { margin-bottom: 36px; }
.feed-section h2 { font-size: 20px; margin: 0 0 14px; font-weight: 700; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ep-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.ep-card:hover { transform: translateY(-3px); background: var(--surface-2); }
.ep-card .thumb { aspect-ratio: 16/9; background: #000 center/cover no-repeat; position: relative; }
.ep-card .thumb .badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 4px; }
.ep-card .body { padding: 12px; }
.ep-card .title { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep-card .meta { font-size: 12px; color: var(--text-dim); }

/* ---------- WATCH (modo cine) ---------- */
.watch { padding: 0 0 60px; }
.player-stage {
  width: 100%;
  background: var(--player-bg, #0a0a0a);
  display: flex; gap: 0;
  position: relative;
  transition: background .4s ease;
}
.player-area { flex: 1; min-width: 0; position: relative; aspect-ratio: 16/9; max-height: calc(100vh - var(--header-h) - var(--cats-h) - 20px); }
.player-area.with-side { transition: flex-basis .35s ease; }
.player-side {
  width: 0; overflow: hidden; transition: width .35s ease;
  background: rgba(0,0,0,.4); color: #fff;
}
.player-side.open { width: 360px; }
.player-side .side-inner { width: 360px; padding: 16px; height: 100%; overflow-y: auto; }
.player-side .side-close { float: right; background: transparent; color: #fff; border: 0; font-size: 18px; }
.player-side h3 { margin: 0 0 12px; font-size: 16px; }
.side-ep-list { display: flex; flex-direction: column; gap: 8px; }
.side-ep-item { display: flex; gap: 10px; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.05); cursor: pointer; }
.side-ep-item:hover { background: rgba(255,255,255,.1); }
.side-ep-item.active { background: rgba(255,45,85,.25); }
.side-ep-item .t { width: 90px; aspect-ratio: 16/9; background: #000 center/cover; border-radius: 6px; flex: 0 0 auto; }
.side-ep-item .info { font-size: 13px; }
.side-ep-item .info b { display: block; margin-bottom: 2px; }
.side-ep-item .info span { color: var(--text-dim); font-size: 11px; }

/* Player video/audio */
.player-media { width: 100%; height: 100%; background: #000; display: block; }
.player-audio-mode { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.player-audio-mode img { width: 320px; max-width: 70%; aspect-ratio: 1/1; object-fit: cover; border-radius: 18px; box-shadow: var(--shadow); }

/* Controls */
.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transition: opacity .25s ease;
}
.player-area:hover .player-controls,
.player-area.show-controls .player-controls { opacity: 1; }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #fff; }
.progress-row input[type=range] { flex: 1; accent-color: var(--primary); }
.controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls-row button {
  background: transparent; color: #fff; border: 0;
  width: 36px; height: 36px; border-radius: 6px; font-size: 16px;
}
.controls-row button:hover { background: rgba(255,255,255,.15); }
.controls-row .spacer { flex: 1; }
.controls-row select {
  background: rgba(0,0,0,.5); color: #fff; border: 1px solid rgba(255,255,255,.2);
  padding: 4px 8px; border-radius: 6px; font-size: 12px;
}
.volume-wrap { display: flex; align-items: center; gap: 6px; }
.volume-wrap input { width: 80px; accent-color: var(--primary); }
.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; bottom: calc(100% + 6px); right: 0; min-width: 200px;
  background: rgba(20,20,20,.98); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
  box-shadow: var(--shadow); display: none; z-index: 5;
}
.menu-pop.open { display: block; }
.menu-pop button { display: flex; width: 100%; justify-content: flex-start; padding: 8px 10px; background: transparent; color: #fff; border: 0; border-radius: 4px; font-size: 13px; }
.menu-pop button:hover { background: rgba(255,255,255,.1); }

/* Watch info */
.watch-info { padding: 20px 24px; max-width: 100%; }
.watch-title { font-size: 28px; font-weight: 800; color: #fff; margin: 0 0 8px; }
.watch-meta-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); }
.watch-author { font-weight: 600; color: var(--text); }
.watch-actions { display: flex; gap: 8px; margin-left: auto; }
.watch-actions button {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.watch-actions button:hover { background: var(--surface-2); }
.watch-actions button.liked { background: var(--primary); border-color: var(--primary); color: #fff; }

.watch-description {
  margin-top: 14px; padding: 14px; background: var(--surface); border-radius: var(--radius);
  font-size: 14px; color: var(--text-dim); line-height: 1.5;
}

/* Below */
.watch-below { padding: 20px 24px; display: grid; grid-template-columns: 1fr; gap: 24px; }
.watch-below.has-series { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .watch-below.has-series { grid-template-columns: 1fr; } }
.suggest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.series-panel { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.series-panel .s-cover { width: 100%; aspect-ratio: 16/9; background: #000 center/cover; border-radius: 8px; margin-bottom: 12px; }
.series-panel .s-title { font-size: 18px; font-weight: 700; }
.series-panel .s-desc { font-size: 13px; color: var(--text-dim); margin: 6px 0 12px; }
.series-list { display: flex; flex-direction: column; gap: 8px; max-height: 600px; overflow-y: auto; }

/* PIP */
.pip-player {
  position: fixed; right: 16px; bottom: 16px; z-index: 100;
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
}
.pip-thumb { width: 56px; height: 56px; background: #000 center/cover no-repeat; border-radius: 8px; flex: 0 0 auto; }
.pip-info { flex: 1; min-width: 0; }
.pip-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-author { font-size: 11px; color: var(--text-dim); }
.pip-controls { display: flex; gap: 2px; }
.pip-controls button { background: transparent; color: var(--text); border: 0; width: 30px; height: 30px; border-radius: 6px; font-size: 14px; }
.pip-controls button:hover { background: var(--surface-2); }

/* Embed full */
body.embed-mode #app-header,
body.embed-mode #pip-player { display: none !important; }
body.embed-mode .app-container { min-height: 100vh; }
body.embed-mode .player-stage { height: 100vh; }
body.embed-mode .player-area { aspect-ratio: auto; max-height: none; height: 100%; }
body.embed-mode .watch-info, body.embed-mode .watch-below { display: none; }

/* Loaders / states */
.empty { padding: 60px 20px; text-align: center; color: var(--text-dim); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .header-inner { gap: 12px; padding: 0 12px; }
  .main-nav { display: none; }
  .search-box { flex: 1; }
  .player-side.open { position: absolute; right: 0; top: 0; bottom: 0; width: 85%; z-index: 4; }
  .player-side .side-inner { width: 100%; }
  .watch-title { font-size: 22px; }
  .pip-player { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
}

/* =========================================================
   Reproductor profesional (YouTube/Netflix style)
   ========================================================= */
.player-stage { background: linear-gradient(180deg, var(--stage-bg, #0a0a0a) 0%, #000 100%); }
.player-area { position: relative; overflow: hidden; border-radius: 12px; background: #000; }
.media-host { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.player-media { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player-audio { display: none; }
.player-audio-cover { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.player-audio-cover img { width: min(60%, 380px); aspect-ratio: 1/1; object-fit: cover; border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.05); }
.audio-pulse { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at center, rgba(255,45,85,.15), transparent 60%); animation: pulse 4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }

.player-gradient { position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(to top, rgba(0,0,0,.85), transparent); pointer-events: none; opacity: 0; transition: opacity .25s; }
.player-area:hover .player-gradient, .player-area.show-controls .player-gradient, .player-area:not(.playing) .player-gradient { opacity: 1; }

.center-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 3; cursor: pointer; }
.center-play svg { width: 80px; height: 80px; color: #fff; background: rgba(0,0,0,.55); padding: 22px; border-radius: 50%; backdrop-filter: blur(8px); transition: transform .15s; }
.center-play:hover svg { transform: scale(1.08); }
.center-play.hidden { display: none; }

.player-controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 18px 16px; z-index: 4; opacity: 0; transition: opacity .25s; }
.player-area:hover .player-controls, .player-area.show-controls .player-controls, .player-area:not(.playing) .player-controls { opacity: 1; }

.progress-row { margin-bottom: 10px; }
.seekbar { position: relative; height: 22px; cursor: pointer; display: flex; align-items: center; }
.seekbar::before { content: ''; position: absolute; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; transition: height .15s; }
.seekbar:hover::before { height: 6px; }
.seek-buffer { position: absolute; left: 0; height: 4px; background: rgba(255,255,255,.4); border-radius: 2px; width: 0; transition: height .15s; }
.seekbar:hover .seek-buffer { height: 6px; }
.seek-fill { position: absolute; left: 0; height: 4px; background: var(--primary, #ff2d55); border-radius: 2px; width: 0; transition: height .15s; }
.seekbar:hover .seek-fill { height: 6px; }
.seek-thumb { position: absolute; left: 0; width: 14px; height: 14px; background: var(--primary, #ff2d55); border-radius: 50%; transform: translateX(-50%); opacity: 0; transition: opacity .15s; pointer-events: none; }
.seekbar:hover .seek-thumb { opacity: 1; }
#seek { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; margin: 0; }

.controls-row { display: flex; align-items: center; gap: 6px; }
.controls-row .ctrl { background: transparent; color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, transform .1s; }
.controls-row .ctrl svg { width: 22px; height: 22px; }
.controls-row .ctrl:hover { background: rgba(255,255,255,.15); }
.controls-row .ctrl:active { transform: scale(.92); }
.controls-row .ctrl[disabled] { opacity: .35; cursor: not-allowed; }
#btn-toggle svg { width: 26px; height: 26px; }

.volume-wrap { display: flex; align-items: center; gap: 4px; }
.volume-wrap input[type="range"] { width: 0; opacity: 0; transition: width .25s, opacity .25s; accent-color: var(--primary, #ff2d55); }
.volume-wrap:hover input[type="range"] { width: 80px; opacity: 1; }

.time-display { color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; margin-left: 8px; opacity: .9; }
.controls-row .spacer { flex: 1; }

.menu-wrap { position: relative; }
.menu-pop { position: absolute; bottom: 48px; right: 0; min-width: 180px; background: rgba(20,20,20,.96); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 6px; display: none; flex-direction: column; gap: 2px; z-index: 10; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu-pop.open { display: flex; }
.menu-pop button { background: transparent; color: #fff; border: 0; text-align: left; padding: 8px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.menu-pop button:hover { background: rgba(255,255,255,.1); }
.menu-pop button.active, .menu-pop button.default { color: var(--primary, #ff2d55); }
.menu-section { padding: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #888; }

/* =========================================================
   PIP profesional
   ========================================================= */
.pip-player { position: fixed; right: 20px; bottom: 20px; z-index: 1000; background: #0a0a0a; border-radius: 14px; box-shadow: 0 25px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08); overflow: hidden; transition: transform .25s, opacity .25s; }
.pip-player.hidden { display: none; }

/* PIP en modo video */
.pip-player[data-mode="video"] { width: 360px; aspect-ratio: 16/9; padding: 0; display: block; }
.pip-player[data-mode="video"] .pip-media-slot { position: absolute; inset: 0; }
.pip-player[data-mode="video"] video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.pip-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(to bottom, rgba(0,0,0,.55) 0%, transparent 30%, transparent 70%, rgba(0,0,0,.7) 100%); opacity: 0; transition: opacity .2s; }
.pip-player[data-mode="video"]:hover .pip-overlay { opacity: 1; }
.pip-top { display: flex; align-items: flex-start; justify-content: space-between; padding: 10px 12px; gap: 8px; }
.pip-top .pip-text { min-width: 0; }
.pip-top .pip-title { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-top .pip-author { color: rgba(255,255,255,.7); font-size: 11px; }
.pip-x { background: rgba(0,0,0,.5); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pip-x svg { width: 16px; height: 16px; }
.pip-center { flex: 1; display: flex; align-items: center; justify-content: center; }
.pip-big { background: rgba(0,0,0,.55); border: 0; color: #fff; width: 56px; height: 56px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.pip-big svg { width: 28px; height: 28px; }
.pip-big:hover { transform: scale(1.08); transition: transform .15s; }
.pip-bottom { display: flex; justify-content: flex-end; padding: 10px 12px; }
.pip-bottom button { background: rgba(0,0,0,.5); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pip-bottom button svg { width: 16px; height: 16px; }

/* PIP en modo audio */
.pip-player[data-mode="audio"] { width: 340px; padding: 10px; display: flex; align-items: center; gap: 10px; }
.pip-player[data-mode="audio"] .pip-media-slot { flex: 0 0 auto; cursor: pointer; }
.pip-player[data-mode="audio"] .pip-thumb { width: 52px; height: 52px; background: #000 center/cover no-repeat; border-radius: 8px; }
.pip-player[data-mode="audio"] audio { display: none; }
.pip-player[data-mode="audio"] .pip-info { flex: 1; min-width: 0; cursor: pointer; }
.pip-player[data-mode="audio"] .pip-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-player[data-mode="audio"] .pip-author { font-size: 11px; color: rgba(255,255,255,.65); }
.pip-player[data-mode="audio"] .pip-controls { display: flex; gap: 2px; }
.pip-player[data-mode="audio"] .pip-controls button { background: transparent; border: 0; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pip-player[data-mode="audio"] .pip-controls button:hover { background: rgba(255,255,255,.12); }
.pip-player[data-mode="audio"] .pip-controls button svg { width: 16px; height: 16px; }

@media (max-width: 700px) {
  .pip-player[data-mode="video"] { width: 240px; right: 10px; bottom: 10px; }
  .pip-player[data-mode="audio"] { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
  .controls-row .ctrl { width: 34px; height: 34px; }
  .time-display { font-size: 11px; }
}

.badge-icon {
  width: 20px;           /* Tamaño recomendado */
  height: 20px;
  object-fit: contain;   /* Mantiene la proporción */
  vertical-align: middle;
  margin-right: 5px;
}
