/**
 * Ane Player - Player Page Styles (Extracted from inline)
 * Fix #1: CSS externo ao invés de inline para não bloquear renderização
 * Fix #18: Usa CSS custom properties para cor configurável
 * Fix #19: Grid adaptativo melhorado para mobile
 * Fix #20: Barra de progresso visual no next-video
 */

/* === CSS Custom Properties (Fix #18) === */
:root {
    --ane-primary: #ff0000;
    --ane-primary-hover: #cc0000;
    --ane-bg: #000;
    --ane-overlay: rgba(10, 10, 10, .86);
    --ane-blur: blur(10px);
    --ane-radius-sm: 6px;
    --ane-radius-md: 10px;
    --ane-radius-lg: 14px;
    --ane-radius-pill: 999px;
    --ane-transition: .2s ease;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--ane-bg);
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* === Layout Principal === */
.parent {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    background: var(--ane-bg);
    contain: layout paint style;
    overflow: hidden; z-index: 10;
    aspect-ratio: 16/9;
    contain-intrinsic-size: 1280px 720px;
}

/* === Logo === */
.logo {
    position: absolute; z-index: 30;
    display: block; transition: opacity .3s;
}
.logo:hover { opacity: .85; }
.logo--top-left    { left: 15px; top: 15px; }
.logo--bottom-left { left: 15px; bottom: 15px; }
.logo--bottom-right{ right: 15px; bottom: 15px; }

/* === Iframe embed === */
.iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0; display: block;
    aspect-ratio: 16/9;
}

/* === Botões do Player === */
.player-botoes {
    position: absolute; top: 15px; right: 15px; z-index: 20;
    list-style: none; margin: 0; padding: 0;
    display: flex; gap: 10px;
    transition: opacity .3s;
}
.player-botoes a {
    box-shadow: none !important;
    background-color: rgba(0,0,0,.6);
    border-radius: 50%;
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 38px; height: 38px;
    transition: all var(--ane-transition);
}
.player-botoes a:hover {
    background-color: rgba(0,0,0,.92);
    transform: scale(1.05);
}
/* Fix #21: SVG inline ao invés de PNG - ícones via CSS */
.player-botoes a svg {
    width: 18px; height: 18px;
    fill: #fff; pointer-events: none;
}

/* === Painéis Overlay === */
.player-opcao {
    display: none;
    position: absolute; inset: 0; z-index: 25;
    background: var(--ane-overlay);
    backdrop-filter: var(--ane-blur);
    -webkit-backdrop-filter: var(--ane-blur);
    padding: 25px; overflow-y: auto;
}
.player-opcao::-webkit-scrollbar { width: 6px; }
.player-opcao::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.2);
    border-radius: 3px;
}
.player-opcao-titulo {
    display: block; color: #fff;
    font-weight: 700; margin-bottom: 20px;
    font-size: 18px; letter-spacing: -.3px;
}

/* === Botão Fechar === */
.ane-botao-fechar {
    position: absolute; top: 20px; right: 20px;
    width: 36px; height: 36px;
    cursor: pointer;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--ane-transition);
    z-index: 50;
    color: transparent !important; font-size: 0 !important;
    text-decoration: none;
}
.ane-botao-fechar:hover {
    background: var(--ane-primary);
    border-color: var(--ane-primary);
    transform: scale(1.1);
}
.ane-botao-fechar::before {
    content: '✕'; color: #fff;
    font-size: 16px; font-weight: 700; display: block;
}

/* === Embed/Share === */
.player-shared textarea {
    width: 100%;
    background: rgba(0,0,0,.4); color: #ddd;
    border: 1px solid rgba(255,255,255,.15);
    padding: 12px; font-size: 13px;
    resize: none; border-radius: 8px;
    height: 120px; outline: none;
    font-family: monospace;
    transition: border-color .3s;
}
.player-shared textarea:focus { border-color: #fff; }

/* === Grade de Sugestões === */
.sugestao {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.sugestao a { display: block; text-decoration: none; }
.sugestao-img-wrap {
    position: relative; width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--ane-radius-md);
    overflow: hidden; background: #111;
    box-shadow: 0 6px 18px rgba(0,0,0,.30);
}
.sugestao-imagem {
    display: block; width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .35s ease, filter .25s ease;
}
.sugestao a:hover .sugestao-imagem {
    transform: scale(1.08);
    filter: brightness(1.03);
}
.sugestao-tempo {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    color: #fff; font-size: 11px; font-weight: 700;
    padding: 3px 6px; border-radius: var(--ane-radius-sm);
    letter-spacing: .2px;
}
.sugestao-titulo {
    display: -webkit-box;
    font-size: 14px; font-weight: 700;
    color: #fff; margin-top: 8px;
    line-height: 1.28;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sugestao a:hover .sugestao-titulo { color: #fff; }

.player-opcao.player-sugestoes .player-opcao-titulo {
    color: #fff; text-transform: uppercase;
}

/* === Popup de Ads === */
.adspop {
    position: absolute; inset: 0; z-index: 40;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(5px);
}
.adspop_close {
    position: absolute; top: 15px; right: 15px;
    width: 36px; height: 36px;
    background: rgba(204,0,0,.8);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 16px;
    z-index: 41; transition: all var(--ane-transition);
}
.adspop_close:hover {
    background: var(--ane-primary);
    transform: scale(1.1);
}
.adspop_close::before { content: '✕'; }

/* === Player Wrappers === */
.fluid_video_wrapper,
.fluid_video_wrapper video,
.video-js,
.video-js .vjs-tech {
    width: 100% !important; height: 100% !important;
    max-width: none !important; max-height: none !important;
}
.fluid_video_wrapper {
    overflow: hidden; aspect-ratio: 16/9;
    contain-intrinsic-size: 1280px 720px;
}
.fluid_video_wrapper video,
.video-js .vjs-tech {
    background: var(--ane-bg) center center / cover no-repeat;
    aspect-ratio: 16/9;
}
.parent > video#videoHtml5,
.parent > .fluid_video_wrapper ~ video#videoHtml5 {
    display: none !important;
}
.parent > .fluid_video_wrapper video#videoHtml5 {
    display: block !important;
}

/* === Next Video Overlay (Fix #20: com barra de progresso) === */
.ane-next-video {
    display: none;
    position: absolute; inset: 0; z-index: 45;
    background: rgba(0,0,0,.84);
    backdrop-filter: var(--ane-blur);
    -webkit-backdrop-filter: var(--ane-blur);
    padding: 18px;
    align-items: center; justify-content: center;
}
.ane-next-video[hidden] { display: none !important; }
.ane-next-card { width: min(364px, 100%); color: #fff; }
.ane-next-count {
    display: block; font-size: 13px;
    line-height: 1.3; color: rgba(255,255,255,.92);
    margin: 0 0 8px;
}
.ane-next-count strong { font-weight: 700; color: #fff; }
.ane-next-thumb-wrap {
    display: block; text-decoration: none; color: inherit;
}
.ane-next-thumb {
    display: block; width: 100%;
    aspect-ratio: 16/9; object-fit: cover;
    background: #111;
    border-radius: var(--ane-radius-lg);
    box-shadow: 0 8px 22px rgba(0,0,0,.30);
}
.ane-next-body { padding: 10px 0 0; }
.ane-next-title {
    display: block; font-size: 15px;
    line-height: 1.28; font-weight: 700;
    color: #fff; margin: 0 0 14px;
}

/* Fix #20: Barra de progresso visual */
.ane-next-progress {
    width: 100%; height: 4px;
    background: rgba(255,255,255,.15);
    border-radius: 2px; margin: 0 0 10px;
    overflow: hidden;
}
.ane-next-progress-bar {
    height: 100%;
    background: var(--ane-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 1s linear;
}

.ane-next-actions { display: flex; gap: 12px; }
.ane-next-actions a,
.ane-next-actions button {
    appearance: none; -webkit-appearance: none;
    min-height: 36px; border: 0;
    border-radius: var(--ane-radius-pill);
    padding: 0 18px; font-weight: 700;
    font-size: 12px; cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center;
    justify-content: center; letter-spacing: .01em;
}
.ane-next-close {
    background: rgba(255,255,255,.12);
    color: #fff; flex: 1 1 50%;
}
.ane-next-go {
    background: var(--ane-primary);
    color: #fff; flex: 1 1 50%; text-align: center;
}
.ane-next-go:hover, .ane-next-close:hover {
    filter: brightness(1.08);
}

/* === Fluid Player Specifics === */
.fluid_video_wrapper {
    position: absolute !important; inset: 0 !important;
    width: 100% !important; height: 100% !important;
    contain: layout paint;
    background: transparent !important;
    z-index: 15 !important; max-width: none !important;
}
.fluid_video_wrapper .fluid_controls_container,
.fluid_video_wrapper .fluid_controls_progress_container {
    opacity: 1 !important; visibility: visible !important;
}
.fluid_video_wrapper .fluid_player_play_button {
    background-color: var(--ane-primary) !important;
    border-radius: var(--ane-radius-lg) !important;
    border: none !important;
    width: 72px !important; height: 52px !important;
    box-shadow: none !important;
    transition: background-color var(--ane-transition) !important;
    display: flex !important; align-items: center !important;
    justify-content: center !important;
}
.fluid_video_wrapper .fluid_player_play_button:hover {
    background-color: var(--ane-primary-hover) !important;
}
.fluid_video_wrapper.fluid_playing .fluid_player_play_button,
.fluid_video_wrapper.is-playing .fluid_player_play_button {
    display: none !important; opacity: 0 !important;
    visibility: hidden !important;
}
.fluid_mini_player, .fluid-mini-player { display: none !important; }
.fluid_video_wrapper video#videoHtml5 {
    width: 100% !important; height: 100% !important;
    max-width: none !important; max-height: none !important;
    display: block !important; background: var(--ane-bg) !important;
}

/* === Video.js Specifics === */
.video-js {
    position: absolute !important; inset: 0 !important;
    width: 100% !important; height: 100% !important;
    background: var(--ane-bg) !important;
    contain: layout paint; z-index: 15 !important;
    max-width: none !important;
}
.vjs-poster {
    display: block !important;
    background-size: cover !important;
    background-position: center center !important;
}
.video-js .vjs-control-bar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.video-js .vjs-tech { object-fit: cover; }
.video-js .vjs-big-play-button {
    display: flex !important; align-items: center !important;
    justify-content: center !important;
    background-color: var(--ane-primary) !important;
    border-radius: var(--ane-radius-lg) !important;
    border: none !important;
    width: 72px !important; height: 52px !important;
    min-width: 72px !important; min-height: 52px !important;
    left: 50% !important; top: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important; box-shadow: none !important;
    transition: background-color var(--ane-transition) !important;
    opacity: 1 !important; visibility: visible !important;
    z-index: 25 !important;
}
.video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus {
    background-color: var(--ane-primary-hover) !important;
}
.video-js .vjs-big-play-button .vjs-icon-placeholder {
    display: flex !important; align-items: center !important;
    justify-content: center !important;
    width: 100% !important; height: 100% !important;
}
.video-js .vjs-big-play-button .vjs-icon-placeholder:before {
    content: '\f101' !important; color: #fff !important;
    font-size: 45px !important; line-height: 1 !important;
}
.video-js.vjs-has-started .vjs-big-play-button,
.video-js.vjs-playing .vjs-big-play-button {
    display: none !important;
}

/* === Responsive: Tablet (640px+) === */
@media (min-width: 640px) {
    .sugestao {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
        gap: 18px; justify-content: center;
    }
    .player-opcao.player-sugestoes { padding: 22px 22px 18px; }
    .player-opcao.player-sugestoes .player-opcao-titulo {
        text-align: center; font-size: 16px;
        line-height: 1.1; margin: 0 52px 18px;
        font-weight: 800; letter-spacing: .02em;
    }
    .sugestao { max-width: 900px; margin: 0 auto; }
    .sugestao-img-wrap {
        border-radius: 12px; aspect-ratio: 16/8.6;
    }
    .sugestao-titulo {
        font-size: 15px; line-height: 1.24; margin-top: 10px;
    }
    .sugestao-tempo {
        font-size: 12px; padding: 4px 7px; border-radius: var(--ane-radius-sm);
    }
}

/* === Responsive: Desktop (1024px+) === */
@media (min-width: 1024px) {
    .sugestao {
        grid-template-columns: repeat(3, minmax(320px, 1fr));
        gap: 20px; justify-content: center;
    }
    .player-opcao.player-sugestoes { padding: 24px 24px 20px; }
    .player-opcao.player-sugestoes .player-opcao-titulo {
        font-size: 17px; margin: 0 56px 20px;
    }
    .sugestao { max-width: 1120px; margin: 0 auto; }
    .sugestao-img-wrap {
        border-radius: 12px; aspect-ratio: 16/8.4;
    }
    .sugestao-titulo { font-size: 16px; line-height: 1.24; }
}

/* === Responsive: Mobile (Fix #19: melhor grid adaptativo) === */
@media (max-width: 639px) {
    .player-botoes { top: 10px; right: 10px; }
    .player-opcao { padding: 12px 8px 10px; }
    .player-opcao-titulo { font-size: 15px; margin-bottom: 12px; }

    .player-opcao.player-sugestoes { padding: 10px 10px 8px; }
    .player-opcao.player-sugestoes .player-opcao-titulo {
        display: block; text-align: center;
        font-size: 15px; line-height: 1.15;
        margin: 0 38px 8px; font-weight: 800;
        text-transform: uppercase;
    }
    .player-opcao.player-sugestoes .ane-botao-fechar {
        top: 8px; right: 8px; width: 32px; height: 32px;
    }
    .sugestao { gap: 8px; }
    .sugestao-img-wrap { border-radius: 8px; }
    .sugestao-titulo {
        font-size: 11px; line-height: 1.15;
        margin-top: 4px; -webkit-line-clamp: 2;
    }
    .sugestao-tempo {
        font-size: 9px; padding: 2px 4px;
        bottom: 3px; right: 3px;
    }
    .sugestao-imagem { transform: none !important; }

    .ane-next-card {
        width: 100%; max-width: 228px; margin: 0 auto;
    }
    .ane-next-thumb {
        max-height: 120px; border-radius: 10px;
        box-shadow: 0 8px 20px rgba(0,0,0,.30);
    }
    .ane-next-count { font-size: 12px; margin-bottom: 7px; }
    .ane-next-body { padding: 8px 0 0; }
    .ane-next-title { font-size: 13px; margin-bottom: 10px; }
    .ane-next-actions { gap: 8px; }
    .ane-next-actions a,
    .ane-next-actions button {
        min-height: 40px; font-size: 12px; padding: 0 10px;
    }
}

@media (min-width: 768px) {
    .ane-next-card { width: min(340px, 100%) !important; }
    .ane-next-thumb {
        max-height: 188px; aspect-ratio: 16/8.6 !important;
    }
    .ane-next-title { font-size: 14px; line-height: 1.18; }
    .ane-next-body { padding: 8px 0 0; }
}
