/* Sidebar CSS - Notes sidebar, search, and note list styling */

/* Notes Sidebar */
.notes-sidebar {
    flex: 0 0 320px; /* Fixed width instead of flex: 1 */
    width: 320px;
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Hide horizontal scrollbar */
    height: calc(480px + 60px + 12px); /* Editor height + title bar height + precise gap */
    max-height: calc(480px + 60px + 12px); /* Ensure it doesn't exceed combined height */
    position: sticky;
    top: 20px;
    box-sizing: border-box;
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--button-background) var(--border-color);
}

/* Custom scrollbar for webkit browsers */
.notes-sidebar::-webkit-scrollbar {
    width: 8px;
}

.notes-sidebar::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.notes-sidebar::-webkit-scrollbar-thumb {
    background: var(--button-background);
    border-radius: 4px;
}

.notes-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--button-hover);
}

/* Dark mode scrollbar */
body.dark-mode .notes-sidebar::-webkit-scrollbar-track {
    background: var(--dark-border-color);
}

body.dark-mode .notes-sidebar::-webkit-scrollbar-thumb {
    background: var(--dark-button-background);
}

body.dark-mode .notes-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--dark-button-hover);
}

body.dark-mode .notes-sidebar {
    scrollbar-color: var(--dark-button-background) var(--dark-border-color);
}

.notes-sidebar button {
    width: 100%;
    padding: 12px 16px; /* More consistent padding */
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background-color: var(--button-background);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    font-weight: 500;
    min-height: 44px; /* Consistent button height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-sidebar button:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

/* New Note Button */
#newNoteButton {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background-color: var(--button-background);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    font-weight: 500;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#newNoteButton:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

/* Search Input */
#searchInput {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-background);
    color: var(--text-color);
    margin-bottom: 15px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

#searchInput:focus {
    border-color: var(--button-background);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Note Item Styling */
.note-item {
    padding: 14px 16px; /* More consistent padding */
    margin: 8px 0;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column; /* Stack title and timestamp */
    gap: 6px;
    box-sizing: border-box;
}

.note-item:hover {
    background-color: #f8d898;
    color: #333; /* Better contrast */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.note-timestamp {
    font-size: 0.75rem;
    color: #888;
    align-self: flex-end; /* Align to right */
    margin: 0;
    font-style: italic;
}