:root {
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f7;
    --text-color: #1d1d1f;
    --secondary-text: #86868b;
    --accent-color: #007aff;
    --border-color: #d2d2d7;
    --hover-color: #e8e8ed;
    --selected-bg: #007aff;
    --selected-text: #ffffff;
}

.dark-mode {
    --bg-color: #1e1e1e;
    --sidebar-bg: #252525;
    --text-color: #f5f5f7;
    --secondary-text: #a1a1a6;
    --accent-color: #0a84ff;
    --border-color: #38383a;
    --hover-color: #3a3a3c;
    --selected-bg: #0a84ff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body, html {
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-color);
    color: var(--text-color);
}

.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px 15px 10px;
}

#add-note-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    float: right;
}

.search-container {
    clear: both;
    margin-top: 15px;
    position: relative;
}

.search-container i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    font-size: 0.9rem;
}

#search-input {
    width: 100%;
    padding: 8px 10px 8px 30px;
    border-radius: 8px;
    border: none;
    background: var(--hover-color);
    color: var(--text-color);
    outline: none;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

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

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

.note-item.active {
    background: var(--selected-bg);
    color: var(--selected-text);
}

.note-item.active .note-item-date {
    color: rgba(255,255,255,0.8);
}

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

.note-item-preview {
    font-size: 0.85rem;
    display: flex;
    gap: 8px;
}

.note-item-date {
    color: var(--secondary-text);
    flex-shrink: 0;
}

.note-item-snippet {
    color: var(--secondary-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active .note-item-snippet {
    color: rgba(255,255,255,0.8);
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

#theme-toggle {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 1.1rem;
}

.main-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--secondary-text);
}

.placeholder i {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.2;
}

#editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 40px;
}

.hidden {
    display: none !important;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#last-modified {
    font-size: 0.75rem;
    color: var(--secondary-text);
    text-transform: uppercase;
}

#delete-note-btn {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 1.1rem;
}

#delete-note-btn:hover { color: #ff3b30; }

#note-title {
    font-size: 1.8rem;
    font-weight: 700;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    margin-bottom: 15px;
}

#note-body {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    resize: none;
}