:root {
    /* Tema Claro */
    --bg-gradient-start: #1565c0;
    --bg-gradient-mid: #1976d2;
    --bg-gradient-end: #1e88e5;
    --container-bg: #ffffff;
    --text-primary: #424242;
    --text-secondary: #9e9e9e;
    --heading-color: #1565c0;
    --border-color: #e0e0e0;
    --border-hover: #90caf9;
    --card-bg: #ffffff;
    --form-bg: #f5f5f5;
    --input-bg: #ffffff;
    --input-border: #bdbdbd;
    --btn-primary: #1976d2;
    --btn-primary-hover: #1565c0;
    --btn-secondary: #757575;
    --btn-copy: #66bb6a;
    --btn-copy-hover: #43a047;
    --btn-edit: #42a5f5;
    --btn-edit-hover: #1e88e5;
    --btn-delete: #ef5350;
    --btn-delete-hover: #e53935;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --autocomplete-hover: #e3f2fd;
}

body.dark-mode {
    /* Tema Escuro */
    --bg-gradient-start: #0d47a1;
    --bg-gradient-mid: #1565c0;
    --bg-gradient-end: #1976d2;
    --container-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #9e9e9e;
    --heading-color: #64b5f6;
    --border-color: #424242;
    --border-hover: #1976d2;
    --card-bg: #2d2d2d;
    --form-bg: #2d2d2d;
    --input-bg: #3d3d3d;
    --input-border: #555555;
    --btn-primary: #1976d2;
    --btn-primary-hover: #1565c0;
    --btn-secondary: #757575;
    --btn-copy: #66bb6a;
    --btn-copy-hover: #43a047;
    --btn-edit: #42a5f5;
    --btn-edit-hover: #1e88e5;
    --btn-delete: #ef5350;
    --btn-delete-hover: #e53935;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --autocomplete-hover: #1565c0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-light);
    padding: 40px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header h1 {
    color: var(--heading-color);
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 6px;
}

.theme-toggle:hover {
    border-color: var(--heading-color);
    background: var(--form-bg);
}

.theme-icon {
    color: var(--heading-color);
    transition: color 0.3s ease;
}

.add-section {
    text-align: center;
    margin-bottom: 30px;
}

.btn-add {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--btn-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.btn-add:hover {
    background: var(--btn-primary-hover);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.btn-add:active {
    transform: scale(0.95);
}

.plus-icon {
    color: white;
    font-size: 1.3em;
    font-weight: 300;
    line-height: 1;
}

.form-section {
    background: var(--form-bg);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.form-title {
    color: var(--heading-color);
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.3s ease;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
    transition: color 0.3s ease;
}

input[type="text"],
textarea,
.select-disciplina {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

input[type="text"]:focus,
textarea:focus,
.select-disciplina:focus {
    outline: none;
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.5;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--input-bg);
    border: 1px solid var(--btn-primary);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 14px;
    color: var(--text-primary);
}

.autocomplete-item:hover {
    background: var(--autocomplete-hover);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--btn-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
}

.btn-secondary {
    background: var(--btn-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.export-section {
    background: var(--form-bg);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.export-section h3 {
    color: var(--heading-color);
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
    transition: color 0.3s ease;
}

.export-controls {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.select-disciplina {
    min-width: 0;
}

.btn-export {
    background: var(--btn-edit);
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-export:hover {
    background: var(--btn-edit-hover);
}

.list-section {
    margin-top: 30px;
}

.list-section h3 {
    color: var(--heading-color);
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* Seção de busca e paginação */
.search-section {
    background: var(--form-bg);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    transition: background 0.3s ease;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.pagination-controls label {
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.items-per-page {
    padding: 6px 10px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-info {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: 10px;
    transition: color 0.3s ease;
}

/* Lista de anotações - layout enxuto */
.lista-anotacoes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.anotacao-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    padding-right: 12px;
    transition: all 0.2s ease;
    position: relative;
}

.anotacao-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 6px var(--shadow-light);
}

.anotacao-card:hover .anotacao-actions {
    opacity: 1;
}

.anotacao-header {
    margin-bottom: 8px;
}

.anotacao-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.anotacao-disciplina {
    color: var(--heading-color);
    font-weight: 600;
    font-size: 0.95em;
    transition: color 0.3s ease;
}

.anotacao-data {
    color: var(--text-secondary);
    font-size: 0.75em;
    transition: color 0.3s ease;
}

.anotacao-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-copy,
.btn-edit,
.btn-delete {
    padding: 4px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-copy {
    background: var(--btn-copy);
    color: white;
}

.btn-copy:hover {
    background: var(--btn-copy-hover);
}

.btn-edit {
    background: var(--btn-edit);
    color: white;
}

.btn-edit:hover {
    background: var(--btn-edit-hover);
}

.btn-delete {
    background: var(--btn-delete);
    color: white;
}

.btn-delete:hover {
    background: var(--btn-delete-hover);
}

.anotacao-texto {
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13px;
    transition: color 0.3s ease;
    text-align: justify;
}

/* Botões de paginação */
.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination-buttons button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.pagination-buttons button:hover:not(:disabled) {
    background: var(--autocomplete-hover);
    border-color: var(--btn-primary);
    color: var(--heading-color);
}

.pagination-buttons button.active {
    background: var(--btn-primary);
    color: white;
    border-color: var(--btn-primary);
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-controls {
        justify-content: space-between;
    }

    header h1 {
        font-size: 1.5em;
    }

    .theme-toggle {
        width: 28px;
        height: 28px;
    }
}

/* Estilos para conteúdo Markdown renderizado */
.markdown-content {
    line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--heading-color);
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-content h1 { font-size: 1.8em; }
.markdown-content h2 { font-size: 1.5em; }
.markdown-content h3 { font-size: 1.3em; }
.markdown-content h4 { font-size: 1.1em; }
.markdown-content h5 { font-size: 1em; }
.markdown-content h6 { font-size: 0.9em; }

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.markdown-content em {
    font-style: italic;
}

.markdown-content code {
    background-color: var(--form-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d32f2f;
}

body.dark-mode .markdown-content code {
    background-color: #3d3d3d;
    color: #ef5350;
}

.markdown-content pre {
    background-color: var(--form-bg);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1em;
}

body.dark-mode .markdown-content pre {
    background-color: #2d2d2d;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.markdown-content li {
    margin-bottom: 0.3em;
}

.markdown-content blockquote {
    border-left: 4px solid var(--border-hover);
    padding-left: 15px;
    margin: 1em 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content a {
    color: var(--btn-primary);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.markdown-content th {
    background-color: var(--form-bg);
    font-weight: 600;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5em 0;
}
