/* ==========================================================
   POST.CSS — Arquitetura de Leitura Premium V14.5
   Foco: Experiência Imersiva, Ads 3D, Luna Vox e Clean UI.
   ========================================================== */

/* Variáveis de Fallback */
:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --bg-body: #ffffff;
    --text-main: #334155;
    --text-heading: #0f172a;
    --bg-light: #f8f9fa;
    
    /* Cores de Categoria (Padrão) */
    --cat-color: #0d6efd;
}

/* Mapeamento de Cores por Categoria (Ativado pelo PHP) */
.cat-technology { --cat-color: #0284c7; }
.cat-world { --cat-color: #475569; }
.cat-business { --cat-color: #65a30d; }
.cat-health { --cat-color: #e11d48; }
.cat-sports { --cat-color: #059669; }
.cat-entertainment { --cat-color: #c026d3; }
.cat-games { --cat-color: #a78bfa; }

/* Barra de Progresso de Leitura */
#reading-progress-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 4px;
    background: transparent; z-index: 99999;
}
#reading-progress-bar {
    height: 100%; background: var(--cat-color); width: 0%;
    transition: width 0.1s ease-out; box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.post-area { padding: 120px 0 60px; background: var(--bg-body); animation: fadeIn 0.5s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Container Focado */
.post-container-center { max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* ----------------------------------------------------------
   1. CABEÇALHO E METADADOS
---------------------------------------------------------- */
.nav-top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }

.btn-back-nav {
    background: #f1f5f9; color: #64748b; width: 40px; height: 40px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    text-decoration: none; transition: all 0.2s ease;
}
.btn-back-nav:hover { background: #e2e8f0; color: #0f172a; transform: translateX(-3px); }

.post-category-label {
    display: inline-block; padding: 6px 14px; border-radius: 8px;
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.5px; color: #fff; background: var(--cat-color);
    text-decoration: none; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.post-header { margin-bottom: 40px; text-align: left; }

.post-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800;
    color: var(--text-heading); line-height: 1.15; letter-spacing: -0.02em;
    margin-bottom: 25px;
}

.post-meta-detailed {
    display: flex; align-items: center; flex-wrap: wrap; gap: 15px;
    padding-bottom: 25px; border-bottom: 1px solid rgba(0,0,0,0.05);
    color: #64748b; font-size: 0.9rem; font-weight: 500;
}
.post-meta-detailed span { display: flex; align-items: center; gap: 6px; }
.views-badge { background: #f1f5f9; padding: 4px 10px; border-radius: 20px; font-weight: 700; font-size: 0.8rem; }

/* ----------------------------------------------------------
   2. PLAYER LUNA VOX (CSS PURO)
---------------------------------------------------------- */
.luna-player-box {
    background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0; border-left: 5px solid var(--cat-color);
    border-radius: 12px; padding: 20px; margin: 30px 0;
    display: flex; flex-direction: column; gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.luna-player-info { display: flex; align-items: center; gap: 15px; }

.luna-avatar {
    background: var(--cat-color); width: 44px; height: 44px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.2rem; box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.luna-title { margin: 0; font-size: 1rem; color: #333; font-weight: 700; }
.luna-subtitle { color: #666; font-size: 0.85rem; display: block; margin-top: 2px; }

.luna-audio-control { width: 100%; border-radius: 30px; margin-top: 5px; }

/* ----------------------------------------------------------
   3. MÍDIA E CONTEÚDO
---------------------------------------------------------- */
.main-video-box {
    margin-bottom: 30px; border-radius: 16px; overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15); background: #000;
}

.post-featured-wrapper {
    position: relative; border-radius: 16px; overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1); margin-bottom: 40px;
}

.post-featured-img { width: 100%; height: auto; display: block; transition: transform 0.5s ease; }
.post-featured-wrapper:hover .post-featured-img { transform: scale(1.02); }

.image-caption {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: rgba(255,255,255,0.9); padding: 20px 20px 10px;
    font-size: 0.85rem; font-weight: 500;
}

.post-content {
    font-family: 'Inter', sans-serif; font-size: 1.15rem;
    line-height: 1.8; color: var(--text-main);
}
.post-content p { margin-bottom: 1.8em; }

.post-content h2 {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.8rem;
    font-weight: 800; color: var(--text-heading); margin: 2.5em 0 1em;
    position: relative;
}

.post-content a {
    color: var(--cat-color); text-decoration: none; font-weight: 600;
    border-bottom: 2px solid rgba(0,0,0,0.1); transition: 0.2s;
}
.post-content a:hover { border-color: var(--cat-color); }

.post-content table {
    width: 100%; border-collapse: collapse; margin: 30px 0;
    font-size: 0.95rem; box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-radius: 12px; overflow: hidden; background: #fff;
}
.post-content th { background-color: var(--cat-color); color: #fff; padding: 15px; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; text-align: left; }
.post-content td { padding: 15px; border-bottom: 1px solid #eee; color: #444; }
.post-content tr:nth-of-type(even) { background-color: #f8f9fa; }

.post-content blockquote {
    background: #f8fafc; padding: 30px 40px; margin: 40px 0;
    border-left: 4px solid var(--cat-color); border-radius: 0 12px 12px 0;
    font-size: 1.2rem; font-style: italic; color: #475569;
}

/* Sumário (ToC) */
.toc-box {
    background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 12px;
    padding: 25px; margin-bottom: 40px;
}
.toc-title { font-weight: 800; margin-bottom: 15px; font-size: 1.1rem; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 10px; border-bottom: 1px dashed #cbd5e1; padding-bottom: 8px; }
.toc-list li:last-child { border-bottom: none; }
.toc-list a { text-decoration: none; color: var(--text-main); font-weight: 600; transition: 0.2s; }
.toc-list a:hover { padding-left: 5px; color: var(--cat-color); }

/* ----------------------------------------------------------
   4. AÇÕES E RODAPÉ DO POST
---------------------------------------------------------- */
.post-actions-bar { margin-top: 60px; padding-top: 30px; border-top: 1px solid #e2e8f0; }
.engagement-buttons { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; }

.btn-interaction {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px;
    border-radius: 50px; font-weight: 700; cursor: pointer; border: none; transition: 0.2s;
}
.btn-like-post { background: #fff1f2; color: #e11d48; }
.btn-like-post:hover { background: #e11d48; color: #fff; transform: translateY(-3px); }

/* Social Buttons */
.action-row { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.btn-share-native {
    flex: 2; background: #1e293b; color: #fff; padding: 12px; border:none;
    border-radius: 12px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.btn-share-native:hover { background: #0f172a; transform: translateY(-2px); }

/* Botão Fechar Anúncio */
.btn-close-ad {
    position:absolute; top:-15px; right:-15px; z-index:10; 
    background:#fff; border:1px solid #ddd; border-radius:50%; 
    width:28px; height:28px; display:flex; align-items:center; justify-content:center; 
    color:#94a3b8; cursor:pointer; box-shadow:0 2px 5px rgba(0,0,0,0.1);
}
.btn-close-ad:hover { color: #ef4444; transform: scale(1.1); } 

.btn-icon-share {
    width: 48px; height: 48px; color: #fff; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; text-decoration: none; transition: 0.2s; border:none; cursor: pointer;
}
.btn-whatsapp { background: #25D366; } .btn-whatsapp:hover { background: #1ebe57; transform: translateY(-3px); }
.btn-telegram { background: #0088cc; } .btn-telegram:hover { background: #0077b5; transform: translateY(-3px); }
.btn-copy { background: #64748b; } .btn-copy:hover { background: #475569; transform: translateY(-3px); }

/* Navegação Inferior */
.post-navigation {
    display: flex; justify-content: space-between; gap: 20px;
    margin: 50px 0; padding: 30px 0;
    border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
}
.nav-link-box { flex: 1; text-decoration: none; display: flex; flex-direction: column; color: var(--text-main); }
.nav-link-box.next { text-align: right; align-items: flex-end; }
.nav-label { font-size: 0.7rem; text-transform: uppercase; color: #94a3b8; font-weight: 800; letter-spacing: 1px; margin-bottom: 5px; }
.nav-title { font-weight: 700; font-size: 1rem; line-height: 1.3; transition: 0.2s; }
.nav-link-box:hover .nav-title { color: var(--cat-color); }

/* ----------------------------------------------------------
   5. ANÚNCIO 3D (CUBE EFFECT) - Responsivo
---------------------------------------------------------- */
.ad-3d-section {
    perspective: 1000px;
    margin: 60px auto;
    overflow: visible;
}
.ad-scene {
    width: 160px; 
    height: 160px;
    margin: 0 auto;
    perspective: 1000px;
    transition: transform 0.3s;
    transform: rotateX(-10deg);
}
.ad-cube {
    width: 100%; height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    animation: rotateDiamond 16s infinite linear;
}
.ad-face {
    position: absolute;
    width: 160px; height: 160px; 
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
    border: 2px solid #e2e8f0;
    opacity: 0.98;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03);
}

/* Faces recalculadas para 160px (translateZ 80px) */
.ad-face-front  { transform: rotateY(0deg) translateZ(80px); }
.ad-face-back   { transform: rotateY(180deg) translateZ(80px); }
.ad-face-right  { transform: rotateY(90deg) translateZ(80px); }
.ad-face-left   { transform: rotateY(-90deg) translateZ(80px); }

.ad-content { text-align: center; padding: 10px; }
.ad-label { font-size: 0.6rem; text-transform: uppercase; color: #94a3b8; letter-spacing: 2px; font-weight: 800; display: block; margin-bottom: 5px; }
.ad-content h3 { margin: 0 0 5px; font-size: 1.1rem; color: #1e293b; font-weight: 900; }
.ad-content p { font-size: 0.75rem; color: #64748b; margin-bottom: 10px; line-height: 1.2; }
.btn-ad-cta { background: #0f172a; color: #fff; border: none; padding: 6px 15px; border-radius: 50px; font-weight: 700; cursor: pointer; transition: 0.2s; font-size: 0.75rem; }
.btn-ad-cta:hover { transform: scale(1.05); background: var(--cat-color); }

@keyframes rotateDiamond {
    0% { transform: rotateY(0deg) rotateX(0deg); }
    50% { transform: rotateY(180deg) rotateX(5deg); }
    100% { transform: rotateY(360deg) rotateX(0deg); }
}

/* ----------------------------------------------------------
   6. TOAST E EXTRAS
---------------------------------------------------------- */
#toast-message {
    visibility: hidden;
    min-width: 280px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px 24px;
    position: fixed;
    z-index: 9999999;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}

#toast-message.visible { visibility: visible !important; opacity: 1 !important; bottom: 50px !important; }

.related-posts-section { margin-top: 60px; }
.related-header { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 40px; position: relative; color: var(--text-heading); }
.related-header::after { content: ''; display: block; width: 50px; height: 4px; background: var(--cat-color); margin: 15px auto 0; border-radius: 2px; }
.related-grid-pro { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; }
.related-card img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 10px; transition: 0.3s; }
.related-card:hover img { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.related-card h5 { color: var(--text-heading); font-size: 0.95rem; line-height: 1.4; font-weight: 700; }

.post-comments-wrapper { margin-top: 60px; padding: 40px; background: #fff; border-radius: 16px; border: 1px solid #e2e8f0; }

/* Lightbox */
.lightbox-modal { display: none; position: fixed; z-index: 10000; padding-top: 50px; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.95); backdrop-filter: blur(5px); }
.lightbox-content { margin: auto; display: block; width: 80%; max-width: 1000px; border-radius: 8px; animation: zoom 0.4s; }
.lightbox-close { position: absolute; top: 20px; right: 40px; color: #fff; font-size: 50px; cursor: pointer; transition: 0.2s; }
.lightbox-close:hover { color: var(--cat-color); }
@keyframes zoom { from {transform:scale(0.8); opacity:0} to {transform:scale(1); opacity:1} }

@media (max-width: 992px) { .related-grid-pro { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
    .post-title { font-size: 2rem; }
    .post-content table { display: block; overflow-x: auto; white-space: nowrap; }
    .related-grid-pro { grid-template-columns: 1fr; }
    .action-row { width: 100%; margin-top: 15px; }
    .btn-share-native { flex: 100%; }
    .ad-scene { transform: scale(0.8) rotateX(-10deg); }
}
