:root {
    --primary: #4C51BF;
    --secondary: #2D3748;
    --accent: #38B2AC;
    --destructive: #e74c3c;
    --destructive-hover: #c0392b;
    --background: #F7FAFC;
    --light-gray: #EDF2F7;
    --white: #ffffff;
    --text-color: #4A5568;
    --cv-color-primary: var(--primary); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header, Footer, Navegação, Botões (ESTILOS CONSOLIDADOS E MINIMIZADOS) */
header { background: var(--white); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); position: sticky; top: 0; z-index: 1000; }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }
.header-container { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary); text-decoration: none; }
#main-nav ul { list-style: none; display: flex; }
#main-nav ul li { margin-left: 25px; }
#main-nav ul li a { text-decoration: none; color: var(--secondary); font-weight: 500; transition: color 0.3s ease; }
#main-nav ul li a:hover { color: var(--primary); }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--secondary); }

.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.3s ease; text-align: center; text-decoration: none; }
.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: #3f439c; transform: translateY(-1px); }
.btn-secondary { background-color: var(--light-gray); color: var(--text-color); border: 1px solid #ccc; }
.btn-secondary:hover { background-color: #e2e8f0; }
.btn-add { background: var(--accent); color: var(--white); border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; transition: background 0.3s ease; margin-top: 10px; }
.btn-add span { font-size: 1.2rem; margin-right: 5px; }
.btn-add:hover { background: #2c9a94; }

.section { padding: 80px 0; }
.hero { background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--white); text-align: center; padding: 100px 0; }
.hero h1 { font-size: 3rem; margin-bottom: 20px; line-height: 1.2; }
.hero p { font-size: 1.2rem; margin-bottom: 40px; opacity: 0.9; }
.section-title { text-align: center; margin-bottom: 60px; }
.section-title h2 { font-size: 2.5rem; color: var(--secondary); margin-bottom: 10px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.feature-card { background: var(--white); padding: 30px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); text-align: center; }
.feature-icon { font-size: 2rem; margin-bottom: 15px; }
.feature-card h3 { color: var(--primary); margin-bottom: 10px; }

/* Estrutura Principal da Aplicação (Gerador e Preview) */
.app-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
}

.form-section {
    background: var(--white);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 80px;
    height: fit-content;
}

.preview-section {
    position: sticky;
    top: 80px; 
    height: fit-content;
}

/* Barra de Progresso */
.progress-bar-container {
    background: var(--light-gray);
    border-radius: 5px;
    height: 35px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.progress-bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.5s ease-in-out; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--secondary); font-weight: 600; font-size: 0.9rem; z-index: 10; }

/* Formulário (campos dinâmicos) */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px; border: 1px solid var(--light-gray); border-radius: 5px; font-size: 1rem;
}
.form-section h3 { border-bottom: 2px solid var(--light-gray); padding-bottom: 10px; margin-bottom: 20px; color: var(--primary); }
.dynamic-section-item { background: var(--background); padding: 20px; border-radius: 8px; margin-bottom: 15px; border: 1px solid var(--light-gray); position: relative; cursor: grab; }
.dynamic-section-item h4 { margin: -20px -20px 15px -20px; padding: 10px 20px; background: var(--light-gray); border-radius: 8px 8px 0 0; border-bottom: 1px solid #ccc; }
.remove-btn { position: absolute; top: 5px; right: 5px; background: var(--destructive); color: var(--white); border: none; border-radius: 50%; width: 25px; height: 25px; font-size: 1rem; cursor: pointer; line-height: 1; }
.remove-btn:hover { background: var(--destructive-hover); }
.form-group-skill, .form-group-language, .form-group-certification { display: grid; grid-template-columns: 2fr 1fr 50px; gap: 10px; align-items: center; }

/* Animação de entrada/saída nos passos */
.form-steps-wrapper { position: relative; }
.form-step { 
    display: none;
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    transform: translateX(20px);
    padding-top: 1px;
}
.form-step.active { 
    display: block; 
    opacity: 1; 
    transform: translateX(0); 
}

/* ==================================================
  CSS ADICIONADO: Navegação do Wizard (Próximo/Anterior)
  ==================================================
*/
.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}
.step-indicator {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}
.wizard-nav div {
    display: flex;
    gap: 10px; /* Espaço entre os botões "Anterior" e "Próximo" */
}
/* ================================================== */


/* Preview Selector */
.template-selector { background: var(--white); padding: 20px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); margin-bottom: 20px; }
.template-options { display: flex; gap: 10px; justify-content: center; }
.template-option { border: 2px solid var(--light-gray); border-radius: 5px; cursor: pointer; opacity: 0.7; transition: all 0.3s; }
.template-option img { width: 50px; height: auto; display: block; }
.template-option.active, .template-option:hover { border-color: var(--primary); opacity: 1; transform: scale(1.05); }

/* Container de Preview */
.cv-preview-wrapper {
    background: var(--white);
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    max-height: 800px; 
    height: 90vh;
    padding: 10px;
}
.cv-preview {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    transform-origin: top center;
    transition: transform 0.3s ease;
}

/* Footer & Newsletter */
footer { background: var(--secondary); color: var(--light-gray); padding: 40px 0 20px; font-size: 0.9rem; }
footer a { color: var(--accent); text-decoration: none; transition: color 0.3s; }
footer a:hover { color: var(--white); }
.footer-content { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.footer-column { flex: 1; }
.footer-column.newsletter-column { flex: 1.5; } 
.footer-column h3 { color: var(--white); margin-bottom: 15px; font-size: 1.2rem; }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 8px; }
.newsletter-form { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.newsletter-form input[type="email"] { padding: 10px; border: none; border-radius: 5px; font-size: 1rem; width: 100%; color: var(--secondary); }
.newsletter-form button { background-color: var(--accent); color: var(--white); padding: 10px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; transition: background 0.3s; }
.newsletter-form button:hover { background: #2c9a94; }
.copyright { text-align: center; border-top: 1px solid #5A677B; padding-top: 20px; opacity: 0.8; }

/* Estilos de Páginas Estáticas (Blog, etc) */
.article-card-full { display: flex; overflow: hidden; }
.article-card-image { width: 35%; min-height: 200px; background-size: cover; background-position: center; }
.article-card-content { width: 65%; padding: 25px; }
.blog-container { display: grid; grid-template-columns: 3fr 1fr; gap: 40px; padding: 40px 0; }
.sidebar-widget.newsletter-widget { background: var(--primary); color: var(--white); text-align: center; }

/* Estilos de Templates (Foto Otimizada) */
.cv-page { width: 210mm; min-height: 297mm; }
.moderno-foto, .classico-foto, .criativo-foto { object-fit: cover; object-position: center; }

/* Pop-up de Cookies */
.cookie-banner { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--secondary); color: var(--white); padding: 15px 20px; z-index: 2000; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2); font-size: 0.9rem; }
.cookie-banner a { color: var(--accent); text-decoration: underline; }
.cookie-banner button { background: var(--accent); color: var(--white); border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-weight: 600; margin-left: 20px; }
.cookie-banner button:hover { background: #2c9a94; }


/* =============================================== */
/* --- INÍCIO: ESTILOS DOS TEMPLATES DE CV --- */
/* =============================================== */

.cv-page { background: var(--white); box-shadow: 0 0 10px rgba(0,0,0,0.1); color: #000; }
.cv-page h1 { font-size: 2rem; color: var(--secondary); margin-bottom: 5px; line-height: 1.2; }
.cv-page h2 { font-size: 1.2rem; color: var(--cv-color-primary); border-bottom: 2px solid var(--cv-color-primary); padding-bottom: 5px; margin: 20px 0 15px 0; text-transform: uppercase; letter-spacing: 1px; }
.cv-titulo { font-size: 1.1rem; font-weight: 600; color: var(--text-color); margin-bottom: 15px; }
.cv-resumo { font-size: 0.9rem; line-height: 1.5; margin-bottom: 15px; color: var(--secondary); }
.cv-section-item { margin-bottom: 15px; }
.cv-item-title { font-size: 1rem; font-weight: 700; color: var(--secondary); display: block; }
.cv-item-subtitle { font-size: 0.9rem; font-weight: 600; color: var(--text-color); margin: 2px 0 5px 0; display: block; }
.cv-meta { font-size: 0.8rem; font-style: italic; color: #666; margin-bottom: 5px; display: block; }
.cv-section-item p, .cv-section-item ul { font-size: 0.9rem; color: var(--secondary); margin-left: 15px; }
.cv-skill-item { margin-bottom: 8px; font-size: 0.9rem; }

/* --- Template: Moderno --- */
.template-moderno { display: flex; min-height: 297mm; }
.moderno-sidebar { width: 35%; background: var(--cv-color-primary); color: var(--white); padding: 30px; }
.moderno-sidebar h2 { color: var(--white); border-bottom: 2px solid var(--accent); }
.moderno-sidebar ul { list-style: none; padding: 0; margin: 0; }
.moderno-sidebar .cv-skill-item { display: flex; justify-content: space-between; }
.moderno-sidebar .cv-skill-item .cv-meta { color: var(--light-gray); opacity: 0.9; }
.moderno-header { text-align: center; margin-bottom: 30px; }
.moderno-foto { width: 150px; height: 150px; border-radius: 50%; border: 4px solid var(--white); margin-bottom: 15px; object-fit: cover; }
.moderno-contato li { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.9rem; word-break: break-all; }
.moderno-main { width: 65%; padding: 30px; }
.moderno-main p { margin-left: 0; }

/* --- Template: Clássico --- */
.template-classico { padding: 30px; min-height: 297mm; }
.classico-header { text-align: center; border-bottom: 2px solid var(--light-gray); padding-bottom: 20px; margin-bottom: 20px; position: relative; }
.classico-foto { width: 120px; height: 120px; border-radius: 50%; margin-bottom: 15px; object-fit: cover; }
.classico-header h1 { color: var(--secondary); }
.classico-contato { font-size: 0.9rem; color: #666; margin-top: 10px; }
.template-classico .cv-item-title { display: inline; }
.template-classico .cv-item-subtitle { display: inline; }

/* --- Template: Criativo --- */
.template-criativo { display: flex; min-height: 297mm; }
.criativo-sidebar { width: 35%; background: var(--light-gray); padding: 30px; }
.criativo-sidebar h2 { color: var(--primary); border-bottom-color: var(--primary); }
.criativo-foto { width: 100%; border-radius: 10px; margin-bottom: 20px; object-fit: cover; }
.criativo-contato { list-style: none; padding: 0; }
.criativo-contato li { margin-bottom: 10px; font-size: 0.9rem; word-break: break-all; }
.cv-progress-bar { width: 100%; background: #ccc; border-radius: 5px; height: 8px; margin-top: 5px; overflow: hidden; }
.cv-progress-bar div { height: 100%; background: var(--cv-color-primary); border-radius: 5px; }
.criativo-main { width: 65%; padding: 30px; }
.criativo-main h1 { color: var(--primary); }
.criativo-main .cv-titulo { display: block; color: var(--primary); }
.criativo-main .cv-section-item ul { list-style-type: disc; margin-top: 5px; }

/* =============================================== */
/* --- FIM: ESTILOS DOS TEMPLATES DE CV --- */
/* =============================================== */


/* --- NOVO: Botão de Toggle Preview --- */
.btn-toggle-preview {
    display: none; /* Escondido por defeito (no desktop) */
    width: 100%;
    margin-bottom: 15px;
}


/* Responsividade */
@media (max-width: 992px) {
    .header-container { width: 100%; padding: 0 15px; }
    #main-nav { display: none; position: absolute; top: 60px; left: 0; background: var(--white); width: 100%; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
    #main-nav.active { display: block; }
    #main-nav ul { flex-direction: column; }
    #main-nav ul li { margin: 0; }
    #main-nav ul li a { display: block; padding: 15px; border-bottom: 1px solid var(--light-gray); }
    .mobile-menu-btn { display: block; }
    
    .app-container { grid-template-columns: 1fr; gap: 30px; }
    .form-section, .preview-section { position: static; height: auto; }
    
    .btn-toggle-preview {
        display: block; /* Mostra o botão no mobile */
    }
    
    .cv-preview-wrapper { 
        display: none; /* Esconde o preview por defeito no mobile */
        height: auto; 
        max-height: 600px;
        overflow-x: auto; 
    }
    
    .cv-preview-wrapper.visible {
        display: block; /* Mostra o preview quando o botão é clicado */
    }
    
    .cv-preview { 
        transform-origin: top center; 
        min-height: auto; 
        padding: 10px; 
    }
    
    .cookie-banner { flex-direction: column; align-items: flex-start; text-align: center; }
    .cookie-banner button { margin: 10px auto 0 auto; width: 100%; }
    .footer-content { flex-direction: column; }
    .blog-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .cv-preview { 
        /* larguras fixas removidas */
    }
    
    .article-card-full { flex-direction: column; }
    .article-card-image { width: 100%; min-height: 200px; }
    .article-card-content { width: 100%; }

    .form-group-skill, .form-group-language, .form-group-certification {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .form-group-skill .remove-btn, 
    .form-group-language .remove-btn, 
    .form-group-certification .remove-btn {
        position: static; 
        width: 100%;
        height: 30px;
        border-radius: 5px;
        margin-top: 5px;
        grid-column: span 2; 
    }
}

@media (max-width: 480px) {
    .cv-preview { 
       /* larguras fixas removidas */
    }
    
    .form-group-skill, .form-group-language, .form-group-certification { 
        grid-template-columns: 1fr; 
    }
    
    .form-group-skill .remove-btn, 
    .form-group-language .remove-btn, 
    .form-group-certification .remove-btn {
        grid-column: span 1; 
    }
}

/* Estilos de Loading e Spin */
.btn.btn-loading { cursor: not-allowed; opacity: 0.9; }
.btn-loading::after { content: ""; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--white); border-radius: 50%; border-top-color: transparent; animation: spin 1s linear infinite; margin-left: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* CSS de Utilidade para a Geração do PDF */
.cv-capture-mode {
    width: 210mm !important;
    min-height: 297mm !important;
    transform: none !important;
    transform-origin: top left !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.cv-capture-mode .moderno-foto, 
.cv-capture-mode .classico-foto, 
.cv-capture-mode .criativo-foto {
    width: 100%;
    height: auto;
}

/* Estilos para Ícones SVG (Substituição de Emojis) */
.icon {
    width: 1em; /* Tamanho relativo à fonte */
    height: 1em;
    margin-right: 8px;
    vertical-align: -0.15em; /* Alinhamento vertical */
}