/* CSS Variables - Warm Beige Theme */
:root {
    --bg-primary: #F5F0E8;
    --bg-secondary: #E8DFD3;
    --bg-card: #FDFBF7;
    --bg-hover: #EFE7DB;
    
    --text-primary: #4A4035;
    --text-secondary: #7A6C5D;
    --text-muted: #A89B8C;
    
    --accent-primary: #8B7355;
    --accent-secondary: #A68B6A;
    --accent-light: #C9B8A3;
    
    --border-color: #D9CEC0;
    --shadow: 0 2px 8px rgba(74, 64, 53, 0.08);
    --shadow-hover: 0 4px 16px rgba(74, 64, 53, 0.12);
    
    --danger: #C75050;
    --success: #6B9065;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --font-serif: 'Noto Serif SC', serif;
    --font-sans: 'Noto Sans SC', sans-serif;
    
    --transition: 0.2s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* Layout */
.app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 0 20px;
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.app-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Search Section */
.search-section {
    padding: 16px 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--bg-card);
}



/* Notes Section */
.notes-section {
    flex: 1;
    padding: 0 20px;
    overflow-y: auto;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-top: 16px;
}

.notes-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
}

.note-card {
    padding: 14px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.note-card:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent-light);
    box-shadow: var(--shadow);
}

.note-card.active {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.note-card-title {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-card-preview {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 6px;
}

.note-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.note-card-category {
    background-color: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0 20px;
    height: 56px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-text,
.btn-danger {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-secondary);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
}

.btn-text {
    background-color: transparent;
    color: var(--text-secondary);
}

.btn-text:hover {
    color: var(--accent-primary);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background-color: rgba(199, 80, 80, 0.1);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view {
    flex: 1;
    overflow-y: auto;
}

.view.hidden {
    display: none;
}

/* Welcome View */
.welcome-view {
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.welcome-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-text {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Editor View */
.editor-view {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-card);
}

.editor-header {
    padding: 0 40px;
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.note-title-input {
    flex: 1;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    border: none;
    background: transparent;
    padding: 8px 0;
}

.note-title-input:focus {
    outline: none;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-toolbar {
    padding: 12px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 4px;
    background-color: var(--bg-primary);
}

.toolbar-btn {
    padding: 8px 12px;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition);
}

.toolbar-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.toolbar-separator {
    width: 1px;
    background-color: var(--border-color);
    margin: 0 8px;
}

.note-editor {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
}

.note-editor h1,
.note-editor h2,
.note-editor h3,
.note-editor h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
    line-height: 1.3;
}

.note-editor h1:first-child,
.note-editor h2:first-child,
.note-editor h3:first-child,
.note-editor h4:first-child {
    margin-top: 0;
}

.note-editor h1 {
    font-size: 32px;
}

.note-editor h2 {
    font-size: 26px;
}

.note-editor h3 {
    font-size: 22px;
}

.note-editor h4 {
    font-size: 18px;
}

.note-editor:focus {
    outline: none;
}

.note-editor:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
}

.editor-footer {
    padding: 0 40px;
    height: 56px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
}

.last-saved {
    font-size: 13px;
    color: var(--text-muted);
}

.save-status {
    margin-left: 16px;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
}

.save-status.status-editing {
    color: var(--text-muted);
}

.save-status.status-local {
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.save-status.status-syncing {
    color: var(--accent-primary);
}

.save-status.status-synced {
    color: var(--success);
}

.save-status.status-failed {
    color: var(--danger);
}

/* Online Status */
.online-status {
    margin-left: auto;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
}

.online-status.status-online {
    color: var(--success);
    background: rgba(107, 144, 101, 0.1);
}

.online-status.status-offline {
    color: var(--danger);
    background: rgba(199, 80, 80, 0.1);
}

/* Settings View */
.settings-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.settings-container {
    width: 100%;
    max-width: 560px;
}

.settings-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.settings-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.api-status {
    margin-left: 12px;
    font-size: 14px;
}

.api-status.success {
    color: var(--success);
}

.api-status.error {
    color: var(--danger);
}

.data-actions {
    display: flex;
    gap: 12px;
}

.back-btn {
    margin-top: 16px;
}

/* Trash View */
.trash-view {
    display: flex;
    padding: 40px;
}

.trash-container {
    width: 100%;
    max-width: 560px;
}

.trash-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.trash-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.trash-tip {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.trash-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trash-card {
    padding: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.trash-card-title {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.trash-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.days-left {
    color: var(--danger);
}

.trash-card-actions {
    display: flex;
    gap: 12px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background-color: var(--text-primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility */
.hidden {
    display: none !important;
}

/* 移动端返回按钮 - 桌面端隐藏 */
.mobile-back-btn {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
        height: 100%;
        transition: transform 0.3s ease;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .main-content {
        width: 100%;
    }

    .mobile-back-btn {
        display: flex !important;
        padding: 8px 12px;
    }

    .editor-header {
        padding: 12px 16px;
    }

    .note-title-input {
        font-size: 18px;
    }

    .editor-actions {
        display: none;
    }

    .note-editor {
        padding: 16px;
    }

    .editor-toolbar {
        padding: 8px 16px;
        overflow-x: auto;
    }

    .settings-view {
        padding: 16px;
    }

    .settings-container {
        padding-top: 16px;
    }
}
