/* ============================== */
/* NOTES VIEW STYLES              */
/* ============================== */

.notes-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    height: calc(100vh - 180px);
    min-height: 500px;
}

/* Sidebar */
.notes-sidebar {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.notes-header h2 {
    font-size: 1.1rem;
    color: white;
    margin: 0;
}

.new-note-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.new-note-btn:hover {
    background: var(--accent);
    transform: scale(1.05);
}

.new-note-btn i {
    width: 18px;
    height: 18px;
}

/* Search */
.notes-search {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.notes-search i {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.notes-search input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 0.9rem;
    outline: none;
}

.notes-search input::placeholder {
    color: var(--text-muted);
}

/* Categories */
.notes-categories {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cat-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.cat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.cat-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.cat-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--cat-color, var(--primary));
    border-radius: 0 2px 2px 0;
}

.cat-icon {
    font-size: 1rem;
}

.cat-name {
    flex: 1;
}

.cat-count {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Notes List */
.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.note-item {
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.note-item.active {
    background: rgba(255, 255, 255, 0.12);
    border-left-color: var(--primary);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.note-item-title {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-cat {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.note-item-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.note-item-date {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

.no-notes {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Editor */
.notes-editor {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.title-input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    outline: none;
}

.title-input::placeholder {
    color: var(--text-muted);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cat-select {
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.85rem;
}

.save-btn,
.delete-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.save-btn {
    background: var(--primary);
    color: white;
}

.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

.save-btn i,
.delete-btn i {
    width: 16px;
    height: 16px;
}

/* Markdown Toolbar */
.md-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.md-toolbar button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-toolbar button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.25rem;
}

/* Editor Area */
.editor-area {
    flex: 1;
    overflow: hidden;
}

.editor-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.editor-panes.preview-only {
    grid-template-columns: 1fr;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.editor-preview {
    padding: 1rem;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    line-height: 1.7;
}

.editor-preview h1 {
    font-size: 1.5rem;
    margin: 0.5rem 0;
    color: var(--accent);
}

.editor-preview h2 {
    font-size: 1.25rem;
    margin: 0.5rem 0;
    color: var(--primary);
}

.editor-preview h3 {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.editor-preview strong {
    color: var(--accent);
}

.editor-preview code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.editor-preview blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.editor-preview li {
    margin-left: 1.5rem;
}

.editor-preview .md-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.editor-preview .md-checkbox.checked {
    color: var(--text-muted);
    text-decoration: line-through;
}

.editor-preview a {
    color: var(--accent);
    text-decoration: underline;
}

.editor-preview .placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.view-mode-toggle button {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.view-mode-toggle button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.view-mode-toggle button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.view-mode-toggle button i {
    width: 14px;
    height: 14px;
}

/* Empty State */
.notes-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.notes-empty h3 {
    color: white;
    margin: 0 0 0.5rem 0;
}

.notes-empty p {
    color: var(--text-muted);
    margin: 0 0 1.5rem 0;
}

.create-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.create-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

.create-btn i {
    width: 18px;
    height: 18px;
}

/* Scrollbar */
.notes-list::-webkit-scrollbar,
.editor-preview::-webkit-scrollbar,
.editor-textarea::-webkit-scrollbar {
    width: 6px;
}

.notes-list::-webkit-scrollbar-track,
.editor-preview::-webkit-scrollbar-track,
.editor-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.notes-list::-webkit-scrollbar-thumb,
.editor-preview::-webkit-scrollbar-thumb,
.editor-textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .notes-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .notes-sidebar {
        max-height: 300px;
    }

    .notes-editor {
        min-height: 400px;
    }

    .editor-panes {
        grid-template-columns: 1fr;
    }

    .editor-preview {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}