/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: var(--statusbar-height, 40px);
    width: 280px;
    background: var(--color-bg-glass);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    z-index: 100;
}


.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.sidebar-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
}

.sidebar-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.note-item.deleted {
    opacity: 0.6;
    background: var(--color-bg-tertiary);
}

.note-item.deleted .note-name {
    text-decoration: line-through;
}

/* Folder tree styles */
.tree-item {
    margin-bottom: calc(var(--spacing-xs) / 2);
}

.folder-item {
    padding: calc(var(--spacing-sm) / 2) var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    user-select: none;
}

.folder-item:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-hover);
}

.folder-expand-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
    color: var(--color-text-tertiary);
}

.folder-item.expanded .folder-expand-icon {
    transform: rotate(90deg);
}

.folder-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-accent-primary);
}

.folder-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9em;
    line-height: 1.2;
    color: var(--color-text-primary);
}

.folder-actions {
    display: flex;
    gap: var(--spacing-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.folder-item:hover .folder-actions {
    opacity: 1;
}

.folder-action-btn {
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-action-btn:hover {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.folder-children {
    margin-left: var(--spacing-lg);
    margin-top: var(--spacing-xs);
    display: none;
}

.folder-children.expanded {
    display: block;
}

/* Drag and drop styles */
.note-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.folder-item.drag-over {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

.folder-item.drag-over .folder-name {
    color: white;
}

.note-item {
    cursor: grab;
}

.note-item:active {
    cursor: grabbing;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.note-item {
    padding: calc(var(--spacing-md) / 2) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.note-item:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-hover);
    transform: translateX(4px);
}

.note-item.active {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: white;
}

.note-item.active .note-name,
.note-item.active .note-date {
    color: white;
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-name {
    font-weight: 500;
    font-size: 0.9em;
    line-height: 1.2;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-date {
    font-size: calc(0.9em * 0.85);
    line-height: 1.2;
    color: var(--color-text-tertiary);
}

.note-actions {
    display: flex;
    gap: var(--spacing-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.note-item:hover .note-actions {
    opacity: 1;
}

.note-action-btn {
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-action-btn:hover {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.note-item.active .note-action-btn {
    color: rgba(255, 255, 255, 0.8);
}

.note-item.active .note-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Adjust editor container for sidebar */
.editor-container {
    margin-left: 280px !important;
    transition: margin-left var(--transition-base);
}

.sidebar.hidden~* .editor-container,
body:has(.sidebar.hidden) .editor-container {
    margin-left: 0 !important;
}

/* Adjust toolbar for sidebar */
.toolbar {
    margin-left: 280px;
    transition: margin-left var(--transition-base);
}


/* Item Selection Checkbox */
.item-select {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    margin-right: var(--spacing-sm);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.item-select:checked {
    background-color: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

.item-select:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 3px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.note-item.active .item-select {
    border-color: rgba(255, 255, 255, 0.5);
}

.note-item.active .item-select:checked {
    background-color: white;
    border-color: white;
}

.note-item.active .item-select:checked::after {
    border-color: var(--color-accent-primary);
}

/* Delete Selected Button Style */
#deleteSelectedBtn {
    color: var(--color-error);
}

#deleteSelectedBtn:hover {
    background: rgba(239, 68, 68, 0.1);
}

#emptyTrashBtn:hover {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}