/* Configuração Global */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981; /* Verde tech */
    --border: #334155;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth; /* Rolagem suave ao clicar na sidebar */
    scroll-padding-top: 20px; /* Espaço no topo ao rolar */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Fixa */
.sidebar {
    width: var(--sidebar-width);
    background-color: #0b1120;
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 2.5rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.sidebar-menu h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    text-decoration: none; /* Remove underline dos links */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--bg-card);
    color: var(--accent);
    font-weight: 600;
}

/* Progress Bar Lateral */
.progress-container {
    margin-top: auto;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.progress-header #progress-text {
    font-weight: bold;
    color: var(--accent);
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent);
    width: 0%;
    transition: width 0.4s ease;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 3rem;
    max-width: 1200px;
}

.top-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.top-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.top-header p {
    color: var(--text-muted);
}

/* Accordions (Details/Summary) */
details {
    margin-bottom: 1.5rem;
}

details > summary {
    list-style: none;
    cursor: pointer;
}

details > summary::-webkit-details-marker {
    display: none;
}

.topic-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.topic-card > summary {
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    background-color: var(--bg-card-hover);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topic-card > summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: transform 0.3s;
    font-size: 0.9rem;
}

.topic-card[open] > summary::after {
    transform: rotate(180deg);
}

.card-body {
    padding: 1.5rem;
}

/* Listas de Conteúdo */
ol {
    padding-left: 1.5rem;
    margin-bottom: 2rem;
}

ol > li {
    margin-bottom: 1.25rem;
    font-weight: 500;
    color: var(--text-main);
}

ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    font-weight: 400;
    color: var(--text-muted);
    list-style-type: circle;
}

ul li {
    margin-bottom: 0.4rem;
}

ul li em {
    color: #60a5fa; /* Azul para extras */
    font-style: normal;
}

/* Cartão do Desafio */
.challenge-card {
    background-color: rgba(16, 185, 129, 0.03);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.5rem;
    margin-top: 2rem;
}

.challenge-card > summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--accent);
    background-color: rgba(16, 185, 129, 0.08);
}

.challenge-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* CORREÇÃO DOS CHECKBOXES E ALINHAMENTO */
.task {
    display: flex;
    align-items: flex-start; /* Alinha o checkbox com a PRIMEIRA linha de texto */
    gap: 1rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.01);
    transition: background 0.2s;
    border: 1px solid transparent;
}

.task:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Estilo do Input Checkbox */
.task input[type="checkbox"] {
    appearance: none; /* Remove o estilo padrão do navegador */
    -webkit-appearance: none;
    
    /* TAMANHO FIXO - Resolve o problema da imagem */
    width: 1.3rem;
    height: 1.3rem;
    flex-shrink: 0; /* Impede que o checkbox encolha */
    
    margin-top: 0.2rem; /* Pequeno ajuste fino para alinhar perfeitamente com o texto */
    
    border: 2px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-dark);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.task input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* O ícone de 'check' customizado */
.task input[type="checkbox"]:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #fff;
    font-size: 0.8rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Texto da tarefa */
.task span {
    color: var(--text-main);
    font-size: 0.95rem;
    flex: 1; /* Ocupa o restante do espaço */
    transition: color 0.2s ease;
}

.task input:checked + span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Blocos de Código */
.code-block {
    background-color: #0b1120;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    color: #a5b4fc;
    border-left: 3px solid var(--accent);
    margin: 0.5rem 0 0.5rem 2.8rem; /* Alinhado com o texto da task */
    white-space: pre-wrap;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

/* Responsividade Básica */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
    .main-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
    }
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
}
