/* ============================================
   Bloco de Notas - Windows 95 Theme
   ============================================ */

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

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', Arial, sans-serif;
    font-size: 11px;
    background-color: #008080;
    background-image: linear-gradient(45deg, #008080 25%, #00a0a0 25%),
                      linear-gradient(-45deg, #008080 25%, #00a0a0 25%),
                      linear-gradient(45deg, #00a0a0 75%, #008080 75%),
                      linear-gradient(-45deg, #00a0a0 75%, #008080 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: hidden;
}

body.dashboard {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* ============================================
   Janelas
   ============================================ */

.window {
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    box-shadow: 1px 1px 0 #ffffff inset, 2px 2px 0 #dfdfdf inset, 1px 1px 0 #808080;
    display: flex;
    flex-direction: column;
}

.main-window {
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    max-height: 800px;
}

/* Barra de título */
.window-header {
    background: linear-gradient(to right, #000080, #1084d7);
    color: #ffffff;
    padding: 2px 2px 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 11px;
    min-height: 20px;
    user-select: none;
}

.window-header-text {
    flex: 1;
}

.window-buttons {
    display: flex;
    gap: 2px;
}

.window-button {
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    width: 16px;
    height: 14px;
    padding: 0;
    margin: 0;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.window-button:active {
    border-color: #808080 #dfdfdf #dfdfdf #808080;
}

/* ============================================
   Menu
   ============================================ */

.menu-bar {
    background-color: #c0c0c0;
    display: flex;
    border-bottom: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    height: 22px;
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-label {
    padding: 2px 8px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
}

.menu-label:hover {
    background-color: #000080;
    color: #ffffff;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    min-width: 150px;
    z-index: 1000;
    box-shadow: 1px 1px 0 #ffffff inset, 2px 2px 0 #dfdfdf inset, 1px 1px 0 #808080;
}

.dropdown:hover .dropdown-menu,
.menu-item.active .dropdown-menu {
    display: block;
}

.menu-option {
    padding: 4px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    white-space: nowrap;
}

.menu-option:hover {
    background-color: #000080;
    color: #ffffff;
}

.menu-separator {
    border: none;
    border-top: 1px solid #dfdfdf;
    border-bottom: 1px solid #808080;
    margin: 2px 0;
    height: 2px;
}

/* ============================================
   Workspace
   ============================================ */

.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: #c0c0c0;
}

/* Sidebar */
.sidebar {
    width: 200px;
    background-color: #c0c0c0;
    border-right: 2px solid;
    border-color: #808080 #dfdfdf #dfdfdf #808080;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 8px;
    background-color: #c0c0c0;
    border-bottom: 2px solid #808080;
    display: flex;
    gap: 4px;
}

.search-input {
    flex: 1;
    padding: 3px 4px;
    border: 2px solid;
    border-color: #808080 #dfdfdf #dfdfdf #808080;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 11px;
}

.sort-button {
    padding: 3px 6px;
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    font-size: 11px;
    cursor: pointer;
    min-width: 30px;
}

.sort-button:active {
    border-color: #808080 #dfdfdf #dfdfdf #808080;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    background-color: #c0c0c0;
}

.note-item {
    padding: 6px 4px;
    margin-bottom: 2px;
    background-color: #ffffff;
    border: 1px solid #c0c0c0;
    cursor: pointer;
    font-size: 11px;
    border-left: 3px solid transparent;
}

.note-item:hover {
    background-color: #000080;
    color: #ffffff;
    border-left-color: #dfdfdf;
}

.note-item.active {
    background-color: #000080;
    color: #ffffff;
    border-left-color: #dfdfdf;
}

.note-title-item {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.note-date-item {
    font-size: 9px;
    opacity: 0.7;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Editor Panel */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #c0c0c0;
    padding: 8px;
    overflow: hidden;
}

.note-title {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 8px;
    border: 2px solid;
    border-color: #808080 #dfdfdf #dfdfdf #808080;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 14px;
    font-weight: bold;
    background-color: #ffffff;
}

.note-title:focus {
    outline: none;
}

.note-info {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    margin-bottom: 6px;
    padding: 0 4px;
    color: #666;
}

/* Editor Quill */
.editor {
    flex: 1;
    background-color: #ffffff;
    border: 2px solid;
    border-color: #808080 #dfdfdf #dfdfdf #808080;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ql-container {
    flex: 1;
    overflow-y: auto;
    font-size: 13px;
    font-family: Courier New, monospace;
}

.ql-editor {
    padding: 12px;
    line-height: 1.6;
    min-height: 100px;
}

.ql-toolbar {
    border: none;
    border-bottom: 1px solid #c0c0c0;
    background-color: #f0f0f0;
    padding: 0;
}

.ql-toolbar.ql-snow {
    padding: 5px 0;
    border-bottom: 1px solid #c0c0c0;
}

.ql-snow .ql-toolbar button,
.ql-snow .ql-toolbar button.ql-active,
.ql-snow.ql-toolbar button,
.ql-snow.ql-toolbar button.ql-active {
    width: auto;
    height: auto;
}

.ql-snow .ql-stroke {
    stroke: #444;
}

.ql-snow .ql-fill {
    fill: #444;
}

/* Barra de status */
.status-bar {
    background-color: #c0c0c0;
    border-top: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    height: 20px;
    align-items: center;
}

.status-bar span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Modais
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    box-shadow: 1px 1px 0 #ffffff inset, 2px 2px 0 #dfdfdf inset, 1px 1px 0 #808080;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-header {
    background: linear-gradient(to right, #000080, #1084d7);
    color: #ffffff;
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    min-height: 20px;
}

.modal-header h2 {
    font-size: 11px;
    margin: 0;
}

.modal-close {
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    width: 16px;
    height: 14px;
    padding: 0;
    font-size: 10px;
    cursor: pointer;
}

.modal-body {
    padding: 12px;
    overflow-y: auto;
    background-color: #c0c0c0;
    flex: 1;
}

.modal-footer {
    padding: 8px;
    background-color: #c0c0c0;
    border-top: 2px solid #808080;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

/* Botões */
.button {
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    padding: 4px 12px;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 11px;
    cursor: pointer;
    min-width: 75px;
}

.button:active {
    border-color: #808080 #dfdfdf #dfdfdf #808080;
}

/* Modal de notas */
.modal-notes-list {
    padding: 12px;
    overflow-y: auto;
    background-color: #c0c0c0;
    flex: 1;
    max-height: 400px;
}

.modal-note-item {
    padding: 8px;
    margin-bottom: 4px;
    background-color: #ffffff;
    border: 1px solid #c0c0c0;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.modal-note-item:hover {
    background-color: #000080;
    color: #ffffff;
    border-left-color: #dfdfdf;
}

.modal-note-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.modal-note-info {
    font-size: 9px;
    opacity: 0.7;
}

/* Tabelas em modais */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

table tr {
    border-bottom: 1px solid #dfdfdf;
}

table td {
    padding: 4px 8px;
    text-align: left;
}

table td:first-child {
    font-weight: bold;
    width: 120px;
    background-color: #f0f0f0;
}

/* ============================================
   Scrollbar Personalizada
   ============================================ */

.notes-list::-webkit-scrollbar,
.modal-notes-list::-webkit-scrollbar {
    width: 16px;
}

.notes-list::-webkit-scrollbar-track,
.modal-notes-list::-webkit-scrollbar-track {
    background: #c0c0c0;
}

.notes-list::-webkit-scrollbar-thumb,
.modal-notes-list::-webkit-scrollbar-thumb {
    background: #dfdfdf;
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
}

.notes-list::-webkit-scrollbar-thumb:hover,
.modal-notes-list::-webkit-scrollbar-thumb:hover {
    background: #e8e8e8;
}

/* ============================================
   Responsividade
   ============================================ */

@media (max-width: 1024px) {
    .main-window {
        width: 98vw;
        height: 98vh;
        max-width: 100%;
        max-height: 100%;
    }

    .sidebar {
        width: 150px;
    }

    .note-item,
    .modal-note-item {
        padding: 4px 2px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 120px;
    }

    .menu-item {
        flex: 1;
    }

    .menu-label {
        padding: 2px 4px;
        font-size: 10px;
    }

    .dropdown-menu {
        min-width: 120px;
    }

    .menu-option {
        padding: 3px 8px;
        font-size: 10px;
    }

    .editor-panel {
        padding: 4px;
    }

    .note-info {
        flex-wrap: wrap;
        gap: 8px;
    }

    .status-bar {
        flex-direction: column;
        height: auto;
        gap: 2px;
        padding: 4px 2px;
    }

    .status-bar span {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .main-window {
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .sidebar {
        width: 100px;
    }

    .menu-label {
        padding: 2px 3px;
        font-size: 9px;
    }

    .note-title {
        font-size: 12px;
        padding: 4px;
    }

    .ql-editor {
        padding: 8px;
        font-size: 12px;
    }

    .ql-container {
        font-size: 12px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .window-button {
        width: 14px;
        height: 12px;
        font-size: 9px;
    }

    .note-info {
        font-size: 8px;
    }

    .notes-list {
        padding: 2px;
    }

    .note-item {
        padding: 4px 2px;
        margin-bottom: 1px;
    }
}

/* ============================================
   Utilitários
   ============================================ */

.hidden {
    display: none !important;
}

.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    border-radius: 0 !important;
}

.app-container {
    width: 100%;
    height: 100%;
}

/* Animações suaves */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.active .modal-content {
    animation: slideIn 0.2s ease-out;
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .menu-bar,
    .sidebar,
    .status-bar,
    .window-header,
    .note-info {
        display: none;
    }

    .editor {
        border: none;
    }

    .ql-toolbar {
        display: none;
    }

    .window {
        border: none;
        box-shadow: none;
    }
}
