/* Reset & Base */
:root {
    --main-color: #fe2c55;
    --text-color: #ffffff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { 
    margin: 0 !important; 
    padding: 0 !important; 
    height: 100%; 
    width: 100%; 
    background-color: #000; 
    overflow: hidden; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

/* Desktop Container (Letterboxing) */
#flash-feed-container {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
    position: relative;
    background: #000;
}
#flash-feed-container::-webkit-scrollbar { display: none; }

@media (min-width: 768px) {
    #flash-feed-container {
        max-width: 450px; /* Tamanho Mobile no Desktop */
        height: calc(100vh - 40px); /* Altura um pouco menor para mostrar o arredondado */
        margin: 20px auto;
        border-radius: 30px; /* Bordas Arredondadas */
        border: 2px solid rgba(255, 255, 255, 0.25); /* Borda mais visível */
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.2); /* Glow mais intenso */
        overflow-y: auto; /* Habilitar scroll do mouse */
        position: relative;
    }
}

/* Categorias Topo */
.categories-bar {
    position: fixed; top: 0; left: 0; width: 100%;
    height: 60px;
    display: flex; align-items: center;
    justify-content: flex-start;
    padding: 0 15px;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    z-index: 9999;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
    .categories-bar {
        width: calc(100% - 250px); /* Subtract sidebar width */
        left: 250px;
        justify-content: flex-start;
        background: rgba(0,0,0,0.85);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        backdrop-filter: blur(10px);
    }
}
.categories-bar::-webkit-scrollbar { display: none; }

.cat-item {
    color: rgba(255,255,255,0.7);
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transition: color 0.3s, transform 0.2s;
    position: relative;
    padding-bottom: 5px;
    flex-shrink: 0;
    min-width: fit-content;
}
.cat-item.active {
    color: var(--text-color, #fff);
    transform: scale(1.05);
}
.cat-item.active::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; background: var(--main-color, #fe2c55); border-radius: 2px;
}

/* Post Slide (O Card Principal) */
.post-slide {
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    position: relative;
    background-color: #111;
    overflow: hidden;
}

/* Layout de Imagem Cinema */
.slide-bg-blur {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    filter: blur(25px) brightness(0.5);
    transform: scale(1.2); /* Escalar para esconder bordas do blur */
    z-index: 0;
}
.slide-img-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 1;
    padding-bottom: 80px; /* Espaço para texto */
}
.slide-img-center {
    width: 100%; 
    height: auto; 
    max-height: 70%;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

/* Botão de Som (Centralizado) */
.sound-toggle {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 70px; height: 70px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.5); 
    color: #fff;
    backdrop-filter: blur(4px);
    transition: transform 0.2s, background 0.2s, opacity 0.3s;
}
.sound-toggle:active { transform: translate(-50%, -50%) scale(0.9); background: rgba(0,0,0,0.7); }
.sound-toggle svg { width: 32px; height: 32px; fill: #fff; }

/* Animação Ken Burns (Sutil) */
@keyframes kenBurns { from { transform: scale(1); } to { transform: scale(1.1); } }
.effect-zoom .slide-img-center { animation: kenBurns 20s ease-in-out infinite alternate; }

/* Imagem de Fundo (Legado/Vídeo) */
.slide-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    opacity: 1; 
    z-index: 1;
}
.slide-gradient {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 70%;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    z-index: 2;
    pointer-events: none;
}

/* Conteúdo de Texto (Bottom Left) */
.slide-content {
    position: absolute;
    bottom: 80px; /* Espaço para barra de navegação se houver */
    left: 15px;
    width: 75%; /* Deixar espaço para botões laterais */
    z-index: 3;
    color: #fff;
    text-align: left;
}

.slide-author { font-weight: bold; font-size: 14px; margin-bottom: 5px; color: #ddd; }
.slide-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; line-height: 1.2; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }
.slide-excerpt { font-size: 13px; color: #ccc; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Botões Laterais (Bottom Right) */
.slide-actions {
    position: absolute;
    bottom: 100px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 4;
    align-items: center;
}

.action-btn {
    display: flex; flex-direction: column; align-items: center;
    color: #fff; cursor: pointer;
    background: transparent; border: none; padding: 0;
}
.action-icon-bg {
    width: 45px; height: 45px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 5px;
    transition: transform 0.2s, background 0.2s;
    backdrop-filter: blur(5px);
}
.action-btn:active .action-icon-bg { transform: scale(0.9); }
.action-label { font-size: 11px; font-weight: 600; text-shadow: 1px 1px 1px rgba(0,0,0,0.8); }

/* Icons SVG Styling */
.action-btn svg { width: 24px; height: 24px; fill: #fff; }
.liked .action-icon-bg svg { fill: var(--main-color, #fe2c55); } /* Cor Personalizada */

/* Swipe Indicator */
.swipe-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: swipe-pulse 2s ease-in-out infinite;
}

.swipe-text {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.swipe-arrow-left,
.swipe-arrow-right {
    width: 20px;
    height: 20px;
    fill: #fff;
    opacity: 0.9;
}

.swipe-arrow-left {
    animation: arrow-left 1.5s ease-in-out infinite;
}

.swipe-arrow-right {
    animation: arrow-right 1.5s ease-in-out infinite;
}

@keyframes swipe-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes arrow-left {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

@keyframes arrow-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* Modal Backdrop (Área clicável para fechar) */
#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}
#modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

/* Modal de Leitura */
#flash-modal {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 80%;
    background: #fff; z-index: 10000;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    transform: translateY(100%); transition: transform 0.3s ease-out;
    padding: 20px; box-sizing: border-box;
    overflow-y: auto; color: #333;
}
@media (min-width: 768px) {
    #flash-modal { max-width: 450px; left: 50%; transform: translate(-50%, 100%); }
    #flash-modal.open { transform: translate(-50%, 0); }
}
#flash-modal.open { transform: translateY(0); } /* Mobile */
#flash-modal.open.desktop { transform: translate(-50%, 0); }

#close-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(239, 68, 68, 0.9);
    border: 2px solid #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}
#close-modal:hover {
    transform: scale(1.15);
    background: rgba(239, 68, 68, 1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}
#close-modal:active {
    transform: scale(0.95);
}
#modal-content img { max-width: 100%; height: auto; border-radius: 8px; }
#modal-content h1 { font-size: 22px; margin-top: 0; }
.modal-meta { margin-bottom: 20px; color: #666; font-size: 14px; }
.modal-featured-image { width: 100%; height: auto; border-radius: 8px; margin-bottom: 20px; display: block; }

/* ESCUDO ANTI-ADSENSE INVASIVO (Auto Ads) */
/* Esconde vinhetas e banners automáticos que o Google tenta injetar fora do fluxo */
.google-vignette-container, 
.adsbygoogle-noablate, 
ins.adsbygoogle[data-vignette-loaded="true"],
#google_ads_frame1_anchor,
iframe[name^="google_ads_iframe"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Garante que o anúncio DENTRO do nosso slide apareça corretamente */
.ad-slide .adsbygoogle,
.ad-slide iframe,
.ad-slide ins,
.sidebar-ad-slot .adsbygoogle,
.sidebar-ad-slot iframe,
.sidebar-ad-slot ins {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}

/* =========================================
   DESKTOP EXPERIENCE (UOL FLASH STYLE)
   ========================================= */
.desktop-only { display: none !important; }

@media (min-width: 1024px) {
    .desktop-only { display: block !important; }

    /* --- SIDEBAR ESQUERDA --- */
    .desktop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100%;
        background-color: #1a1a1a;
        z-index: 9998;
        padding: 30px 20px;
        display: flex;
        flex-direction: column;
        border-right: 1px solid #333;
    }

    .sidebar-header {
        margin-bottom: 20px;
    }
    .sidebar-logo {
        display: flex; align-items: center; gap: 10px;
        font-size: 24px; font-weight: 800; color: #fff;
        font-style: italic;
    }
    .logo-circle {
        width: 30px; height: 30px;
        background: radial-gradient(circle at 30% 30%, #ffdf40, #fe2c55);
        border-radius: 50%;
    }
    .logo-text { letter-spacing: -1px; }

    /* Espaço para Anúncios (Preenche o vazio) */
    .sidebar-ad-slot {
        flex-grow: 1; /* Ocupa todo o espaço disponível */
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-footer {
        background: #222;
        padding: 15px;
        border-radius: 12px;
        text-align: center;
    }
    .qr-text { color: #aaa; font-size: 12px; margin-bottom: 10px; }
    .qr-box img { width: 100%; border-radius: 4px; display: block; }

    /* --- NAVEGAÇÃO LATERAL (ESQUERDA / DIREITA DO FEED) --- */
    .desktop-nav-sides {
        position: fixed;
        top: 50%;
        left: 0;
        width: 100%;
        transform: translateY(-50%);
        z-index: 9990;
        pointer-events: none; /* Deixar clicar através do container */
    }

    .nav-side-btn {
        pointer-events: auto;
        position: absolute;
        width: 60px; height: 60px;
        border-radius: 50%;
        background: rgba(255,255,255,0.1);
        border: 1px solid rgba(255,255,255,0.2);
        color: #fff;
        display: flex; justify-content: center; align-items: center;
        cursor: pointer;
        transition: all 0.3s;
        backdrop-filter: blur(5px);
    }
    .nav-side-btn:hover {
        background: #fff;
        color: #000;
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255,255,255,0.3);
    }
    .nav-side-btn svg { width: 30px; height: 30px; fill: currentColor; }

    /* Posicionamento Inteligente (Relativo ao Feed de 450px) */
    /* Feed Center = 50% */
    /* Feed Width = 450px (Half = 225px) */
    
    .nav-side-btn.left {
        left: calc(50% - 225px - 80px); /* 80px de folga do feed */
        opacity: 0; /* Invisível por padrão (só aparece no modal) */
        transform: translateX(20px);
        pointer-events: none;
    }
    .nav-side-btn.left.visible {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }

    .nav-side-btn.right {
        left: calc(50% + 225px + 20px); /* 20px de folga do feed */
    }
    /* Esconder botão de abrir quando modal estiver aberto */
    body.desktop-modal-open .nav-side-btn.right {
        opacity: 0;
        pointer-events: none;
    }
    
    /* --- CONTROLES VERTICAIS (Manter à direita, mais afastado) --- */
    .desktop-controls {
        position: fixed;
        right: 30px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 9998;
    }

    .vertical-controls {
        display: flex; flex-direction: column; gap: 15px;
    }

    .control-circle {
        width: 50px; height: 50px;
        border-radius: 50%;
        background: #333;
        border: 1px solid #444;
        display: flex; justify-content: center; align-items: center;
        cursor: pointer;
        transition: transform 0.2s, background 0.2s;
    }
    .control-circle:hover { transform: scale(1.1); background: #fff; }
    .control-circle:hover svg { fill: #000; }
    .control-circle svg { width: 24px; height: 24px; fill: #fff; }

}

/* ============================================
   RETENÇÃO: Toast "Pressione Novamente para Sair"
   ============================================ */
.flash-exit-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 16px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 999999;
    transition: bottom 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.flash-exit-toast.show {
    bottom: 80px;
}

@media (min-width: 768px) {
    .flash-exit-toast {
        left: calc(50% - 225px + 225px); /* Centralizar no feed mobile do desktop */
        max-width: 450px;
    }
    .flash-exit-toast.show {
        bottom: 100px;
    }
}

/* ============================================
   RETENÇÃO: Loader Infinito
   ============================================ */
.flash-infinite-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    min-height: 100vh; /* Ocupa tela inteira para forçar scroll */
}

.flash-infinite-loader .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #fe2c55;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.flash-infinite-loader p {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Prevenir bounce horizontal (impede swipe-back) */
body {
    overscroll-behavior-x: none;
}

/* ========================================
   COMMENTS SECTION (Dark Theme)
   ======================================== */

.flash-comments-section {
    margin-top: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: 12px;
    border: 1px solid #2a2a2a;
}

.flash-comments-title {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #2a2a2a;
}

/* Comments List */
.flash-comments-list {
    margin-bottom: 25px;
}

.flash-comments-loading,
.flash-comments-empty,
.flash-comments-error {
    text-align: center;
    padding: 30px 20px;
    color: #888;
    font-size: 14px;
}

.flash-comments-empty {
    color: #666;
}

.flash-comments-error {
    color: #ef4444;
}

.flash-comment-item {
    background: #222;
    padding: 15px 18px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #2a2a2a;
    transition: all 0.2s;
}

.flash-comment-item:hover {
    background: #282828;
    border-color: #3a3a3a;
    transform: translateX(2px);
}

.flash-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.flash-comment-author {
    color: var(--main-color, #fe2c55);
    font-size: 14px;
    font-weight: 600;
}

.flash-comment-date {
    color: #666;
    font-size: 12px;
}

.flash-comment-text {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Comment Form */
.flash-comment-form-wrapper {
    margin-top: 20px;
}

.flash-comment-login-required {
    text-align: center;
    padding: 30px 20px;
    background: #1a1a1a;
    border-radius: 10px;
    border: 2px dashed #333;
}

.flash-comment-login-required p {
    color: #999;
    margin: 0 0 15px 0;
    font-size: 14px;
}

.flash-comment-login-btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--main-color, #fe2c55);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.flash-comment-login-btn:hover {
    background: #d91d43;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}

.flash-comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flash-comment-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
}

.flash-comment-textarea:focus {
    outline: none;
    border-color: var(--main-color, #fe2c55);
    background: #222;
    box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
}

.flash-comment-textarea::placeholder {
    color: #666;
}

.flash-comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-comment-char-count {
    color: #666;
    font-size: 12px;
}

.flash-comment-submit {
    padding: 12px 30px;
    background: var(--main-color, #fe2c55);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.flash-comment-submit:hover:not(:disabled) {
    background: #d91d43;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}

.flash-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flash-comment-submit:active:not(:disabled) {
    transform: translateY(0);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .flash-comments-section {
        padding: 20px 15px;
        margin-top: 30px;
    }

    .flash-comments-title {
        font-size: 18px;
    }

    .flash-comment-item {
        padding: 12px 15px;
    }

    .flash-comment-textarea {
        min-height: 80px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .flash-comment-form-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .flash-comment-submit {
        width: 100%;
    }
}