:root {
    --background-color: #ffffff;
    --text-color: #1c1c1e;
    --border-color: #e2e2e2;
    --highlight-color: #007aff;
    --secondary-text: #787878;
    --note-hover: #f2f2f7;
    --toolbar-bg: #f8f9fa;
    --danger-color: #dc3545;
    --modal-overlay: rgba(0, 0, 0, 0.5);
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
}

.container {
    height: 100vh;
    display: flex;
}

.notes-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.toolbar {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--toolbar-bg);
    position: relative;
}

.toggle-menu {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
}

.toggle-menu:hover {
    background-color: var(--note-hover);
}

.note-count {
    color: var(--secondary-text);
    font-size: 0.9rem;
    margin-right: auto;
}

.sidebar-new-note-btn {
    width: 32px;
    height: 32px;
    background-color: var(--highlight-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin: 0.75rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-new-note-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.notes-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.notes-list {
    width: 250px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--background-color);
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notes-list.hidden {
    transform: translateX(-100%);
    width: 0;
}

.notes-list:not(.hidden) ~ .active-note .suggestions {
    display: none !important;
}

.note-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.note-item-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
    padding-right: 2rem;
}

.note-item-preview {
    font-size: 0.9rem;
    color: var(--secondary-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.note-item.active {
    background-color: var(--note-hover);
}

.note-item .delete-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.note-item:hover .delete-btn {
    opacity: 1;
}

.active-note {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.title-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.note-title {
    flex: 1;
    font-size: 1.5rem;
    border: none;
    outline: none;
    background: none;
    color: var(--text-color);
    padding: 1rem;
}

.chat-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    margin-right: 0.5rem;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.format-toolbar {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--toolbar-bg);
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.format-toolbar button {
    padding: 0.5rem;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
}

.format-toolbar button:hover {
    background: var(--note-hover);
}

.format-toolbar .separator {
    color: var(--border-color);
    margin: 0 0.5rem;
}

.note-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    outline: none;
    font-size: 1rem;
    line-height: 1.6;
}

.note-content[placeholder]:empty:before {
    content: attr(placeholder);
    color: var(--secondary-text);
}

.suggestions {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: none;
}

.suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-number {
    color: var(--secondary-text);
    font-size: 0.9rem;
    min-width: 1.5rem;
}

.suggestion-item:hover {
    background-color: var(--note-hover);
}

/* Chat Interface */
.chat-interface {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: var(--background-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.chat-interface.hidden {
    transform: translateX(100%);
}

.chat-interface:not(.hidden) {
    transform: translateX(0);
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--toolbar-bg);
}

.close-chat-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
}

.close-chat-btn:hover {
    background-color: var(--note-hover);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.75rem;
    border-radius: 8px;
    max-width: 80%;
}

.message.user {
    background: var(--highlight-color);
    color: white;
    align-self: flex-end;
}

.message.assistant {
    background: var(--note-hover);
    color: var(--text-color);
    align-self: flex-start;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    background: var(--toolbar-bg);
}

#chatInput {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    resize: none;
    font-family: inherit;
    background: var(--background-color);
}

.send-message-btn {
    background: var(--highlight-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.send-message-btn:hover {
    opacity: 0.9;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--secondary-text);
}

.modal-btn {
    padding: 0.75rem 2rem;
    background-color: var(--highlight-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s ease;
}

.modal-btn:hover {
    opacity: 0.9;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Configuration styles */
.toolbar-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-left: auto;
}

.config-button, .chat-button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button {
    margin-right: 0.5rem;
}

.config-button:hover, .chat-button:hover {
    background-color: var(--note-hover);
}

.config-menu {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 12px;
    position: absolute;
    right: 8px;
    top: calc(100% + 4px);
    z-index: 1000;
    min-width: 200px;
}

.config-menu.hidden {
    display: none;
}

.config-option {
    margin: 10px 0;
}

.config-option label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.9em;
}

.config-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .notes-list {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 10;
    }
}
