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

:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface-hover: #1a2744;
    --border: #2a3a5e;
    --text: #e0e0e0;
    --text-muted: #8892a4;
    --primary: #4f8cff;
    --primary-hover: #3a7aff;
    --danger: #ff4757;
    --danger-hover: #e8384a;
    --success: #2ed573;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Notes List */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
}

.note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.note-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.note-card h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.note-card .note-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-card .note-preview {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 0.875rem;
}

/* Editor */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#note-title {
    font-size: 1.25rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
}

#note-title:focus {
    border-color: var(--primary);
}

#note-content {
    min-height: 300px;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

#note-content:focus {
    border-color: var(--primary);
}

/* Attachments */
.attachments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.attachments-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.attachment-upload {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

#file-input {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.attachment-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
}

.attachment-actions .btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

/* Responsive */
@media (max-width: 600px) {
    .app {
        padding: 1rem 0.75rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .editor-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
}
