/* ==========================================================================
   1. CONFIGURAÇÕES GLOBAIS E VARIÁVEIS DE COR
   ========================================================================== */
:root {
    --cor-fundo: #1f1f2e;
    --cor-fundo-secundario: #2a2a3a;
    --cor-texto-principal: #f0f0f0;
    --cor-texto-secundario: #cccccc;
    --cor-destaque-vermelho: #ff2222;
    --cor-destaque-vermelho-rgb: 255, 34, 34; /* Versão RGB para usar com transparência */
    --cor-vermelho-interativo: #ff5555;
    --cor-borda: #444;
    --cor-roxo: #6f42c1;
    --cor-verde: #28a745;
    --cor-amarelo: #ffc107;
}

/* Estilos Gerais */
html, body { height: 100%; margin: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto-principal);
    text-align: center;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================================================
   2. COMPONENTES DE LAYOUT PRINCIPAL
   ========================================================================== */
header { width: 100%; background: linear-gradient(to bottom, #3a3f4c, var(--cor-fundo-secundario)); padding: 1.5rem 0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); border-bottom: 1px solid var(--cor-borda); position: relative; text-align: center; }
header h1 { margin: 0; color: var(--cor-texto-principal); font-size: 2.5rem; text-shadow: 0 0 10px var(--cor-destaque-vermelho); }
main { padding: 40px 20px; flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; }
main.main-interactive { flex-direction: row; justify-content: center; align-items: flex-start; }
.back-button { color: var(--cor-texto-principal); text-decoration: none; font-size: 1.2rem; position: absolute; top: 50%; left: 1.5rem; transform: translateY(-50%); transition: color 0.3s; }
.back-button:hover { color: var(--cor-vermelho-interativo); }
footer { padding: 20px; color: #888; border-top: 1px solid var(--cor-borda); width: 100%; box-sizing: border-box; }

/* ==========================================================================
   3. PÁGINA PRINCIPAL (index.html)
   ========================================================================== */
.hero-section { max-width: 900px; margin: 0 auto 40px auto; justify-content: flex-start; }
.hero-section h2 { font-size: 2.2rem; color: var(--cor-texto-principal); margin-bottom: 15px; }
.hero-section p { font-size: 1.2rem; color: var(--cor-texto-secundario); line-height: 1.6; }
.systems-grid { display: grid; gap: 30px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); width: 100%; max-width: 1400px; padding: 0 20px; box-sizing: border-box; }
.system-card { background-color: rgba(42, 42, 58, 0.7); border: 2px solid var(--cor-borda); border-radius: 12px; padding: 25px; transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s; text-decoration: none; color: var(--cor-texto-principal); display: flex; flex-direction: column; align-items: center; }
.system-card:not(.disabled):hover { transform: translateY(-10px); box-shadow: 0 10px 20px rgba(255, 85, 85, 0.3); border-color: var(--cor-vermelho-interativo); }
.card-icon { background-color: rgba(255, 255, 255, 0.05); border-radius: 50%; width: 100px; height: 100px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; overflow: hidden; }
.card-icon img, .card-icon svg { width: 100%; height: 100%; object-fit: cover; }
.system-card h3 { margin-top: 0; color: var(--cor-vermelho-interativo); font-size: 1.5rem; }
.system-card p { flex-grow: 1; }
.system-card .cta-button { background-color: var(--cor-roxo); color: white; padding: 12px 25px; font-size: 1rem; font-weight: bold; text-decoration: none; border-radius: 8px; transition: background-color 0.3s; display: inline-block; margin-top: auto; }
.system-card:not(.disabled):hover .cta-button { background-color: #5a349c; }
.system-card.disabled { opacity: 0.5; cursor: not-allowed; }
.system-card.disabled .cta-button { background-color: #555; cursor: not-allowed; }

/* ==========================================================================
   4. PÁGINAS DE SUBMENU
   ========================================================================== */
.section-title { font-size: 2.2rem; color: var(--cor-texto-principal); margin-bottom: 40px; padding-bottom: 10px; border-bottom: 2px solid var(--cor-vermelho-interativo); display: inline-block; }
.grid-container { display: grid; gap: 25px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 40px; max-width: 1400px; width: 100%; margin-left: auto; margin-right: auto; padding: 0 20px; box-sizing: border-box; }
.view-card { background-color: rgba(42, 42, 58, 0.7); border: 2px solid var(--cor-borda); border-radius: 12px; padding: 20px; min-height: 180px; transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s; text-decoration: none; color: var(--cor-texto-principal); display: flex; flex-direction: column; align-items: center; box-sizing: border-box; }
.view-card:not(.disabled):hover { transform: translateY(-10px); box-shadow: 0 10px 20px rgba(255, 85, 85, 0.3); border-color: var(--cor-vermelho-interativo); }
.view-card h3 { margin-top: 0; margin-bottom: 15px; color: var(--cor-vermelho-interativo); font-size: 1.3rem; height: 50px; display: flex; align-items: center; justify-content: center; }
.view-card p { flex-grow: 1; color: var(--cor-texto-secundario); }
.view-card .cta-button { background-color: var(--cor-roxo); color: white; padding: 12px 25px; font-size: 1rem; font-weight: bold; text-decoration: none; border-radius: 8px; transition: background-color 0.3s; display: inline-block; margin-top: auto; }
.view-card:not(.disabled):hover .cta-button { background-color: #5a349c; }
.view-card.disabled { opacity: 0.5; cursor: not-allowed; }
.view-card.disabled .cta-button { background-color: #555; cursor: not-allowed; }

/* ==========================================================================
   5. FERRAMENTA INTERATIVA (ESTUDO)
   ========================================================================== */
.container-principal { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: flex-start; gap: 30px; width: 100%; max-width: 1280px; }
.image-wrapper { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.interactive-area { position: relative; padding: clamp(15px, 5vw, 60px); border-radius: 12px; background-color: rgba(0, 0, 0, 0.2); border: 3px solid var(--cor-borda); box-shadow: 0 0 20px rgba(255, 50, 50, 0.5); width: 100%; box-sizing: border-box; }
.image-container { position: relative; overflow: hidden; border-radius: 6px; cursor: crosshair; }
.image-container img { display: block; width: 100%; height: auto; }
#coordenadas-display { background-color: #111; border: 1px solid var(--cor-borda); padding: 10px; margin-top: 15px; border-radius: 6px; font-family: 'Courier New', Courier, monospace; text-align: center; user-select: text; }
#coordenadas-display span { color: #00ff00; font-weight: bold; }
.marker { position: absolute; opacity: 0; transition: opacity 0.3s ease-in-out; pointer-events: none; }
.marker.highlight, .marker.simulado-active, .marker.review-active { opacity: 1; z-index: 10; }
.marker-dot { position: absolute; width: 5px; height: 5px; border-radius: 50%; border: 2px solid white; transform: translate(-50%, -50%); transition: background-color 0.3s, border-color 0.3s; }
.marker-shape { border-radius: 50%; border: 3px dashed var(--cor-vermelho-interativo); background-color: rgba(var(--cor-destaque-vermelho-rgb), 0.3); box-shadow: 0 0 10px rgba(255, 85, 85, 0.5); transform: translate(-50%, -50%); transition: background-color 0.3s, border-color 0.3s; }
.marker-shape:hover { background-color: rgba(var(--cor-destaque-vermelho-rgb), 0.4); border-color: var(--cor-amarelo); }
.marker-line { height: 3px; background-color: var(--cor-vermelho-interativo); border-radius: 3px; box-shadow: 0 0 8px rgba(255, 85, 85, 0.7); transform-origin: center; transition: background-color 0.3s, box-shadow 0.3s; }
.marker-line::before, .marker-line::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%; border: 2px solid white; background-color: var(--cor-vermelho-interativo); top: 50%; transition: background-color 0.3s, border-color 0.3s; }
.marker-line::before { left: 0; transform: translate(-50%, -50%); }
.marker-line::after { right: 0; transform: translate(50%, -50%); }
.marker-line:hover { background-color: var(--cor-amarelo); box-shadow: 0 0 12px rgba(255, 193, 7, 0.9); }
.marker-line:hover::before, .marker-line:hover::after { background-color: var(--cor-amarelo); }
.marker-label { position: absolute; color: white; background-color: rgba(0, 0, 0, 0.7); border-radius: 5px; font-weight: bold; white-space: nowrap; cursor: move; pointer-events: all; z-index: 11; border: 2px solid white; transition: background-color 0.3s, border-color 0.3s, opacity 0.3s; transform: translate(15px, -50%); font-size: clamp(12px, 0.8vw, 16px); padding: clamp(4px, 0.4vw, 6px) clamp(8px, 0.6vw, 12px); }
.marker-label.dragging { box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); z-index: 12; transition: none; }
.line-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.line-container line { stroke-width: 2px; stroke: white; transition: stroke 0.3s, opacity 0.3s; opacity: 0; }
.controles-container { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; background-color: rgba(40, 40, 50, 0.8); padding: 25px; border-radius: 8px; border: 1px solid var(--cor-borda); box-sizing: border-box; }
.controles-container h2 { color: var(--cor-texto-principal); text-shadow: 0 0 8px var(--cor-destaque-vermelho); margin: 0 0 15px 0; padding-bottom: 10px; font-size: 1.4rem; border-bottom: 2px solid var(--cor-vermelho-interativo); text-align: center; }
#study-controls .checklist { list-style: none; padding: 0; margin: 0; text-align: left; }
#study-controls .checklist li a { text-decoration: none; color: var(--cor-vermelho-interativo); font-size: 18px; display: block; padding: 12px 15px; border-radius: 5px; transition: background-color 0.3s, color 0.3s; margin-bottom: 5px; border: 1px solid transparent; }
#study-controls .checklist li a:hover { background-color: var(--cor-vermelho-interativo); color: white; }
#study-controls .checklist li a.active { background-color: #d43d3d; color: white; border-color: var(--cor-vermelho-interativo); }
#resetBtn { background-color: transparent; color: #ff7777; font-weight: bold; padding: 10px; font-size: 16px; border: 2px solid #ff7777; cursor: pointer; border-radius: 5px; width: 100%; transition: background-color 0.3s, color 0.3s; margin-top: 10px; }
#resetBtn:hover { background-color: var(--cor-vermelho-interativo); color: white; }
#legend-controls .legenda-item { display: flex; align-items: center; margin-bottom: 10px; }
#legend-controls .cor-legenda { width: 20px; height: 20px; border-radius: 50%; margin-right: 10px; border: 1px solid #fff; }
.cor-vermelha { background-color: rgba(255, 0, 0, 0.85); }
.cor-amarela { background-color: rgba(255, 255, 0, 0.85); }
.cor-verde { background-color: rgba(0, 255, 0, 0.85); }
.marker.muita-dificuldade .marker-dot, .marker.muita-dificuldade.marker-line, .marker.muita-dificuldade.marker-line::before, .marker.muita-dificuldade.marker-line::after { background-color: rgba(255,0,0,0.85); border-color: rgba(255,0,0,0.85); }
.marker.muita-dificuldade.marker-shape { border-color: rgba(255,0,0,0.85); background-color: rgba(255,0,0,0.3); }
.line-container line.muita-dificuldade { stroke: rgba(255,0,0,0.85); }
.marker.muita-dificuldade .marker-label { border-color: rgba(255, 0, 0, 0.85); }
.marker.razoavel .marker-dot, .marker.razoavel.marker-line, .marker.razoavel.marker-line::before, .marker.razoavel.marker-line::after { background-color: rgba(255,255,0,0.85); border-color: rgba(255,255,0,0.85); }
.marker.razoavel.marker-shape { border-color: rgba(255,255,0,0.85); background-color: rgba(255,255,0,0.3); }
.line-container line.razoavel { stroke: rgba(255,255,0,0.85); }
.marker.razoavel .marker-label { border-color: rgba(255, 255, 0, 0.85); }
.marker.facil .marker-dot, .marker.facil.marker-line, .marker.facil.marker-line::before, .marker.facil.marker-line::after { background-color: rgba(0,255,0,0.85); border-color: rgba(0,255,0,0.85); }
.marker.facil.marker-shape { border-color: rgba(0,255,0,0.85); background-color: rgba(0,255,0,0.3); }
.line-container line.facil { stroke: rgba(0,255,0,0.85); }
.marker.facil .marker-label { border-color: rgba(0, 255, 0, 0.85); }
.botoes-modo { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.btn-modo { flex-grow: 1; padding: 12px; font-size: 16px; border: none; cursor: pointer; border-radius: 5px; transition: background-color 0.3s; color: white; font-weight: bold; text-decoration: none; line-height: normal; display: flex; align-items: center; justify-content: center; }
#simuladoBtn { background-color: var(--cor-verde); }
#simuladoBtn:hover { background-color: #218838; }
#flashcardBtn { background-color: var(--cor-roxo); }
#flashcardBtn:hover { background-color: #5a349c; }
#checkBtn { background-color: var(--cor-verde); }
#checkBtn:hover { background-color: #218838; }
#showAnswersBtn { background-color: var(--cor-amarelo); color: #212529; }
#showAnswersBtn:hover { background-color: #d39e00; }
.flashcard-input { position: absolute; z-index: 11; background-color: #333; color: white; border: 2px solid #888; border-radius: 5px; font-weight: bold; text-align: center; box-sizing: border-box; pointer-events: all; font-size: clamp(13px, 0.85vw, 17px); }
.flashcard-input.correct { border-color: var(--cor-verde); background-color: #2f4e37; }
.flashcard-input.incorrect { border-color: #dc3545; background-color: #592d33; }
.revealed-answer { position: absolute; z-index: 12; background-color: var(--cor-amarelo); color: #212529; border-radius: 5px; font-weight: bold; font-style: italic; font-size: clamp(12px, 0.8vw, 16px); padding: clamp(4px, 0.4vw, 6px) clamp(8px, 0.6vw, 12px); }
.hidden { display: none !important; }

/* ==========================================================================
   5.1. ESTILOS DO SIMULADO
   ========================================================================== */
#simulado-controls { text-align: center; }
#timer-display { font-size: 2.5rem; color: var(--cor-vermelho-interativo); margin-bottom: 15px; font-weight: bold; text-shadow: 0 0 10px var(--cor-vermelho-interativo); }
#simulado-input { width: 100%; padding: 10px; font-size: 1rem; background-color: #333; color: white; border: 2px solid #888; border-radius: 5px; text-align: center; margin-bottom: 15px; box-sizing: border-box; }
#simulado-input:focus { border-color: var(--cor-vermelho-interativo); outline: none; }
#next-structure-btn { background-color: var(--cor-verde); }
#next-structure-btn:hover { background-color: #218838; }
#exit-simulado-btn { background-color: #6c757d; }
#exit-simulado-btn:hover { background-color: #5a6268; }
.marker.simulado-active .marker-dot { width: 10px; height: 10px; background-color: #dc3545; border: 3px solid white; box-shadow: 0 0 15px 10px rgba(220, 53, 69, 0.8); }
.marker.simulado-active.marker-shape { border-color: #dc3545; background-color: rgba(220, 53, 69, 0.7) !important; box-shadow: 0 0 15px 10px rgba(220, 53, 69, 0.8); }
.marker.simulado-active.marker-line { background-color: #dc3545 !important; box-shadow: 0 0 15px 10px rgba(220, 53, 69, 0.8); }
.marker.simulado-active.marker-line::before, .marker.simulado-active.marker-line::after { background-color: #dc3545; border-color: white; }
#performance-emoji { font-size: 5.5rem; margin-bottom: 10px; line-height: 1; }
#performance-phrase { font-size: 1.1rem; font-style: italic; color: #ccc; margin-top: 0; margin-bottom: 20px; }
.results-lists { text-align: left; }
.results-lists ul { list-style: none; padding-left: 0; }
.results-lists li:hover { color: #ffc107 !important; cursor: pointer; }
.results-lists .correct-answer-item { color: var(--cor-verde); }
.results-lists .incorrect-answer-item { color: var(--cor-destaque-vermelho); }
.marker.review-correct .marker-dot, .marker.review-incorrect .marker-dot { width: 10px; height: 10px; border: 3px solid white !important; }
.marker.review-correct .marker-dot, .marker.review-correct.marker-line::before, .marker.review-correct.marker-line::after { background-color: var(--cor-verde) !important; }
.marker.review-correct.marker-line { background-color: var(--cor-verde) !important; border-color: var(--cor-verde) !important; }
.marker.review-correct.marker-shape { border-color: var(--cor-verde) !important; background-color: rgba(40, 167, 69, 0.6) !important; }
.marker.review-incorrect .marker-dot, .marker.review-incorrect.marker-line::before, .marker.review-incorrect.marker-line::after { background-color: #dc3545 !important; }
.marker.review-incorrect.marker-line { background-color: #dc3545 !important; border-color: #dc3545 !important; }
.marker.review-incorrect.marker-shape { border-color: #dc3545 !important; background-color: rgba(220, 53, 69, 0.6) !important; }

/* ==========================================================================
   6. RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 900px) {
    main.main-interactive {
        padding: 20px 10px;
    }
    .container-principal {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .image-wrapper {
        flex-basis: 60%;
    }
    .controles-container {
        flex-basis: 35%;
        width: auto;
    }
}

/* ==========================================================================
   7. MODAL DE AVISO
   ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.75); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease-in-out; }
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: all; }
.modal-content { background-color: var(--cor-fundo-secundario); padding: 30px 40px; border-radius: 12px; border: 2px solid var(--cor-vermelho-interativo); text-align: center; max-width: 400px; color: var(--cor-texto-principal); font-size: 1.1rem; line-height: 1.6; animation: glow-pulse 1s infinite alternate; }
.modal-icon { width: 60px; height: 60px; fill: #FFD700; margin-bottom: 20px; }
.modal-content p { margin-top: 0; margin-bottom: 25px; }
.modal-content button { background-color: var(--cor-roxo); width: 100%; }
.modal-content button:hover { background-color: #5a349c; }

/* ==========================================================================
   8. ANIMAÇÕES
   ========================================================================== */
@keyframes glow-pulse { 0% { box-shadow: 0 0 10px var(--cor-vermelho-interativo); } 100% { box-shadow: 0 0 40px var(--cor-vermelho-interativo), 0 0 70px var(--cor-amarelo); } }

/* ==========================================================================
   9. PAINEL DE INFORMAÇÕES
   ========================================================================== */
#info-panel { text-align: left; transition: transform 0.3s ease-out, opacity 0.3s ease-out; }
#info-panel.hidden { display: none; }
#info-panel h3 { margin: 0 0 10px 0; color: var(--cor-amarelo); font-size: 1.2rem; }
#info-panel p { margin: 0; color: var(--cor-texto-secundario); line-height: 1.6; }