/* --- Reset & Base --- */
:root {
    --primary-blue: #007bff;
    --dark-blue: #0056b3;
    --light-blue: #e7f3ff;
    --text-dark: #343a40;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --white: #ffffff;
    --light-gray-bg: #f8f9fa;
    --success-green: #28a745; /* Green for completion */
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: #f1f3f5; /* Light background for the page */
    color: var(--text-dark);
    line-height: 1.6;
    /* Flexbox setup moved here for better control if needed */
    /* display: flex; */
    /* flex-direction: column; */ /* If header/footer are outside main */
}

a {
    text-decoration: none;
    color: var(--primary-blue);
}
a:hover {
    color: var(--dark-blue);
}






/* === ESTILOS ADICIONAIS PARA QUIZ === */

.orwell-quiz-container {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    background-color: var(--light-gray-bg);
}

.quiz-question {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-color);
}
.quiz-question:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.quiz-question h4 { /* Título/Texto da Pergunta */
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.5;
}
/* Permite HTML básico na pergunta */
.quiz-question h4 strong, .quiz-question h4 b { font-weight: bold; }
.quiz-question h4 em, .quiz-question h4 i { font-style: italic; }
/* Estilos para vídeo embedado na pergunta */
.quiz-question h4 iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border: none;
}

.quiz-options label {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--white);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.quiz-options label:hover {
    background-color: var(--light-blue);
    border-color: var(--primary-blue);
}
.quiz-options input[type="radio"],
.quiz-options input[type="checkbox"] { /* Checkbox pode ser futuro */
    margin-right: 0.75rem;
    vertical-align: middle;
}
.quiz-options span { /* Texto da opção */
    vertical-align: middle;
    color: var(--text-dark);
}

.quiz-options textarea {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    min-height: 100px;
    resize: vertical;
}
.quiz-options .char-counter {
    font-size: 0.8em;
    color: #777;
    text-align: right;
    margin-top: 0.25rem;
}

.quiz-submit-button {
    background-color: var(--success-green);
    color: var(--white);
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 1.05rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    margin-top: 1.5rem;
    display: inline-block;
}
.quiz-submit-button:hover:not(:disabled) {
    background-color: #218838; /* Darker green */
}
.quiz-submit-button:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-results {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.quiz-results h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--dark-blue);
    border: none;
    padding: 0;
}
.quiz-feedback-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 5px;
    border-left-width: 5px;
    border-left-style: solid;
}
.quiz-feedback-item.correct {
    background-color: #e9f7ef; /* Light green */
    border-left-color: var(--success-green);
}
.quiz-feedback-item.incorrect {
    background-color: #f8d7da; /* Light red */
    border-left-color: #dc3545; /* Red */
}
.quiz-feedback-item h4 { /* Pergunta dentro do feedback */
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}
.quiz-feedback-item p {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.quiz-feedback-item .user-answer {
    font-style: italic;
    color: #555;
}
.quiz-feedback-item .correct-answer {
    font-weight: bold;
    color: var(--success-green);
}






/* --- Barra de Progresso Geral --- */
.course-progress-bar-container {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.progress-bar-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.progress-bar-track {
    background-color: #e9ecef;
    border-radius: 5px;
    height: 10px; /* Um pouco mais grossa */
    overflow: hidden;
}
.progress-bar-fill {
    background-color: var(--success-green);
    height: 100%;
    width: 0%;
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

/* --- Indicador de Status na Sidebar --- */
.step-link {
    padding-left: 1rem; /* Reduzido para dar espaço ao ícone de status */
    position: relative;
}
.step-status-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--text-light); /* Cinza por padrão */
    margin-right: 0.5rem;
    font-size: 0.9em;
    line-height: 1; /* Para alinhar melhor o checkmark */
}
.step-link.step-completed .step-status-icon {
    color: var(--success-green); /* Verde quando completo */
    /* O JS mudará o conteúdo para '✔' */
}
.step-link.active-step {
     padding-left: calc(1rem - 4px); /* Leva em conta o status icon e a borda ativa */
}













/* --- Course Layout --- */
.course-header {
    background-color: var(--white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center; /* Placeholder */
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    /* Assuming header takes full width */
}

.course-main {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for responsiveness */
    background-color: var(--white);
    max-width: 1400px; /* Limit overall width */
    margin: 1rem auto; /* Center container */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    /* Ensure it takes height */
    min-height: calc(100vh - 80px - 4rem); /* Adjust based on header/footer height + body padding/margin */
}

/* --- Sidebar --- */
.course-sidebar {
    flex: 0 0 320px; /* Fixed width sidebar on larger screens */
    border-right: 1px solid var(--border-color);
    background-color: var(--white);
    height: calc(100vh - 80px - 2rem); /* Adjust based on header height and body margin/padding */
    overflow-y: auto;
    padding-bottom: 2rem;
}

.sidebar-header {
	display: flex; /* Alinha título e botão */
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.course-structure {
    list-style: none;
}

.course-section {
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--light-gray-bg);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.section-header:hover {
    background-color: #e9ecef;
}
.section-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
}
.section-toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: var(--text-light);
    /* Default state (collapsed) - pointing right */
}
.section-open .section-toggle-icon {
    transform: rotate(90deg); /* Point down when open */
}

.lesson-list {
    list-style: none;
    max-height: 0; /* Start collapsed */
    overflow: hidden;
    transition: max-height 0.4s ease-out; /* Transition for smooth open/close */
}
.lessons-visible {
    max-height: 1000px; /* Large enough height to show all items */
    transition: max-height 0.5s ease-in;
}

.course-step {
    border-top: 1px solid #f1f3f5; /* Lighter border between steps */
}
.course-step:first-child {
    border-top: none; /* No top border for the first item in a list */
}

.step-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem 0.8rem 2rem; /* Indent step links */
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, padding-left 0.2s ease;
    cursor: pointer;
    position: relative; /* For checkmark positioning and active border */
    border-left: 4px solid transparent; /* Placeholder for active state */
}

.step-link:hover {
    background-color: var(--light-blue);
    color: var(--dark-blue);
}

.step-link.active-step {
    background-color: var(--light-blue);
    color: var(--dark-blue);
    font-weight: 700;
    border-left: 4px solid var(--primary-blue);
     padding-left: calc(2rem - 4px); /* Adjust padding for border */
}

.step-icon {
    margin-right: 0.8rem;
    font-size: 1rem;
    width: 18px; /* Align icons */
    text-align: center;
    color: var(--text-light);
}
.active-step .step-icon {
    color: var(--primary-blue);
}

.step-title {
    flex-grow: 1;
}

/* --- Progress Checkmark --- */
.step-link .checkmark {
    font-size: 0.9rem;
    color: var(--success-green);
    margin-left: auto; /* Push checkmark to the right */
    padding-left: 0.5rem;
    display: none; /* Hide by default */
    font-weight: bold;
}
.step-link.step-completed .checkmark {
    display: inline; /* Show when completed */
}
 /* Optional: Style completed link differently */
 .step-link.step-completed {
    /* color: var(--text-light); */ /* Example: Grey out completed steps */
 }
  .step-link.step-completed .step-title {
    /* text-decoration: line-through; */ /* Example */
 }


/* --- Content Area --- */
.course-content-area {
    flex: 1; /* Takes remaining space */
    padding: 2rem 2.5rem;
    background-color: var(--white);
     min-height: calc(100vh - 80px - 2rem); /* Match sidebar height roughly */
     display: flex;
     flex-direction: column;
     position: relative; /* Needed for absolute spinner positioning */
}

#lesson-content {
    flex-grow: 1; /* Allows content to fill space */
    margin-bottom: 2rem; /* Space before nav buttons */
}

#lesson-content h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
 #lesson-content h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-top: 2rem;
    margin-bottom: 1rem;
}
 #lesson-content p {
     margin-bottom: 1rem;
     color: var(--text-dark);
     font-size: 1.05rem;
 }
 #lesson-content ul {
     list-style: disc; /* Use standard bullets for content */
     margin-left: 1.5rem;
     margin-bottom: 1.5rem;
     padding-left: 0.5rem;
 }
  #lesson-content ol {
     list-style: decimal;
     margin-left: 1.5rem;
     margin-bottom: 1.5rem;
     padding-left: 0.5rem;
 }
 #lesson-content li {
      margin-bottom: 0.5rem;
      padding-left: 0; /* Reset */
      position: static; /* Reset */
 }
 #lesson-content li::before {
     content: none; /* Remove custom bullet */
 }

/* Video Styling */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    margin-bottom: 1.5rem;
     border-radius: 8px;
}
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Quiz Placeholder Styling */
.quiz-placeholder {
    border: 2px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    background-color: var(--light-gray-bg);
    border-radius: 8px;
    margin-top: 2rem;
}
.quiz-placeholder p {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 1rem;
}
.quiz-placeholder button {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
     transition: background-color 0.2s ease;
}
 .quiz-placeholder button:hover {
     background-color: var(--dark-blue);
 }


/* Content Navigation */
.content-nav {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Pushes nav to bottom if content is short */
}

.content-nav button {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.content-nav button:hover:not(:disabled) {
    background-color: var(--dark-blue);
}
.content-nav button:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}


/* --- Loading Spinner --- */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Estilos para o spinner - você pode usar isso ou os estilos inline no JS */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-blue); /* Cor primária azul */
    position: absolute; /* Posicionado relativo a .course-content-area */
    top: 40%;
    left: 50%;
    transform: translateX(-50%); /* Centraliza horizontalmente */
    animation: spin 1s linear infinite;
    z-index: 10; /* Garante que fique visível */
}


/* --- Footer Placeholder --- */
.course-footer {
    background-color: var(--text-dark);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: 1rem; /* Space above footer if main content isn't full height */
     /* Assuming footer takes full width */
}

/* --- Responsiveness --- */
@media (max-width: 992px) { /* Tablet breakpoint */
     .course-sidebar {
        flex: 0 0 280px; /* Slightly smaller sidebar */
        height: calc(100vh - 70px - 2rem); /* Adjust height calc */
    }
     .course-content-area {
        padding: 1.5rem 2rem;
        min-height: calc(100vh - 70px - 2rem); /* Adjust height calc */
    }
     #lesson-content h2 { font-size: 1.6rem; }
     #lesson-content h3 { font-size: 1.2rem; }
     #lesson-content p, #lesson-content li { font-size: 1rem; }
     .course-header { padding: 0.9rem 1.5rem; }
}

 @media (max-width: 768px) { /* Mobile breakpoint */
    .course-main {
        flex-direction: column;
        margin: 0; /* Remove side margins */
         box-shadow: none;
         min-height: none; /* Reset min-height */
    }
    .course-sidebar {
        flex-basis: auto; /* Let it take natural height */
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto; /* Auto height */
        max-height: 50vh; /* Limit height and make scrollable if needed */
        overflow-y: auto;
    }
    .course-content-area {
         min-height: auto; /* Remove fixed min-height */
         padding: 1.5rem; /* Reduce padding */
    }
    .sidebar-header { padding: 1rem 1.5rem; font-size: 1.1rem;}
    .orwell-section-header { padding: 0.7rem 1.5rem;}
    .section-title { font-size: 0.95rem;}
    .step-link { padding: 0.7rem 1.5rem 0.7rem 2rem; font-size: 0.9rem;}
    .step-link.active-step { padding-left: calc(2rem - 4px); }
     #lesson-content h2 { font-size: 1.5rem; margin-bottom: 1rem;}
     #lesson-content h3 { font-size: 1.1rem; margin-top: 1.5rem;}
     #lesson-content p, #lesson-content li { font-size: 0.95rem; }
     .content-nav { padding-top: 1rem; }
     .content-nav button { font-size: 0.9rem; padding: 0.5rem 1rem;}
     .course-header { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
     .loading-spinner { top: 30%; } /* Adjust spinner position for mobile */
}




.mobile-content-toggle-button {
    display: none; /* Escondido por padrão em telas grandes */
    background: none;
    border: none;
    font-size: 1.5rem; /* Tamanho da seta */
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.2rem 0.5rem; /* Pequeno padding para área de clique */
}

.mobile-content-toggle-button:hover {
    color: var(--primary-blue);
}

/* Media Query para Mobile (Ex: <= 768px) */
@media (max-width: 768px) {

    .mobile-content-toggle-button {
        display: inline-block; /* Mostra o botão no mobile */
    }

    /* Mantém a sidebar visível, mas controla o conteúdo interno */
    .course-sidebar {
        flex-basis: auto; /* Altura automática no mobile */
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto; /* Reset */
        max-height: none; /* Reset */
        overflow-y: visible; /* Reset - o container interno controlará o overflow/altura */
        padding-bottom: 0; /* Remove padding inferior da sidebar */
    }

    /* Container do conteúdo da sidebar */
    .orwell-full-container {
        max-height: 1000px; /* Altura inicial suficiente para mostrar conteúdo */
        overflow: hidden;
        transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out; /* Animação suave */
        /* Adiciona padding que antes estava na sidebar */
        padding: 0 0 2rem 0; /* Ajuste padding inferior se necessário */
         border-top: 1px solid var(--border-color); /* Linha separadora */
    }

    /* Estado COLAPSADO (quando body OU sidebar tiver a classe - escolha um) */
    /* Usar uma classe no container pai é mais seguro */
    aside.course-sidebar.content-collapsed .orwell-full-container {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-top: none; /* Esconde borda quando fechado */
    }

    /* Gira a seta quando colapsado */
    aside.course-sidebar.content-collapsed .mobile-content-toggle-button {
         transform: rotate(-90deg); /* Aponta para a direita */
    }
    .mobile-content-toggle-button { /* Garante transição suave da seta */
        transition: transform 0.3s ease-in-out;
    }

     /* Ajustes menores para layout mobile se necessário */
     .sidebar-header {
        padding: 1rem 1.5rem; /* Padding padrão mobile */
     }
     .sidebar-header span:first-child { /* Título "Conteúdo do Curso" */
        font-size: 1.1rem; /* Um pouco maior no mobile header */
     }
     .course-progress-bar-container {
         padding-top: 1rem; /* Espaço acima da barra */
         padding-left: 1.5rem;
         padding-right: 1.5rem;
     }
     .course-structure {
         padding-top: 1rem; /* Espaço acima das seções */
     }
     .section-header {
         /* Estilos do acordeão interno permanecem */
     }
     .lesson-list {
          /* Estilos do acordeão interno permanecem */
     }

}

/* Reset para Telas Maiores (garante que botão não apareça e container esteja visível) */
@media (min-width: 769px) {
    .mobile-content-toggle-button {
        display: none; /* Esconde o botão */
    }
    /* Garante que o container esteja sempre visível e sem limite de altura */
    .orwell-full-container {
        max-height: none;
        overflow: visible;
        padding: 0; /* Reset padding adicionado para mobile */
        border-top: none;
    }
     /* Garante que a classe de colapso não tenha efeito */
     aside.course-sidebar.content-collapsed .orwell-full-container {
         max-height: none;
     }
}