/* --- ESTILO REFINADO FINAL V7.1 --- */

/* 1. IMPORTAÇÃO DE FONTES E CONFIGURAÇÃO DE VARIÁVEIS */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&family=Roboto+Mono&family=Roboto:wght@400;700&display=swap');

:root {
    --cor-primaria: #0f1f3a;
    --cor-secundaria: #1e4d7a;
    --cor-destaque: #fbbf24;
    --cor-fundo: #f8fafc;
    --cor-texto: #1e293b;
    --cor-sucesso: #28a745;
    --cor-erro: #dc3545;
    --cor-borda: #dee2e6;
    --sombra-suave: 0 4px 12px rgba(0, 0, 0, 0.06);
    --sombra-forte: 0 6px 15px rgba(0, 0, 0, 0.1);

    --cor-erro-light: #f8d7da;
    --cor-sucesso-light: #d4edda;
    --cor-secundaria-light: #e2f3ff;
}

/* 2. RESET E ESTILOS GERAIS DO BODY */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.7;
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

/* 3. LAYOUT PRINCIPAL E SIDEBAR */
.page-container {
    display: flex;
    flex-grow: 1;
}

#sidebar {
    width: 280px;
    background-color: #ffffff;
    border-right: 1px solid var(--cor-borda);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out, background-color 0.3s;
    z-index: 1001;
}

.content-wrapper {
    margin-left: 280px;
    width: calc(100% - 280px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    flex-grow: 1;
    overflow-x: hidden; /* CORREÇÃO APLICADA AQUI */
}

#progress-bar-container {
    width: 100%;
    height: 5px;
    background-color: transparent;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1002;
}

#progress-bar {
    height: 100%;
    background: var(--cor-destaque);
    width: 0%;
    transition: width 0.4s ease-out;
    border-radius: 0 2px 2px 0;
}

#sidebar h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--cor-primaria);
    font-size: 1.2rem;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--cor-destaque);
    margin-bottom: 15px;
    text-align: center;
}

#sidebar ul {
    list-style: none;
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#sidebar ul li a {
    display: block;
    color: #495057;
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#sidebar ul li a:hover {
    background-color: #f0f6fc;
    color: var(--cor-primaria);
}

#sidebar ul li a.active {
    background-color: var(--cor-secundaria);
    color: #ffffff;
    font-weight: bold;
}

#sidebar ul li a.locked {
    color: #999;
    cursor: not-allowed;
    background-color: transparent;
}

#sidebar ul li a.locked:hover {
    color: #999;
    background-color: transparent;
}

#sidebar ul li a.locked::after {
    content: '🔒';
    float: right;
    font-size: 0.8rem;
}

.sidebar-tools {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--cor-borda);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-tool-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--cor-secundaria), var(--cor-primaria));
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    transition: all 0.3s;
    text-align: center;
}

.sidebar-tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30,77,122,.3);
}

.sidebar-tool-btn i {
    margin-right: 8px;
}

/* 4. CABEÇALHO E RODAPÉ */
header {
    background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-secundaria) 100%);
    color: #ffffff;
    padding: 1.5rem 2rem;
    text-align: center;
    border-bottom: 4px solid var(--cor-destaque);
    margin-top: 5px;
    box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

header h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 2.5rem;
    margin: 0;
}

footer {
    background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-secundaria) 100%);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    border-top: 3px solid var(--cor-destaque);
    font-size: 0.9rem;
}

/* 5. CONTEÚDO PRINCIPAL (MÓDULOS) */
main.content {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex-grow: 1;
}

.module {
    display: none;
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: var(--sombra-suave);
    animation: fadeIn 0.5s ease-in-out;
    transition: background-color 0.3s;
}

.module.active {
    display: block;
}

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

.module h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 2.2rem;
    color: var(--cor-primaria);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    text-align: left;
    border-bottom: 3px solid var(--cor-destaque);
}

.module h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.6rem;
    color: var(--cor-secundaria);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    text-align: left;
}

.module ul {
    list-style: none;
    padding-left: 0;
}

.module ul li {
    padding-left: 1.8rem;
    position: relative;
    margin-bottom: 1rem;
}

.module ul li::before {
    content: '✓';
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
    color: var(--cor-sucesso);
}

.module-completion {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--cor-borda);
    text-align: center;
}

.complete-module-btn {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.complete-module-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22,163,74,.3);
}

.complete-module-btn i {
    margin-right: 8px;
}

/* 6. ESTILOS DE TABELAS PADRONIZADOS */
.responsive-table {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--cor-borda);
}

.data-table thead th {
    background-color: var(--cor-primaria);
    color: white;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 400;
}

.data-table tbody tr {
    background-color: #fff;
    transition: background-color 0.2s;
}

.data-table tbody tr:nth-of-type(even) {
    background-color: var(--cor-fundo);
}

.data-table tbody tr:hover {
    background-color: var(--cor-secundaria-light);
}

/* 7. ELEMENTOS INTERATIVOS */
.slideshow-container {
    position: relative;
    width: 100%;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 8px;
}

.slideshow-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
    cursor: grab;
}

.slideshow-wrapper:active {
    cursor: grabbing;
}

.slide {
    flex: 0 0 100%;
}

.slide-description {
    background-color: var(--cor-fundo);
    padding: 1.5rem;
    width: 100%;
    text-align: center;
}

.slide-description h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--cor-secundaria);
    margin-bottom: 0.5rem;
}

.slide-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s ease;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 51, 102, 0.6);
    border: none;
    z-index: 5;
}

.next-slide { right: 1rem; }
.prev-slide { left: 1rem; }
.slide-nav:hover { background-color: rgba(0, 51, 102, 0.9); }

.slide-indicators {
    text-align: center;
    padding-top: 1rem;
}

.indicator-dot {
    cursor: pointer;
    height: 12px;
    width: 12px;
    margin: 0 4px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.indicator-dot.active, .indicator-dot:hover {
    background-color: var(--cor-secundaria);
}

#simulator-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    margin-top: 1rem;
    min-height: 200px;
}

#assembly-area {
    flex-basis: 60%;
    min-width: 250px;
    background-color: #f0f6fc;
    border: 2px dashed var(--cor-borda);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
}

.eixo-img {
    background-color: #6c757d;
    color: white;
    padding: 5px 30px;
    border-radius: 3px;
    font-weight: bold;
    text-align: center;
    margin-top: auto;
    font-family: 'Roboto Mono', monospace;
}

#parts-box {
    flex-basis: 35%;
    min-width: 200px;
    background-color: var(--cor-fundo);
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.part {
    background-color: var(--cor-destaque);
    color: var(--cor-primaria);
    padding: 12px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    cursor: grab;
    border: 1px solid #e0a800;
}

#reset-simulator-btn {
    display: block;
    margin: 1.5rem auto 0;
    background-color: transparent;
    color: var(--cor-secundaria);
    border: 2px solid var(--cor-secundaria);
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

#reset-simulator-btn:hover {
    background-color: var(--cor-secundaria);
    color: white;
}

#quiz-container, .form-certificado, .reprovado-container {
    background-color: #f0f6fc;
    padding: 1.5rem;
    border-radius: 8px;
}

#quiz-container h3, .form-certificado h3, .reprovado-container h3 {
    text-align: center;
}

#opcoes-quiz button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem;
    margin: 0.5rem 0;
    font-size: 1rem;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    cursor: pointer;
    background-color: #fff;
    transition: all 0.3s;
}

#opcoes-quiz button.correta {
    background-color: var(--cor-sucesso-light);
    border-color: var(--cor-sucesso);
    color: #155724;
    font-weight: bold;
}

#opcoes-quiz button.incorreta {
    background-color: var(--cor-erro-light);
    border-color: var(--cor-erro);
    color: #721c24;
}

.form-certificado label {
    display: block;
    margin: 1rem 0 0.5rem;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.form-certificado input, .form-certificado select {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0.5rem auto 1rem;
    padding: 0.8rem;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    font-size: 1rem;
}

#gerar-certificado-btn, #tentar-novamente-btn {
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    color: white;
    font-weight: bold;
    width: 100%;
    max-width: 400px;
    transition: all 0.2s ease;
}

#gerar-certificado-btn { background-color: var(--cor-sucesso); }
#gerar-certificado-btn:hover { background-color: #218838; }
#tentar-novamente-btn { background-color: var(--cor-secundaria); }
#tentar-novamente-btn:hover { background-color: var(--cor-primaria); }

.checkpoint-container {
    background-color: #f0f6fc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.checkpoint-container h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--cor-primaria);
    margin-bottom: 1rem;
}

.checkpoint-options label {
    display: block;
    background-color: #fff;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid var(--cor-borda);
    transition: all 0.2s;
}

.checkpoint-options input[type="radio"] {
    margin-right: 10px;
}

.checkpoint-options label:hover {
    border-color: var(--cor-secundaria);
    background-color: #f8f9fa;
}

.checkpoint-btn {
    background-color: var(--cor-secundaria);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.checkpoint-btn:hover {
    background-color: var(--cor-primaria);
}

/* ESTILO PADRÃO DE FEEDBACK */
.feedback-box {
    margin-top: 1rem;
    font-weight: bold;
    padding: 12px 15px;
    border-radius: 5px;
    border-left: 5px solid transparent;
    transition: all 0.3s ease;
    display: none;
}

.feedback-box.show { display: block; }
.feedback-box.correct { background-color: var(--cor-sucesso-light); border-left-color: var(--cor-sucesso); color: #155724; }
.feedback-box.incorrect { background-color: var(--cor-erro-light); border-left-color: var(--cor-erro); color: #721c24; }
.feedback-box.info { background-color: var(--cor-secundaria-light); border-left-color: var(--cor-secundaria); color: var(--cor-secundaria); }
.checkpoint-feedback { display: block; } /* Override para sempre ser visível após clique */

/* 8. MODAIS */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1010;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--sombra-forte);
    transition: background-color 0.3s;
}

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

.modal-header h2 { margin: 0; border-bottom: none; padding-bottom: 0; }
#glossary-search {
    padding: 8px 12px;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    font-size: 0.9rem;
    width: 250px;
}

.modal-body { overflow-y: auto; }
.modal-close-btn {
    position: absolute;
    top: 10px; right: 15px;
    background: transparent;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover { color: var(--cor-erro); }

.glossary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 2rem;
}

.glossary-entry.hidden { display: none; }
dl dt { font-family: 'Roboto Mono', monospace; font-weight: bold; color: var(--cor-primaria); margin-top: 1rem; font-size: 1.1em; }
dl dd { margin-left: 0; padding-left: 1rem; border-left: 3px solid #f0f6fc; margin-bottom: 0.5rem; }

.achievements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.achievement-item { background-color: var(--cor-fundo); border: 1px solid var(--cor-borda); border-radius: 8px; padding: 1.5rem; text-align: center; transition: all 0.3s ease; }
.achievement-item .icon { font-size: 3rem; margin-bottom: 1rem; color: var(--cor-destaque); transition: all 0.3s ease; }
.achievement-item h4 { font-family: 'Oswald', sans-serif; color: var(--cor-primaria); margin: 0 0 0.5rem 0; }
.achievement-item p { font-size: 0.9rem; color: var(--cor-texto); margin: 0; }
.achievement-item.locked { background-color: transparent; border-style: dashed; }
.achievement-item.locked .icon { color: #adb5bd; filter: grayscale(100%); transform: scale(0.9); }
.achievement-item.locked h4 { color: #6c757d; }
.achievement-item.locked p::before { content: 'Bloqueado: '; font-weight: bold; }

/* 9. BOTÕES FLUTUANTES, TOASTS E CONQUISTAS */
#tip-toast-btn, #theme-toggle-btn {
    position: fixed;
    width: 50px; height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--sombra-forte);
    z-index: 1005;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tip-toast-btn { bottom: 20px; right: 20px; background-color: var(--cor-destaque); color: var(--cor-primaria); }
#tip-toast-btn:hover { transform: scale(1.1) rotate(15deg); background-color: #ffca2c; }
#theme-toggle-btn { bottom: 20px; left: 20px; background-color: var(--cor-primaria); color: white; }
#theme-toggle-btn:hover { transform: scale(1.1); background-color: var(--cor-secundaria); }

.tip-toast {
    position: fixed;
    bottom: 90px; right: 20px;
    background-color: rgba(0, 51, 102, 0.95);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--sombra-forte);
    z-index: 1004;
    max-width: 320px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    font-family: 'Roboto Mono', monospace;
}

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

.achievement-toast {
    position: fixed;
    top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: linear-gradient(135deg, var(--cor-destaque), #ffd700);
    color: var(--cor-primaria);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--sombra-forte);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-toast.show { transform: translateX(-50%) translateY(0); }
.achievement-toast .icon { font-size: 2.5rem; }
.achievement-toast .text h4 { margin: 0 0 5px 0; font-family: 'Oswald', sans-serif; }
.achievement-toast .text p { margin: 0; font-size: 0.9rem; }

/* 10. GALERIA DE FALHAS (Módulo 9) */
.failure-investigator-container { margin-top: 1.5rem; }
.investigator-controls input {
    width: 100%;
    padding: 10px 15px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--cor-borda);
    margin-bottom: 1.5rem;
}
.failure-gallery-new { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.failure-card-new { background-color: var(--cor-fundo); border: 1px solid var(--cor-borda); border-radius: 8px; display: flex; align-items: flex-start; padding: 1.5rem; transition: all 0.2s ease-in-out; }
.failure-card-new.hidden { display: none; }
.failure-card-new:hover { transform: translateY(-5px); box-shadow: var(--sombra-forte); }
.failure-icon { flex-shrink: 0; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-right: 1rem; }
.failure-content h4 { font-family: 'Oswald', sans-serif; color: var(--cor-primaria); margin-bottom: 0.5rem; }
.failure-content p { font-size: 0.95rem; line-height: 1.6; }
.failure-content p:last-child { margin-bottom: 0; }

/* 11. TOOLTIPS DO GLOSSÁRIO */
.glossary-term { text-decoration: underline dotted var(--cor-secundaria); text-decoration-thickness: 1.5px; cursor: help; position: relative; }
#dynamic-tooltip {
    position: absolute;
    z-index: 1020;
    background-color: var(--cor-primaria);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: var(--sombra-forte);
    max-width: 300px;
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-weight: normal;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    transform: translateY(10px);
    --arrow-transform: rotate(180deg);
    --arrow-top: auto;
    --arrow-bottom: -10px;
}

#dynamic-tooltip.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#dynamic-tooltip::after {
    content: ''; position: absolute;
    bottom: var(--arrow-bottom); top: var(--arrow-top);
    left: 50%;
    transform: translateX(-50%) var(--arrow-transform);
    border-width: 5px; border-style: solid;
    border-color: var(--cor-primaria) transparent transparent transparent;
}

/* 12. SIMULADORES E INTERAÇÕES ESPECÍFICAS */
.cleaning-simulator, .disassembly-challenge, .brinelling-comparator-container, .preload-visualizer-container, .grease-calculator-container {
    background-color: #f0f6fc;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2.5rem 0;
}

.cleaning-simulator h3, .disassembly-challenge h3, .brinelling-comparator-container h3, .preload-visualizer-container h3, .grease-calculator-container h3 {
    text-align: center;
    margin-top: 0;
    color: var(--cor-primaria);
}

/* Continuação da Seção 12 */
.cleaning-workspace { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 1rem; }
.tool-chest, .workstation { border: 2px dashed var(--cor-borda); border-radius: 8px; padding: 1rem; min-height: 150px; }
.tool-chest { flex-basis: 30%; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.workstation { flex-basis: 60%; min-width: 300px; background-color: #e9ecef; }
.cleaning-tool { background-color: #fff; border: 1px solid var(--cor-borda); padding: 10px 15px; border-radius: 5px; cursor: grab; text-align: center; font-weight: bold; }
.cleaning-tool.dragging { opacity: 0.5; }

.disassembly-visual { text-align: center; margin: 1rem 0; font-size: 4rem; color: var(--cor-primaria); }
.disassembly-toolbox { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1rem; }
.disassembly-tool-btn { background-color: var(--cor-secundaria); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: all 0.2s ease; }
.disassembly-tool-btn:hover { background-color: var(--cor-primaria); }

.comparator-columns { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-around; margin-top: 1.5rem; }
.comparator-col { flex-basis: 45%; min-width: 250px; text-align: left; background-color: #fff; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--cor-borda); transition: all 0.2s ease; }
.comparator-col h4 { font-family: 'Oswald', sans-serif; color: var(--cor-secundaria); margin-bottom: 0.5rem; }
.comparator-col p { font-size: 0.95rem; line-height: 1.6; margin-bottom: 0.8rem; }
.comparator-btn { background-color: var(--cor-secundaria); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 1rem; transition: all 0.2s ease; margin-top: 1rem; }
.comparator-btn:hover { background-color: var(--cor-primaria); transform: translateY(-2px); }

.calculator-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: center; margin-top: 1rem; }
.calculator-form .form-group { flex-grow: 1; }
.calculator-form label { display: block; margin-bottom: 0.5rem; font-weight: bold; font-size: 0.9rem; }
.calculator-form input { width: 100%; padding: 0.8rem; border: 1px solid var(--cor-borda); border-radius: 5px; font-size: 1rem; }
.calculator-form button { background-color: var(--cor-sucesso); color: white; border: none; padding: 0.8rem 1.5rem; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 1rem; transition: all 0.2s; height: 48px; }
.calculator-form button:hover { background-color: #218838; transform: translateY(-2px); }
.grease-result { margin-top: 1.5rem; padding: 1.5rem; border-radius: 5px; background-color: var(--cor-secundaria-light); border-left: 5px solid var(--cor-secundaria); text-align: center; display: none; }
.grease-result.show { display: block; }
.grease-result p { margin: 0; font-size: 1rem; }
.grease-result .result-value { font-size: 2rem; font-family: 'Oswald', sans-serif; color: var(--cor-primaria); margin-top: 0.5rem; }
.calculator-disclaimer { font-size: 0.8rem; color: #6c757d; text-align: center; margin-top: 1.5rem; font-style: italic; }

.visualizer-controls { display: flex; justify-content: center; gap: 10px; margin: 1rem 0; flex-wrap: wrap; }
.visualizer-controls button { padding: 8px 16px; border: 1px solid var(--cor-secundaria); background-color: #fff; color: var(--cor-secundaria); border-radius: 50px; cursor: pointer; font-weight: bold; transition: all 0.2s ease; }
.visualizer-controls button:hover { background-color: var(--cor-secundaria-light); }
.visualizer-controls button.active { background-color: var(--cor-secundaria); color: #fff; }
.visualizer-stage { position: relative; height: 120px; width: 100%; max-width: 400px; margin: 2rem auto; transition: all 0.4s ease; }
.visualizer-stage .axle { position: absolute; top: 50%; left: 0; right: 0; height: 10px; background-color: #adb5bd; transform: translateY(-50%); border-radius: 5px; }
.visualizer-stage .bearing { position: absolute; top: 50%; width: 60px; height: 60px; background-color: #fff; border: 3px solid var(--cor-primaria); border-radius: 5px; transform: translateY(-50%); transition: all 0.4s ease; display: flex; justify-content: center; align-items: center; }
.visualizer-stage .bearing-1 { left: 25%; transform: translate(-50%, -50%); }
.visualizer-stage .bearing-2 { right: 25%; transform: translate(50%, -50%); }
.visualizer-stage .v-mark { font-size: 24px; font-weight: bold; color: var(--cor-erro); transition: transform 0.4s ease; }
.visualizer-stage .v-mark::before { content: 'V'; }
.visualizer-stage.show-db .bearing-1 .v-mark, .visualizer-stage.show-dt .bearing-1 .v-mark, .visualizer-stage.show-db .bearing-2 .v-mark { transform: rotate(0deg); }
.visualizer-stage.show-df .bearing-1 .v-mark, .visualizer-stage.show-dt .bearing-2 .v-mark, .visualizer-stage.show-df .bearing-2 .v-mark { transform: rotate(180deg); }
.visualizer-explanation { margin-top: 1rem; padding: 1rem; background-color: #fff; border-radius: 5px; border-left: 4px solid var(--cor-destaque); transition: background-color 0.3s; }

/* ANIMAÇÃO DO VISUALIZADOR DE PRÉ-CARGA (CORREÇÃO) */
.visualizer-stage .force-line { position: absolute; width: 150px; height: 3px; background-color: var(--cor-erro); top: 50%; opacity: 0; transition: all 0.4s ease; }
.visualizer-stage .force-line-1 { left: 0; transform-origin: left; }
.visualizer-stage .force-line-2 { right: 0; transform-origin: right; }
.visualizer-stage.show-db .force-line-1 { transform: rotate(-20deg) translateX(20px); opacity: 1; }
.visualizer-stage.show-db .force-line-2 { transform: rotate(20deg) translateX(-20px); opacity: 1; }
.visualizer-stage.show-df .force-line-1 { transform: rotate(20deg) translateX(60px) translateY(20px); opacity: 1; left: 10%; }
.visualizer-stage.show-df .force-line-2 { transform: rotate(-20deg) translateX(-60px) translateY(20px); opacity: 1; right: 10%; }
.visualizer-stage.show-dt .force-line-1 { transform: rotate(-20deg) translateX(20px); opacity: 1; }
.visualizer-stage.show-dt .force-line-2 { transform: rotate(-20deg) translateX(-80px); opacity: 1; }

/* 13. RESPONSIVIDADE */
#mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px; left: 15px;
    z-index: 1011;
    background-color: var(--cor-primaria);
    color: white;
    border: none;
    width: 40px; height: 40px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 992px) {
    #sidebar { transform: translateX(-100%); box-shadow: 5px 0 15px rgba(0,0,0,0.2); }
    #sidebar.open { transform: translateX(0); }
    .content-wrapper { margin-left: 0; width: 100%; }
    header { padding-left: 70px; }
    #mobile-menu-toggle { display: block; }
}

@media (max-width: 768px) {
    /* Ajustes gerais para tablets */
    header h1 { font-size: 2rem; padding: 1rem; }
    main.content { 
        padding: 0 1rem; 
        max-width: 100%;
        overflow-x: hidden;
    }
    .module { 
        padding: 1.5rem 1rem; 
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
    }
    .module h2 { font-size: 1.8rem; line-height: 1.2; }
    .module h3 { font-size: 1.4rem; line-height: 1.3; }
    
    /* Tabelas responsivas */
    .responsive-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1rem -1rem;
        padding: 0 1rem;
    }
    
    /* Simuladores e containers especiais */
    #simulator-container {
        flex-direction: column;
        gap: 15px;
    }
    #assembly-area, #parts-box {
        flex-basis: 100%;
        min-width: 0;
    }
    
    /* Slideshow */
    .slideshow-container {
        margin: 1rem -1rem;
    }
    
    /* Calculadoras e formulários */
    .calculator-form {
        flex-direction: column;
        align-items: stretch;
    }
    .calculator-form .form-group {
        width: 100%;
    }
    
    /* Galeria de falhas */
    .failure-gallery-new {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .failure-card-new { 
        flex-direction: column; 
        text-align: center;
        padding: 1rem;
    }
    .failure-icon { margin: 0 auto 1rem auto; }
    
    /* Comparadores */
    .comparator-columns { 
        flex-direction: column; 
        align-items: stretch;
        gap: 15px;
    }
    .comparator-col { 
        flex-basis: 100%;
        width: 100%;
        min-width: 0;
    }
    
    /* Visualizadores */
    .visualizer-stage {
        max-width: 100%;
        height: 100px;
        margin: 1rem 0;
    }
    .visualizer-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    .visualizer-controls button {
        flex: 1;
        min-width: 0;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

@media (max-width: 600px) {
    /* Ajustes específicos para smartphones */
    header { 
        padding: 0.8rem 70px 0.8rem 1rem;
        min-height: auto;
    }
    header h1 { 
        font-size: 1.6rem; 
        line-height: 1.2;
        margin: 0;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    main.content { 
        padding: 0 0.5rem; 
        margin: 1rem auto;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .module { 
        padding: 1rem 0.75rem; 
        margin: 0;
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .module h2 { 
        font-size: 1.5rem; 
        line-height: 1.3;
        margin-bottom: 1rem;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .module h3 { 
        font-size: 1.2rem; 
        line-height: 1.4;
        margin: 1.5rem 0 0.8rem 0;
        overflow-wrap: break-word;
    }
    
    .module p, .module li {
        font-size: 0.95rem;
        line-height: 1.6;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Listas ordenadas e não ordenadas */
    .module ol, .module ul {
        padding-left: 1.2rem;
        margin: 0.8rem 0;
    }
    
    .module ol li, .module ul li {
        margin-bottom: 0.5rem;
        padding-left: 0.3rem;
    }
    
    /* Tabelas em dispositivos pequenos */
    .responsive-table {
        margin: 1rem -0.75rem;
        padding: 0 0.75rem;
        font-size: 0.85rem;
    }
    
    .data-table th, .data-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    /* Containers especiais */
    .cleaning-simulator, 
    .disassembly-challenge, 
    .brinelling-comparator-container, 
    .preload-visualizer-container, 
    .grease-calculator-container,
    .checkpoint-container {
        margin: 1.5rem -0.75rem;
        padding: 1rem 0.75rem;
        border-radius: 0;
    }
    
    /* Slideshow em tela pequena */
    .slideshow-container {
        margin: 1.5rem -0.75rem;
        border-radius: 0;
    }
    
    .slide-description {
        padding: 1rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Botões de navegação do slide */
    .slide-nav {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* Ferramentas de limpeza */
    .cleaning-workspace {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Formulários */
    .form-certificado, .calculator-form {
        padding: 1rem 0.75rem;
    }
    
    .form-certificado input, 
    .form-certificado select,
    .calculator-form input {
        font-size: 1rem;
        padding: 0.7rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Botões */
    .complete-module-btn,
    .checkpoint-btn,
    .comparator-btn,
    .disassembly-tool-btn {
        width: 100%;
        max-width: 100%;
        padding: 0.8rem;
        font-size: 0.95rem;
        box-sizing: border-box;
    }
    
    /* Modal ajustes */
    .modal-content {
        width: 95%;
        margin: 2.5%;
        padding: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    #glossary-search {
        width: 100%;
        max-width: 100%;
    }
    
    /* Texto longo quebra linha */
    .glossary-term,
    strong,
    em {
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Evitar scroll horizontal */
    body {
        overflow-x: hidden;
    }
    
    .content-wrapper {
        overflow-x: hidden;
    }
}

/* 14. TEMA ESCURO (DARK MODE) */
body.dark-theme {
    --cor-primaria: #0d47a1;
    --cor-secundaria: #1976d2;
    --cor-destaque: #e6b300;
    --cor-fundo: #121212;
    --cor-texto: #e0e0e0;
    --cor-borda: #424242;
    --sombra-suave: 0 4px 12px rgba(0, 0, 0, 0.25);
    --sombra-forte: 0 6px 15px rgba(0, 0, 0, 0.35);
    --cor-erro-light: #4d181d;
    --cor-sucesso-light: #1c3d24;
    --cor-secundaria-light: #103250;
}

body.dark-theme #sidebar, body.dark-theme .module, body.dark-theme .modal-content, body.dark-theme .visualizer-explanation, body.dark-theme #opcoes-quiz button, body.dark-theme .checkpoint-options label, body.dark-theme .comparator-col, body.dark-theme .data-table tbody tr {
    background-color: #1e1e1e;
    border-color: var(--cor-borda);
}

body.dark-theme .grease-calculator-container, body.dark-theme .preload-visualizer-container, body.dark-theme .checkpoint-container, body.dark-theme .cleaning-simulator, body.dark-theme .disassembly-challenge, body.dark-theme .brinelling-comparator-container, body.dark-theme .slide-description, body.dark-theme .data-table tbody tr:nth-of-type(even) {
    background-color: #2a2a2a;
    border-color: var(--cor-borda);
}

body.dark-theme #sidebar ul li a { color: #bbbbbb; }
body.dark-theme #sidebar ul li a:hover { background-color: #2c2c2c; color: var(--cor-destaque); }
body.dark-theme #sidebar ul li a.active { background-color: var(--cor-secundaria); color: #ffffff; }

body.dark-theme .slide-image-container, body.dark-theme #assembly-area, body.dark-theme #parts-box, body.dark-theme .workstation {
    background-color: #2c2c2c;
    border-color: var(--cor-borda);
}

body.dark-theme .failure-card-new, body.dark-theme .achievement-item { background-color: #2a2a2a; }
body.dark-theme .form-certificado input, body.dark-theme .form-certificado select, body.dark-theme .calculator-form input, body.dark-theme #glossary-search, body.dark-theme .investigator-controls input {
    background-color: #333;
    border-color: #555;
    color: var(--cor-texto);
}

body.dark-theme dl dd { border-left-color: #2a2a2a; }
body.dark-theme .checkpoint-options label:hover, body.dark-theme .data-table tbody tr:hover { background-color: #2c2c2c; }
body.dark-theme .visualizer-controls button { background-color: #1e1e1e; color: var(--cor-secundaria); border-color: var(--cor-secundaria); }
body.dark-theme .visualizer-controls button.active { background-color: var(--cor-secundaria); color: #fff; }
body.dark-theme .visualizer-stage .bearing { background-color: #333; }
body.dark-theme .data-table thead th { background-color: var(--cor-primaria); }

body.dark-theme .feedback-box.correct { background-color: var(--cor-sucesso-light); border-left-color: var(--cor-sucesso); color: #90ee90; }
body.dark-theme .feedback-box.incorrect { background-color: var(--cor-erro-light); border-left-color: var(--cor-erro); color: #ff8a8a; }
body.dark-theme .feedback-box.info { background-color: var(--cor-secundaria-light); border-left-color: var(--cor-secundaria); color: #82b1ff; }

/* ========== LOGIN OVERLAY ========== */
.login-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #0f1f3a, #1e4d7a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card h2 {
    color: #0f1f3a;
    margin: 0 0 12px 0;
    font-size: 1.5rem;
}
.login-card p {
    color: #555;
    margin-bottom: 24px;
    font-size: .95rem;
}
.login-card #google-login-btn {
    background: white;
    color: #333;
    border: 2px solid #ddd;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all .3s;
}
.login-card #google-login-btn:hover {
    border-color: #4285f4;
    box-shadow: 0 4px 12px rgba(66,133,244,.2);
}
.login-card #google-login-btn i {
    color: #4285f4;
    font-size: 1.2rem;
}
.login-error {
    color: #dc3545;
    margin-top: 12px;
    font-size: .85rem;
}
