* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores do RegistreTudo baseadas no tema (Light) */
    --primary: hsl(221, 83%, 53%);
    --primary-dark: hsl(221, 83%, 45%);
    --primary-light: hsl(221, 83%, 60%);
    --primary-rgb: 59, 130, 246; /* RGB do primary para usar com rgba */
    --secondary: hsl(210, 1%, 38%);
    --background: hsl(221, 2%, 99%);
    --foreground: hsl(221, 5%, 15%);
    --muted: hsl(221, 10%, 98%);
    --muted-foreground: hsl(223, 5%, 30%);
    --border: hsl(221, 10%, 80%);
    --required: hsl(26, 98%, 54%);
    --destructive: hsl(0, 74%, 50%);
    --success: hsl(122, 39%, 49%);
    --warning: hsl(23, 86%, 61%);
    --info: hsl(212, 95%, 68%);
    --container-bg: white;
    --pre-bg: hsl(221, 15%, 8%);
    --pre-color: hsl(221, 5%, 95%);
}

.dark {
    /* Cores do RegistreTudo baseadas no tema (Dark) */
    --primary: hsl(221, 83%, 53%);
    --primary-dark: hsl(221, 83%, 60%);
    --primary-light: hsl(221, 83%, 45%);
    --secondary: hsl(221, 8%, 25%);
    --background: hsl(221, 8%, 10%);
    --foreground: hsl(221, 5%, 90%);
    --muted: hsl(221, 8%, 20%);
    --muted-foreground: hsl(225, 15%, 90%);
    --border: hsl(221, 10%, 35%);
    --required: hsl(26, 98%, 54%);
    --destructive: hsl(0, 74%, 50%);
    --success: hsl(122, 39%, 49%);
    --warning: hsl(23, 86%, 61%);
    --info: hsl(212, 95%, 68%);
    --container-bg: hsl(221, 15%, 15%);
    --pre-bg: hsl(221, 15%, 8%);
    --pre-color: hsl(221, 5%, 95%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--foreground);
    background: var(--background);
    transition: background 0.3s, color 0.3s;
}

/* Menu de navegação lateral */
.sidebar-nav {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--container-bg);
    border-right: 2px solid var(--border);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    padding: 20px 0;
}

.dark .sidebar-nav {
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
    background: hsl(221, 12%, 12%);
}

.sidebar-nav.active {
    left: 0;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}

.nav-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.2em;
}

.nav-close {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--foreground);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.nav-close:hover {
    color: var(--primary);
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list li {
    margin: 0;
}

.nav-item {
    position: relative;
}

.nav-item > .nav-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: var(--foreground);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-weight: 500;
    flex-wrap: nowrap;
    gap: 10px;
}

.nav-item > .nav-main > span {
    flex: 1;
    min-width: 0;
}

.nav-item > .nav-main:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    border-left-color: var(--primary);
}

.dark .nav-item > .nav-main:hover {
    background: rgba(var(--primary-rgb), 0.15);
}

.nav-item > .nav-main.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.dark .nav-item > .nav-main.active {
    background: rgba(var(--primary-rgb), 0.2);
}

.nav-expand {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.7;
}

.nav-expand:hover {
    color: var(--primary);
    opacity: 1;
}

.nav-item.expanded > .nav-expand {
    transform: rotate(90deg);
    color: var(--primary);
    opacity: 1;
}

.nav-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(var(--primary-rgb), 0.05);
}

.dark .nav-sublist {
    background: rgba(var(--primary-rgb), 0.08);
}

.nav-item.expanded > .nav-sublist {
    max-height: 1000px;
}

.nav-sublist li {
    margin: 0;
}

.nav-sublist a {
    display: block;
    padding: 10px 20px 10px 40px;
    color: var(--foreground);
    opacity: 0.75;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.9em;
}

.dark .nav-sublist a {
    opacity: 0.85;
}

.nav-sublist a:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    opacity: 1;
}

.dark .nav-sublist a:hover {
    background: rgba(var(--primary-rgb), 0.18);
}

.nav-sublist a.active {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
    opacity: 1;
}

.dark .nav-sublist a.active {
    background: rgba(var(--primary-rgb), 0.25);
}

/* Botão para abrir o menu */
.nav-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 998;
    background: var(--primary);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.nav-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dark .nav-toggle {
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .nav-toggle:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Overlay quando o menu está aberto */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 997;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Ajuste para quando o menu está aberto */
body.nav-open {
    overflow: hidden;
}

/* Botão de toggle do tema */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.theme-toggle:active {
    transform: scale(0.95) rotate(0deg);
}

.dark .theme-toggle {
    background: var(--primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .theme-toggle:hover {
    background: var(--primary-light);
    border-color: rgba(255, 255, 255, 0.2);
}

#themeIcon {
    transition: transform 0.3s ease;
}

.theme-toggle:hover #themeIcon {
    transform: scale(1.2);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--container-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 0.5rem;
    transition: background 0.3s, box-shadow 0.3s;
}

.dark .container {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 50px 20px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: box-shadow 0.3s;
}

.dark header {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    padding-bottom: 15px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

header p {
    font-size: 1.2em;
    color: white;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

h1 {
    color: var(--primary);
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
    font-weight: 600;
}

h2 {
    color: var(--primary-dark);
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 600;
}

h3 {
    color: var(--foreground);
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
}

h4 {
    color: var(--muted-foreground);
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 500;
}

p {
    margin-bottom: 15px;
}

ul, ol {
    margin-left: 30px;
    margin-bottom: 15px;
}

li {
    margin-bottom: 8px;
}

code {
    background: var(--muted);
    padding: 2px 6px;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary);
    border: 1px solid var(--border);
}

pre {
    background: #282a36 !important; /* Dracula background */
    color: #f8f8f2 !important; /* Dracula foreground */
    padding: 20px;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 20px 0;
    line-height: 1.5;
    border: 1px solid #44475a;
    transition: border-color 0.3s;
    position: relative;
}

pre code {
    background: none !important;
    padding: 0;
    color: #f8f8f2 !important;
    border: none;
    font-family: 'Fira Code', 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 0.95em;
    line-height: 1.6;
}

/* Sobrescrever cores do Prism.js para tema Dracula */
pre code .token.comment { color: #6272a4; font-style: italic; }
pre code .token.string { color: #f1fa8c; }
pre code .token.keyword { color: #ff79c6; }
pre code .token.function { color: #50fa7b; }
pre code .token.number { color: #bd93f9; }
pre code .token.class-name { color: #8be9fd; }
pre code .token.operator { color: #ff79c6; }
pre code .token.punctuation { color: #f8f8f2; }
pre code .token.property { color: #50fa7b; }
pre code .token.tag { color: #ff79c6; }
pre code .token.attr-name { color: #50fa7b; }
pre code .token.attr-value { color: #f1fa8c; }

/* Estilos para código inline também */
code:not(pre code) {
    background: #282a36;
    color: #f8f8f2;
    padding: 2px 6px;
    border-radius: 0.375rem;
    font-family: 'Fira Code', 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    border: 1px solid #44475a;
}

/* Melhorias visuais para código */
pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff79c6, #bd93f9, #50fa7b, #8be9fd);
    border-radius: 0.5rem 0.5rem 0 0;
}

.warning {
    background: hsl(23, 86%, 95%);
    border-left: 4px solid var(--warning);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0.5rem;
    transition: background 0.3s;
}

.dark .warning {
    background: hsl(23, 86%, 20%);
}

.warning strong {
    color: hsl(23, 86%, 35%);
}

.dark .warning strong {
    color: hsl(23, 86%, 70%);
}

.success {
    background: hsl(122, 39%, 95%);
    border-left: 4px solid var(--success);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0.5rem;
    transition: background 0.3s;
}

.dark .success {
    background: hsl(122, 39%, 20%);
}

.success strong {
    color: hsl(122, 39%, 30%);
}

.dark .success strong {
    color: hsl(122, 39%, 70%);
}

.error {
    background: hsl(0, 74%, 96%);
    border-left: 4px solid var(--destructive);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0.5rem;
    transition: background 0.3s;
}

.dark .error {
    background: hsl(0, 74%, 20%);
}

.error strong {
    color: hsl(0, 74%, 35%);
}

.dark .error strong {
    color: hsl(0, 74%, 70%);
}

.info {
    background: hsl(212, 95%, 96%);
    border-left: 4px solid var(--info);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0.5rem;
    transition: background 0.3s;
}

.dark .info {
    background: hsl(212, 95%, 20%);
}

.info strong {
    color: hsl(212, 95%, 30%);
}

.dark .info strong {
    color: hsl(212, 95%, 70%);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    border: 1px solid var(--border);
    padding: 12px;
    text-align: left;
    transition: border-color 0.3s, background 0.3s;
}

th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background: var(--muted);
}

.dark tr:nth-child(even) {
    background: var(--muted);
}

hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 40px 0;
}

.toc {
    background: var(--secondary);
    padding: 20px;
    border-radius: 0.5rem;
    margin: 30px 0;
    border: 1px solid var(--border);
}

.toc h2 {
    margin-top: 0;
    color: var(--primary);
}

.toc ul {
    list-style: none;
    margin-left: 0;
}

.toc a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.toc a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Melhorias visuais */
.container {
    transition: box-shadow 0.3s;
}

code:hover {
    background: var(--secondary);
}

.dark code {
    background: var(--muted);
    color: var(--primary-light);
}

.dark code:hover {
    background: var(--secondary);
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        top: 15px;
        right: 15px;
    }

    .nav-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        top: 15px;
        left: 15px;
    }

    .sidebar-nav {
        width: 260px;
        left: -260px;
    }
}

@media print {
    body {
        background: white;
    }
    .container {
        box-shadow: none;
    }
    header {
        box-shadow: none;
    }
    .theme-toggle {
        display: none;
    }
}

