/* ========== CONFIGURACIÓN GENERAL Y RESETS ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    color-scheme: dark;
    --bg: #090b0f;
    --panel: #11151e;
    --panel-soft: #171d2b;
    --line: #242c40;
    --text: #eef2ff;
    --muted: #97a2bb;
    --accent: #8b5cf6;
    --accent-2: #3b82f6;
}

html, body {
    min-height: 100%;
    background: radial-gradient(circle at top, #10172a 0%, #090b0f 65%);
}

body {
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
}

/* ========== INTERFAZ DE LA APLICACIÓN ========== */
.app-shell {
    padding: 16px 16px 96px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(12px);
}

.brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #0f1420;
    border: 1px solid #27314b;
    object-fit: contain;
    padding: 6px;
}

.brand-copy h1 {
    font-size: 18px;
    line-height: 1.15;
}

.brand-copy p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status {
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid;
    white-space: nowrap;
}

.status-online {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.35);
    background: rgba(74, 222, 128, 0.12);
}

.upload-section {
    margin-bottom: 12px;
}

.upload-btn {
    width: 100%;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1));
    color: #fff;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(59, 130, 246, 0.2));
    border-color: rgba(139, 92, 246, 0.85);
}

.upload-btn:active {
    transform: scale(0.98);
}

.search-wrap {
    margin-bottom: 10px;
}

.search-input {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(15, 20, 31, 0.9);
    color: var(--text);
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: #6f7c98;
}

.search-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.85);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0 14px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
    height: 4px;
}

.categories::-webkit-scrollbar-thumb {
    background: #364059;
    border-radius: 999px;
}

.category-btn {
    flex: 0 0 auto;
    border: 1px solid #2f3a54;
    background: #151d2d;
    color: #d2daf0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn:active {
    transform: scale(0.95);
}

.category-btn.active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.25);
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.channel-card {
    border: 1px solid #2a344d;
    border-radius: 14px;
    background: linear-gradient(170deg, #12192a 0%, #0d1220 100%);
    display: grid;
    grid-template-columns: 64px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.channel-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.8);
}

.channel-card:active {
    transform: translateY(0px);
}

.channel-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid #293248;
    background: #0f1420;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.channel-info {
    min-width: 0;
}

.channel-name {
    font-size: 15px;
    font-weight: 700;
    color: #f6f8ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-category {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.channel-favorite {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 20px;
    opacity: 0.8;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.channel-favorite.active,
.channel-favorite:hover {
    opacity: 1;
}

.channel-favorite:active {
    transform: scale(0.9);
}

.empty-state {
    grid-column: 1 / -1;
    border: 1px dashed #33405f;
    border-radius: 14px;
    padding: 44px 20px;
    text-align: center;
    background: rgba(13, 18, 31, 0.7);
}

.empty-state-icon {
    font-size: 38px;
    margin-bottom: 10px;
}

.empty-state-text {
    color: #c4cee4;
    font-size: 14px;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(9, 11, 15, 0.95);
    backdrop-filter: blur(12px);
    z-index: 1000;
}

.nav-btn {
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #95a2be;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn.active {
    border-color: #2f3a54;
    color: #fff;
    background: rgba(67, 86, 126, 0.24);
}

.nav-icon {
    font-size: 19px;
}

/* ========== PLAYER MODAL ========== */
.player-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.player-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

body.player-open {
    overflow: hidden;
}

body.player-open .bottom-nav,
body.player-open .app-shell {
    display: none !important;
}

/* ========== PLAYER HEADER RCN ========== */
.player-header.rcn {
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 18px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 70%, transparent 100%);
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10000;
    pointer-events: auto;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
}

.player-header.rcn.hidden-controls {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ========== PLAYER STAGE ========== */
.player-stage {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 0;
    padding-top: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

video {
    width: 100% !important;
    height: 100% !important;
    background: #000;
    object-fit: contain;
}

/* ========== VIDEO AREA ========== */
.video-area {
    flex: 1;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ========== CONTROLES ESTILO EXACTO (CAPTURA) ========== */
.player-bottom-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 75%, transparent 100%);
    z-index: 20;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease !important;
}

.player-bottom-wrapper.hidden-controls {
    opacity: 0 !important;
    transform: translateY(15px) !important;
    pointer-events: none !important;
}

.controls-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important; 
    width: 100% !important;
    max-width: 750px !important;
    margin: 0 auto !important;
    padding: 18px 24px 12px !important;
    color: #fff !important;
}

.controls-left {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-start;
}

.controls-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 32px; 
    flex: 1;
    justify-content: flex-end;
}

/* Botones Planos Lineales de la Captura */
.controls-row .control-btn {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}

.controls-row .control-btn:hover {
    transform: scale(1.12) !important;
}

.controls-row .control-btn:active {
    transform: scale(0.93) !important;
}

/* Propiedades del trazado SVG */
.control-btn svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#btnPlayPause svg {
    width: 36px;
    height: 36px;
}

/* ========== CONTENEDOR BANNER INFERIOR ========== */
.player-bottom-banner {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000000;
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
}

.player-bottom-banner > div, 
.player-bottom-banner iframe {
    max-width: 100% !important;
    margin: 0 auto !important;
    display: block !important;
}

/* ========== PLAYER TITLE & BADGE ========== */
.player-title {
    color: #fff;
    font-size: 48px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #fff;
    font-size: 14px;
}

.live-badge .dot {
    width: 12px;
    height: 12px;
    background: #ff2b2b;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(255,43,43,0.6);
}

/* ========== CÍRCULO DE CARGA VERDE NEÓN EXACTO (CAPTURA) ========== */
.player-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.player-spinner.visible {
    opacity: 1;
}

.spinner-circle {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 20%, #5ce1b4 70%, #a3fed9 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent 93%, #000 94%);
    mask: radial-gradient(farthest-side, transparent 93%, #000 94%);
    animation: spin 1.1s linear infinite;
    box-shadow: 0 0 25px rgba(92, 225, 180, 0.35);
    filter: drop-shadow(0 0 6px rgba(92, 225, 180, 0.5));
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* ========== BACK BUTTON HEADER ========== */
.header-back {
    position: absolute;
    left: 12px;
    top: 18px;
    z-index: 1100;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

/* ========== FULLSCREEN Y ENTORNO MÓVIL ========== */
.player-modal.is-fullscreen,
.player-modal:fullscreen,
.player-modal:-webkit-full-screen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 2147483647 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #000 !important;
}

.player-modal.is-fullscreen video,
.player-modal:fullscreen video,
.player-modal:-webkit-full-screen video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; 
    background: #000 !important;
}

.player-modal.is-fullscreen .player-header.rcn,
.player-modal:fullscreen .player-header.rcn,
.player-modal:-webkit-full-screen .player-header.rcn {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
}

.player-modal.is-fullscreen .player-stage,
.player-modal:fullscreen .player-stage,
.player-modal:-webkit-full-screen .player-stage {
    padding: 0 !important;
    height: 100vh !important;
    width: 100vw !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
}

.player-modal.is-fullscreen .video-area,
.player-modal:fullscreen .video-area,
.player-modal:-webkit-full-screen .video-area {
    flex: 1 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.player-modal.is-fullscreen .player-bottom-wrapper,
.player-modal:fullscreen .player-bottom-wrapper,
.player-modal:-webkit-full-screen .player-bottom-wrapper {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    display: flex !important;
}

body.player-open.is-fullscreen,
:fullscreen body {
    overflow: hidden !important;
    height: 100vh !important;
}

/* ========== MEDIA QUERIES ========== */
@media (max-width: 600px) {
    .channels-grid { grid-template-columns: 1fr; }
    .app-shell { padding: 12px 12px 96px; }
    .header { padding: 12px; margin-bottom: 10px; }
    .brand-copy h1 { font-size: 16px; }
    .upload-btn { padding: 10px; font-size: 13px; }
    .player-title { font-size: 26px; text-align: center; padding: 0 20px; }
    .header-back { top: 50px; left: 8px; padding: 8px; }
    .player-stage { padding-top: 84px; }
    .player-bottom-banner iframe {
        transform: scale(0.9);
        transform-origin: bottom center;
    }
    .controls-row { padding: 14px 16px 8px !important; }
    .controls-right { gap: 20px; }
}

input, button {
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    font-size: 16px;
}
button { -webkit-user-select: none; user-select: none; }
html { scroll-behavior: smooth; }

.seo-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    color: #bdbdbd;
    font-size: 14px;
    line-height: 1.7;
}
.seo-content h2, .seo-content h3 { color: #ffffff; margin-bottom: 10px; }
.seo-content p { margin-bottom: 18px; }

/* ========== AD CONTAINER ========== */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    overflow: hidden;
}

.ad-container > * {
    margin: 0 auto;
}

.ad-container iframe {
    display: block;
    margin: 0 auto;
    border: 0;
}