/* ==========================================================================
   Estilos Gerais da Página do Gerador de Currículo
   ========================================================================== */

:root {
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #6366f1;
    --success: #10b981;
    --danger: #ef4444;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --resume-header-bg: #162238;
    --resume-text-color: #334155;
    --resume-title-color: #0f172a;
    --resume-accent-color: #1e3a8a;
    --resume-tag-color: #2563eb;
}

[data-theme="dark"] {
    --bg-page: #0b1120;
    --bg-surface: #1e293b;
    --bg-sidebar: #0f172a;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.15);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.curriculo-body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header da Aplicação */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.1rem;
}

.header-brand .logo-badge {
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Barra de Entrada do LinkedIn */
.linkedin-bar-container {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.linkedin-bar-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.linkedin-input-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 300px;
    max-width: 580px;
    background-color: var(--bg-page);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.35rem 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.linkedin-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.linkedin-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a66c2;
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

.linkedin-input-group input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.92rem;
    padding: 0.5rem 0.25rem;
    outline: none;
}

.linkedin-quick-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--bg-page);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-success {
    background-color: #059669;
    color: white;
}

.btn-success:hover {
    background-color: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--bg-page);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--border-color);
}

/* Layout Principal de 2 Painéis */
.app-main-layout {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 2rem;
    flex: 1;
    align-items: start;
}

@media (max-width: 1100px) {
    .app-main-layout {
        grid-template-columns: 1fr;
    }
}

/* Painel de Edição (Formulário) */
.editor-pane {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    position: sticky;
    top: 90px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.editor-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Acordeões de Seção */
.editor-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
    background-color: var(--bg-surface);
    transition: border-color 0.2s;
}

.section-summary {
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-page);
}

.section-summary::-webkit-details-marker {
    display: none;
}

.section-summary::after {
    content: "▼";
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

details[open] .section-summary::after {
    transform: rotate(180deg);
}

.section-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Grupos de Formulário */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-page);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 85px;
    line-height: 1.4;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Cards Dinâmicos com Botões de Excluir */
.dynamic-item-card {
    background-color: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.dynamic-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-remove-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Painel de Visualização do PDF */
.preview-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.preview-toolbar {
    width: 100%;
    max-width: 210mm;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.preview-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.zoom-badge {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.preview-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 1rem 0 3rem;
}

/* ==========================================================================
   TEMPLATE DO CURRÍCULO (A4 - 210mm x 297mm)
   Largura estrita e proteção contra estouro de margem direita
   ========================================================================== */

.resume-paper {
    width: 210mm;
    max-width: 210mm;
    min-height: 297mm;
    height: auto;
    background-color: #ffffff !important;
    color: #1e293b;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    transform-origin: top center;
    transition: transform 0.2s ease;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    line-height: 1.34;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
}

/* Cabeçalho do Currículo */
.resume-header {
    background-color: #162238 !important;
    background: #162238 !important;
    color: #ffffff !important;
    padding: 16px 24px 12px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    border: none;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.resume-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff !important;
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
    word-break: break-word;
}

.resume-contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    row-gap: 4px;
    font-size: 10px;
    color: #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.contact-item span,
.contact-item a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 10px;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.contact-item a {
    cursor: pointer;
}

.contact-item a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.contact-item svg,
.contact-item i {
    width: 13px;
    height: 13px;
    color: #60a5fa;
    flex-shrink: 0;
}

/* Corpo de 2 Colunas */
.resume-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
    padding: 12px 24px 14px 20px;
    column-gap: 24px;
    align-items: start;
    box-sizing: border-box;
    width: 100%;
}

.col-left {
    min-width: 0;
    width: 240px;
    box-sizing: border-box;
}

.col-right {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding-right: 4px;
}

/* Títulos de Seção */
.section-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0f172a;
    border-bottom: 1.5px solid #0f172a;
    padding-bottom: 2px;
    margin-bottom: 6px;
    margin-top: 9px;
    width: 100%;
    box-sizing: border-box;
}

.section-heading:first-child {
    margin-top: 0;
}

.heading-bullet {
    width: 8px;
    height: 8px;
    background-color: #0f172a;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Itens da Coluna Esquerda */
.edu-item {
    margin-bottom: 7px;
}

.edu-institution {
    font-size: 10.5px;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
}

.edu-course {
    font-size: 9.5px;
    color: #334155;
    font-weight: 500;
    line-height: 1.25;
    margin: 1px 0;
    word-break: break-word;
}

.edu-period {
    font-size: 8.8px;
    color: #64748b;
    font-weight: 400;
}

/* Listas de Qualificações e Conhecimentos */
.bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bullet-list li {
    font-size: 9.2px;
    color: #1e293b;
    position: relative;
    padding-left: 10px;
    margin-bottom: 3px;
    line-height: 1.28;
    word-break: break-word;
}

.bullet-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: -1px;
    color: #0f172a;
    font-size: 10px;
    font-weight: bold;
}

/* Coluna Direita */
.objective-text {
    font-size: 9.3px;
    color: #334155;
    line-height: 1.35;
    text-align: justify;
    margin-bottom: 3px;
    word-break: normal;
    overflow-wrap: break-word;
}

/* Experiências Profissionais */
.experience-entry {
    margin-bottom: 7px;
}

.experience-entry:last-child {
    margin-bottom: 0;
}

.exp-period-company {
    font-size: 10.2px;
    font-weight: 800;
    color: #0f172a;
    word-break: break-word;
}

.exp-role {
    font-size: 9.8px;
    color: #1d4ed8;
    font-weight: 700;
    margin: 1px 0 2px 0;
    word-break: break-word;
}

.exp-activities-title {
    font-size: 9.2px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 1px;
}

.exp-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.exp-bullets li {
    font-size: 9px;
    color: #334155;
    position: relative;
    padding-left: 10px;
    margin-bottom: 2px;
    line-height: 1.28;
    text-align: justify;
    word-break: normal;
    overflow-wrap: break-word;
}

.exp-bullets li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: -1px;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: bold;
}

/* Modos de Densidade */
.resume-paper.density-compact {
    line-height: 1.22;
}

.resume-paper.density-compact .resume-header {
    padding: 12px 18px 10px;
}

.resume-paper.density-compact .resume-name {
    font-size: 18px;
    margin-bottom: 6px;
}

.resume-paper.density-compact .resume-body {
    grid-template-columns: 230px 1fr;
    padding: 10px 18px 12px 16px;
    column-gap: 16px;
}

.resume-paper.density-compact .section-heading {
    font-size: 10.5px;
    margin-top: 6px;
    margin-bottom: 4px;
}

.resume-paper.density-compact .edu-item,
.resume-paper.density-compact .experience-entry {
    margin-bottom: 5px;
}

.resume-paper.density-compact .objective-text,
.resume-paper.density-compact .exp-bullets li,
.resume-paper.density-compact .bullet-list li {
    font-size: 8.5px;
    line-height: 1.22;
}

.resume-paper.density-spacious {
    line-height: 1.45;
}

.resume-paper.density-spacious .resume-header {
    padding: 22px 28px 18px;
}

.resume-paper.density-spacious .resume-body {
    grid-template-columns: 250px 1fr;
    padding: 18px 28px 22px 24px;
    column-gap: 28px;
}

.resume-paper.density-spacious .section-heading {
    margin-top: 14px;
    margin-bottom: 8px;
}

/* Dropzone de Upload de PDF */
.pdf-dropzone {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    background-color: var(--primary-light);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pdf-dropzone:hover,
.pdf-dropzone.dragover {
    background-color: rgba(37, 99, 235, 0.2);
    border-color: var(--primary-hover);
    transform: scale(1.01);
}

.pdf-dropzone-icon {
    font-size: 2.2rem;
    color: var(--primary);
}

.pdf-dropzone-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.pdf-dropzone-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.linkedin-tutorial-box {
    background-color: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.linkedin-tutorial-box strong {
    color: var(--text-main);
}

/* Modal de Importação */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-backdrop.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Toast de Notificação */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #1e293b;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 200;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   ESTILOS DE IMPRESSÃO / PDF NATIVO
   ========================================================================== */
@page {
    size: A4 portrait;
    margin: 0mm !important;
}

@media print {
    body.curriculo-body {
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .app-header,
    .linkedin-bar-container,
    .editor-pane,
    .preview-toolbar,
    .modal-backdrop,
    .toast-notification {
        display: none !important;
    }

    .app-main-layout {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .preview-pane {
        display: block !important;
    }

    .preview-wrapper {
        padding: 0 !important;
        margin: 0 !important;
    }

    .resume-paper {
        width: 210mm !important;
        max-width: 210mm !important;
        min-height: 297mm !important;
        height: auto !important;
        max-height: none !important;
        box-shadow: none !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
}
