body {
    font-family: 'DM Sans', sans-serif;
    overflow-x: hidden;
    transition: all 0.3s ease;
    background-color: var(--bg-primary);
}

/* Tema escuro (padrão) */
.dark {
    --bg-primary: #262626;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --accent-color: #B99EFC;
    --border-color: rgba(255, 255, 255, 0.2);
    --nav-bg: rgba(255, 255, 255, 0.2);
    --card-bg: rgba(255, 255, 255, 0.1);
}

/* Tema claro */
.light {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --accent-color: #7c3aed;
    --border-color: rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --card-bg: rgba(255, 255, 255, 0.8);
}

/* Aplicar variáveis CSS */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Header com gradiente adaptável */
header {
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-primary)) !important;
    color: var(--text-primary) !important;
}

/* Hero section text colors */
header h1, header p, header span {
    color: var(--text-primary) !important;
}

/* Footer text colors - force override with faster transition */
.footer, .footer * {
    color: var(--text-primary) !important;
    transition: color 0.15s ease !important;
}

.footer h3 {
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    transition: color 0.15s ease, border-color 0.15s ease !important;
}

.footer p, .footer span, .footer li {
    color: var(--text-primary) !important;
    transition: color 0.15s ease !important;
}

/* Footer SVG icons */
.footer svg {
    transition: stroke 0.15s ease, fill 0.15s ease !important;
}

/* Navegação */
.nav-demo {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    z-index: 50; /* Garantir z-index mais alto */
}

.nav-demo a {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.nav-demo a:hover {
    color: var(--accent-color);
}

/* Estilização da barra de rolagem - tema escuro */
.dark ::-webkit-scrollbar {
    width: 12px;
}

.dark ::-webkit-scrollbar-track {
    background: #262626;
}

.dark ::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #B99EFC, #6E5E96);
    border-radius: 6px;
    border: 2px solid #262626;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #A78DEA, #5D4D85);
}

/* Estilização da barra de rolagem - tema claro */
.light ::-webkit-scrollbar {
    width: 12px;
}

.light ::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.light ::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #7c3aed, #5b21b6);
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.light ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #6d28d9, #4c1d95);
}

/* Compatibilidade Firefox (versões mais recentes) */
.dark * {
    scrollbar-width: thin;
    scrollbar-color: #B99EFC #262626;
}

.light * {
    scrollbar-width: thin;
    scrollbar-color: #7c3aed #f1f1f1;
}

/* Animação suave de rolagem para toda a página */
html {
    scroll-behavior: smooth;
}

/* Estilos do footer */
.footer {
    position: relative;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.footer::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to top right, transparent 49%, var(--bg-primary) 50%);
}

.footer-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.footer-wave svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
    transform: rotateY(180deg);
}

.footer-wave .shape-fill {
    fill: var(--bg-primary);
}

.footer-link {
    position: relative;
    display: inline-block;
    color: var(--text-primary);
}

.footer-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-color);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

.footer-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.social-icon {
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.social-icon:hover {
    transform: translateY(-5px);
    filter: drop-shadow(0 0 8px var(--accent-color));
}

/* Toggle switch styles */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle.active::before {
    transform: translateX(28px);
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-icon.sun {
    right: 6px;
    opacity: 0;
}

.theme-icon.moon {
    left: 6px;
    opacity: 1;
}

.light .theme-icon.sun {
    opacity: 1;
}

.light .theme-icon.moon {
    opacity: 0;
}

.terminal-font {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.typing-animation {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #b99efc;
    animation: typing 0s steps(0) forwards, blink-border 1s infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-border {
    0%, 50% { border-color: #b99efc; }
    51%, 100% { border-color: transparent; }
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-overlay:hover {
    opacity: 1;
}

.project-overlay a {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
}

.project-overlay a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.project-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.project-card:hover {
    transform: translateY(-5px);
}

.dark .project-card:hover {
    box-shadow: 0 10px 30px rgba(185, 158, 252, 0.2);
}

.light .project-card:hover {
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.2);
}

.project-image {
    transition: transform 0.3s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.fullstack-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #B99EFC 0%, #6E5E96 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.web-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.language-selector {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    animation: fadeInDown 0.3s ease-out;
}

.dropdown-content.show {
    display: block;
}

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

.language-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 140px;
}

.language-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e9d5ff;
}

.language-option.active {
    background: rgba(147, 51, 234, 0.3);
}

.flag {
    width: 20px;
    height: auto;
    border-radius: 3px;
}

.selector-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.selector-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #e9d5ff;
}

.chevron {
    transition: transform 0.3s ease;
}

.chevron.open {
    transform: rotate(180deg);
}

/* Transições suaves para todos os elementos - mais rápida */
* {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Responsividade do toggle */
@media (max-width: 768px) {
    .theme-toggle {
        width: 50px;
        height: 26px;
    }
    
    .theme-toggle::before {
        width: 20px;
        height: 20px;
    }
    
    .theme-toggle.active::before {
        transform: translateX(22px);
    }

    .flex.justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .max-w-md {
        width: 100%;
    }
    
    .min-w-80 {
        min-width: 100%;
    }
    
    #searchResults {
        text-align: left !important;
    }
}

/* Search Bar Styles */
.search-input {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.search-input:focus {
    border-color: var(--accent-color);
    ring-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(185, 158, 252, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#clearSearch {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#clearSearch:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

#clearSearch.show {
    opacity: 1;
}

/* No results state */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.no-results i {
    color: var(--accent-color);
    opacity: 0.6;
    margin-bottom: 1rem;
}

/* Search highlight */
.search-highlight {
    background: linear-gradient(120deg, var(--accent-color) 0%, transparent 100%);
    background-size: 100% 40%;
    background-repeat: no-repeat;
    background-position: 0 85%;
    font-weight: 600;
}

/* Blog Styles */

.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #6E5E96);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.blog-card:hover::before {
    transform: scaleX(1);
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.dark .blog-card:hover {
    box-shadow: 0 20px 40px rgba(185, 158, 252, 0.15);
}

.light .blog-card:hover {
    box-shadow: 0 20px 40px rgba(124, 58, 237, 0.15);
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.blog-date {
    color: var(--accent-color);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.blog-date::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-right: 8px;
}

.blog-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.read-more {
    color: var(--accent-color);
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.blog-tags {
    display: flex;
    gap: 8px;
}

.blog-tag {
    background: rgba(185, 158, 252, 0.1);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(185, 158, 252, 0.2);
}

.updated-badge {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal Styles */
.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.close-modal {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

/* Blog Content Styles - CORREÇÃO DO HEADER STICKY */
.sticky-header {
    position: sticky;
    top: 80px; /* Ajustado para dar espaço ao nav fixo */
    z-index: 40;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    padding: 20px 0;
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Garantir que o background do sticky header cubra completamente */
.sticky-header::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -20px;
    right: -20px;
    bottom: -10px;
    background: inherit;
    z-index: -1;
}

/* Ajustar o espaçamento após o header sticky */
.sticky-header + .mb-16 {
    margin-bottom: 2rem; /* Reduzir o espaço excessivo */
}

/* Garantir que os posts não apareçam por trás do header */
#blogPosts {
    position: relative;
    z-index: 10;
}

/* Ajuste no padding da seção posts */
#posts {
    padding-top: 120px; /* Aumentado para dar mais espaço inicial */
}

/* Box shadow diferenciado para tema dark */
.dark .sticky-header {
    background: #262626; /* Cor específica do tema dark */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Box shadow para tema light */
.light .sticky-header {
    background: #ffffff; /* Cor específica do tema light */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.blog-content {
    color: var(--text-primary);
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.blog-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.blog-content h2 {
    font-size: 1.75rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.blog-content code {
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
}

.blog-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 1rem 0;
}

.blog-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

.blog-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 16px;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 16px;
    border-radius: 0 8px 8px 0;
}

.blog-content ul,
.blog-content ol {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.blog-content a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: all 0.3s ease;
}

.blog-content a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .blog-card {
        padding: 20px;
    }
    
    .blog-title {
        font-size: 1.1rem;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .blog-content {
        padding: 20px;
    }
    
    .blog-content h1 {
        font-size: 1.75rem;
    }
    
    .blog-content h2 {
        font-size: 1.5rem;
    }
    
    .blog-content h3 {
        font-size: 1.25rem;
    }

    /* Ajustes do sticky header para mobile */
    .sticky-header {
        top: 70px; /* Menor no mobile */
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #posts {
        padding-top: 100px; /* Menor no mobile */
    }
}

/* Animation for blog cards appearing */
.blog-card {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease forwards;
}

.blog-card:nth-child(1) { animation-delay: 0.1s; }
.blog-card:nth-child(2) { animation-delay: 0.2s; }
.blog-card:nth-child(3) { animation-delay: 0.3s; }
.blog-card:nth-child(4) { animation-delay: 0.4s; }
.blog-card:nth-child(5) { animation-delay: 0.5s; }
.blog-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal animation */
#postModal {
    animation: fadeInModal 0.3s ease;
}

#postModal .modal-content {
    animation: slideInModal 0.3s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInModal {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth scroll behavior for modal */
.modal-content {
    scroll-behavior: smooth;
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state styling */
#blogEmpty i {
    color: var(--accent-color);
    opacity: 0.6;
}

/* Error state styling */
#blogError .bg-red-100 {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.dark #blogError .text-red-700 {
    color: #fca5a5;
}

.light #blogError .text-red-700 {
    color: #dc2626;
}