/* VARIÁVEIS DE TEMA (CLARO / ESCURO) */
:root {
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #eeeeee;
    --bg-input: #ffffff;
    --header-bg: #1a1a2e;
    --primary: #004a8d;
    --accent: #f37021;
}

body.dark-mode {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --bg-input: #2a2a2a;
    --header-bg: #0d0d16;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s;
}

.hidden {
    display: none !important;
}

/* LAYOUT E RODAPÉ FIXO NA BASE */
.container {
    flex-grow: 1;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

footer {
    margin-top: auto;
    text-align: center;
    background: var(--header-bg);
    color: white;
    padding: 20px;
    font-size: 0.95rem;
}

/* TELA DE LOGIN / CADASTRO */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 340px;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-box input,
.login-box select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
}

.login-box button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    font-size: 16px;
    margin-top: 10px;
}

.login-box a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 15px;
    display: block;
    font-weight: bold;
}

/* MODAIS GERAIS */
.ui-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.ui-modal {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.ui-modal h3 {
    margin-top: 0;
    color: var(--primary);
}

.ui-modal input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 15px;
    background: var(--bg-input);
    color: var(--text-main);
}

.ui-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.ui-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    flex: 1;
}

.ui-btn-cancel {
    background: #6c757d;
    color: white;
}

.ui-btn-confirm {
    background: var(--accent);
    color: white;
}

/* TOAST NOTIFICATIONS (Avisos Flutuantes) */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* BOTÕES GERAIS */
.btn-action {
    background: #333;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    text-decoration: none;
}

.btn-action:hover {
    background: #555;
}

.btn-sair {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* ESTILO NOTION PARA LEITURA INTERNA */
.notion-view {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 20px;
    line-height: 1.6;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* MARCADORES NOTION (H1, H2, H3 Hover) */
.notion-view h1,
.notion-view h2,
.notion-view h3 {
    position: relative;
    color: var(--text-main);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.notion-view h1:hover::before,
.notion-view h2:hover::before,
.notion-view h3:hover::before {
    content: '\e142';
    /* Grip Vertical FontAwesome */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6em;
    color: #ccc;
    cursor: grab;
}

/* SUMÁRIO AUTOMÁTICO (TOC) */
.notion-toc {
    background: rgba(0, 0, 0, 0.02);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary);
}

body.dark-mode .notion-toc {
    background: rgba(255, 255, 255, 0.02);
}

.toc-title {
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toc-link {
    display: block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 8px;
    transition: 0.2s;
    font-size: 0.95rem;
}

body.dark-mode .toc-link {
    color: #00d2ff;
}

.toc-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.toc-h1 {
    font-weight: bold;
    margin-top: 10px;
}

.toc-h2 {
    margin-left: 15px;
}

.notion-view pre {
    background: #1e1e1e !important;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative;
}

.notion-view code {
    font-family: 'Consolas', monospace;
    font-size: 0.95rem;
}

.notion-view p code {
    background: rgba(0, 0, 0, 0.05);
    color: #e83e8c;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

body.dark-mode .notion-view p code {
    background: rgba(255, 255, 255, 0.1);
    color: #ff79c6;
}

.notion-view blockquote {
    border-left: 4px solid var(--primary);
    margin: 20px 0;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(0, 74, 141, 0.05);
    padding: 10px 15px;
    border-radius: 0 8px 8px 0;
}

.notion-view img {
    max-width: 100%;
    border-radius: 8px;
}

.btn-copy-code {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: 0.2s;
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-copy-code:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Botão de Anexo/Material Externo dentro da Leitura */
.btn-material-externo {
    display: inline-flex; align-items: center; gap: 10px;
    background: rgba(0, 74, 141, 0.1); color: var(--primary);
    padding: 12px 20px; border-radius: 8px; text-decoration: none;
    font-weight: bold; margin-bottom: 25px; border: 1px solid rgba(0, 74, 141, 0.2);
    transition: 0.2s;
}
body.dark-mode .btn-material-externo {
    background: rgba(0, 210, 255, 0.1); color: #00d2ff; border-color: rgba(0, 210, 255, 0.2);
}
.btn-material-externo:hover { background: var(--primary); color: white; }
body.dark-mode .btn-material-externo:hover { background: #00d2ff; color: #1a1a2e; }