:root {
    --primary-color: #3b82f6;
    --text-color: #e2e8f0;
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --code-bg: #1e293b;
    --border-color: #334155;
    --nav-text: #94a3b8;
    --nav-hover: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header Interativo */
.site-header {
    background-color: rgba(15, 23, 42, 0.8);
    padding: 15px 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s ease-in-out; /* Animação suave */
}

.site-header.header-hidden {
    transform: translateY(-100%); /* Esconde movendo para cima */
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    height: 45px;
    width: auto;
    transition: transform 0.2s;
}

.site-logo:hover {
    transform: scale(1.05);
}

nav {
    display: flex;
    gap: 24px;
}

nav a {
    text-decoration: none;
    color: var(--nav-text);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

nav a:hover {
    color: var(--nav-hover);
    text-decoration: none;
}

/* Menu Dropdown */
.nav-item {
    position: relative;
    display: inline-block;
    height: 100%;
}

.nav-item > a {
    padding: 10px 0;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    min-width: 220px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent rgba(255, 255, 255, 0.1) transparent;
}

.dropdown-content.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-toggle.active {
    color: var(--primary-color);
}

.dropdown-content a {
    color: #cbd5e1;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    margin: 2px 0;
    border-radius: 6px;
    text-transform: none;
    font-weight: 400;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-content a:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding-left: 20px;
}

/* Submenus */
.dropdown-submenu {
    position: relative;
    width: 100%;
}

.dropdown-submenu .dropdown-content {
    top: -8px;
    left: 100%;
    margin-left: 10px;
    margin-top: 0;
    transform: none;
}

.dropdown-submenu .dropdown-content::before {
    top: 15px;
    left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent rgba(255, 255, 255, 0.1) transparent transparent;
}

.dropdown-submenu:hover > .dropdown-content {
    display: block;
    animation: fadeInRight 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px) translateX(-50%); }
    to { opacity: 1; transform: translateY(0) translateX(-50%); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Layout Base */
main,
main.container {
    flex: 1;
    padding-top: 80px !important; /* !important para garantir aplicação */
}

/* Hero Section (Home) */
.hero-section {
    min-height: 45vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 5vh;
    margin-bottom: 0px;
}

.hero-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(
        800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(59, 130, 246, 0.15), 
        transparent 40%
    );
    pointer-events: none;
}

.hero-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
    z-index: -2;
}

.hero-logo-container {
    margin-bottom: 1rem;
    animation: fadeUp 1s ease-out;
    width: 100%;
    display: flex;
    justify-content: center;
}

.hero-logo {
    width: 650px;
    max-width: 95%;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
}

/* Home Content Container */
.home-content {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    margin-top: 20px;
    padding: 0 20px; /* Margem lateral para mobile */
}

/* Posts e Conteúdo */
.posts-list {
    width: 100%;
    /* max-width removido pois o pai controla */
}

.post-item {
    margin-bottom: 40px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    transition: transform 0.2s, border-color 0.2s;
}

.post-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
}

.post-meta {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.post-title a {
    color: var(--text-color);
    text-decoration: none;
}

.post-title a:hover {
    color: var(--primary-color);
}

/* Post Header Individual */
.post-header {
    text-align: left;
    margin-bottom: 60px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-top: 40px; /* Adicionando margem aqui para empurrar */
}

.post-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    margin-top: 0;
    color: #ffffff; /* Branco sólido para teste */
    line-height: 1.2;
}

/* Código e Diagramas */
pre, code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
}

p {
    white-space: pre-line;
}

pre {
    background: #1e293b;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    overflow-x: auto;
    margin: 30px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #60a5fa;
}

pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.95rem;
}

article {
    max-width: 800px;
    margin: 0 auto;
}

.site-footer {
    margin-top: auto;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: #64748b;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Table of Contents (TOC) Sidebar --- */
.toc-sidebar {
    position: fixed;
    left: 20px;
    top: 100px;
    width: 250px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 100;
}

.toc-sidebar h4 {
    margin: 0 0 15px 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 8px;
}

.toc-item.toc-sub {
    margin-left: 15px;
    margin-bottom: 6px;
}

.toc-link {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 6px 0 6px 12px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: rgba(255, 255, 255, 0.9);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.toc-link.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

/* Scrollbar customizada para TOC */
.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* --- Tags --- */
.post-tags {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(100, 200, 255, 0.1);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 4px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tag:hover {
    background: rgba(100, 200, 255, 0.2);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Página de Tag Individual */
.tag-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.tag-page h1 {
    margin-bottom: 10px;
}

.tag-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

.tag-count {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 40px;
    font-size: 0.95rem;
}

/* Índice de Tags */
.tags-index {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.tags-index h1 {
    margin-bottom: 10px;
}

.tags-index .subtitle {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 30px;
}

.tag-card {
    background: rgba(20, 30, 48, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tag-card:hover {
    background: rgba(20, 30, 48, 0.8);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(100, 200, 255, 0.2);
}

.tag-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    text-decoration: none;
    color: inherit;
}

.tag-name {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 500;
}

.tag-card .tag-count {
    background: rgba(100, 200, 255, 0.2);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* --- Responsividade --- */

/* Telas menores que 1200px - Oculta TOC */
@media (max-width: 1200px) {
    .toc-sidebar {
        display: none;
    }
}

/* Laptops menores e Tablets (max-width: 1024px) */
@media (max-width: 1024px) {
    .hero-logo {
        width: 500px; /* Reduz um pouco */
    }
    
    main {
        padding-top: 80px;
    }
    
    .post-header h1 {
        font-size: 2.2rem;
    }
}

/* Celulares e Tablets Pequenos (max-width: 768px) */
@media (max-width: 768px) {
    .hero-logo {
        width: 350px; /* Reduz bem para caber no mobile */
    }

    main {
        padding-top: 80px; /* Menos espaço no mobile */
    }

    .site-header .container {
        padding: 0 15px; /* Margem lateral no header */
    }

    .post-header h1 {
        font-size: 1.8rem;
        margin-top: 20px; /* Mais respiro */
    }
    
    /* Menu no mobile (ajuste básico) */
    nav {
        display: none; /* Por enquanto esconde menu no mobile para não quebrar, ideal seria menu hambúrguer */
        /* Implementar menu mobile seria um próximo passo ideal */
    }
    
    .site-logo {
        height: 35px; /* Logo menor no header */
    }
}
