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

body {
    font-family: 'Segoe UI', 'Roboto', 'Noto Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    color: #1e2a3e;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    background: #fff;
    position: relative;
}

/* 左侧边栏 */
.sidebar {
    width: 300px;
    background: #f9fafc;
    border-right: 1px solid #e6edf4;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px 16px 20px;
    border-bottom: 1px solid #eef2f8;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.logo-icon {
    font-size: 28px;
    color: #2c7da0;
    background: #eaf4ff;
    padding: 8px;
    border-radius: 14px;
}

.logo-area h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1f3b4c;
}

.new-note-btn {
    width: 100%;
    background: #2c7da0;
    border: none;
    color: white;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.new-note-btn:hover {
    background: #1f5e7e;
    transform: translateY(-1px);
}

.search-area {
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f8;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 30px;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
}

.search-box:focus-within {
    border-color: #2c7da0;
    box-shadow: 0 0 0 3px rgba(44,125,160,0.1);
}

.search-icon {
    color: #8ba0b5;
    margin-right: 8px;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
}

.notes-list-container {
    flex: 1;
    padding: 12px 12px 20px 12px;
    overflow-y: auto;
}

.notes-list-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: #5f7f9e;
    padding: 0 8px 12px 8px;
}

.notes-count {
    background: #eef2f8;
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 12px;
}

.notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-item {
    background: white;
    border-radius: 14px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #edf2f7;
}

.note-item:hover {
    border-color: #dce5ef;
    transform: translateX(2px);
}

.note-item.active {
    background: #eaf6ff;
    border-left: 4px solid #2c7da0;
}

.note-item.pinned {
    border-left: 4px solid #f5b042;
    background: #fffef7;
}

.note-title-preview {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #1f3b4c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-pin-icon {
    color: #f5b042;
    font-size: 12px;
}

.note-summary-preview {
    font-size: 12px;
    color: #8ba0b5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: #8ba0b5;
}

.loading-item {
    text-align: center;
    padding: 30px;
    color: #90a4bc;
}

/* 右侧编辑器 */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.mobile-back-btn {
    padding: 12px 16px 0 16px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
}

.back-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #2c7da0;
}

.editor-header {
    padding: 20px 32px 12px 32px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.editor-title-wrapper {
    flex: 1;
    min-width: 200px;
}

.note-title-input {
    width: 100%;
    font-size: 28px;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    color: #1e2a3e;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}

.note-title-input:focus {
    border-bottom-color: #2c7da0;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.save-btn {
    background: #2c7da0;
    color: white;
}

.delete-btn {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #ffe3e3;
}

.edit-toggle-btn {
    background: #eef2ff;
    color: #2c7da0;
}

.pin-btn {
    background: #fef9e6;
    color: #e6a017;
    border: 1px solid #ffe6b3;
}

.share-btn {
    background: #e6f7f0;
    color: #2c7da0;
    border: 1px solid #c0e3d9;
}

.editor-content-wrapper {
    flex: 1;
    padding: 20px 32px 32px 32px;
    overflow-y: auto;
}

.note-content-textarea {
    width: 100%;
    min-height: 60vh;
    border: 1px solid #edf2f7;
    border-radius: 20px;
    padding: 20px 24px;
    font-size: 16px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    outline: none;
    background: #fefefe;
}

.note-content-view {
    background: #fefefe;
    padding: 20px 24px;
    border-radius: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #2d3e50;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #edf2f7;
    min-height: 60vh;
}

.note-content-view a {
    color: #2c7da0;
    text-decoration: none;
    border-bottom: 1px dashed #bdd9e7;
}

.note-content-view a:hover {
    text-decoration: underline;
}

/* 分享模式全局样式 */
body.share-mode .sidebar {
    display: none;
}

body.share-mode .editor-area {
    margin-left: 0;
    width: 100%;
}

body.share-mode .mobile-back-btn,
body.share-mode .editor-actions,
body.share-mode .editor-footer,
body.share-mode .note-title-input {
    display: none;
}

body.share-mode .note-content-view {
    border: none;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
    display: block !important;   /* 强制显示，修复手机空白 */
}

.share-home-link {
    display: block;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    font-size: 14px;
}

.share-home-link a {
    color: #2c7da0;
    text-decoration: none;
}

.editor-footer {
    padding: 12px 32px 20px 32px;
    border-top: 1px solid #edf2f7;
    font-size: 12px;
    color: #8ba0b5;
    display: flex;
    align-items: center;
    gap: 8px;
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .app-container {
        position: relative;
        overflow: hidden;
    }
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        transform: translateX(0);
    }
    .sidebar.hide-mobile {
        transform: translateX(-100%);
    }
    .editor-area {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 5;
        background: white;
        transform: translateX(100%);
    }
    .editor-area.show-mobile {
        transform: translateX(0);
        z-index: 20;
    }
    .mobile-back-btn {
        display: block !important;
    }
    .editor-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: stretch;
    }
    .note-title-input {
        font-size: 22px;
    }
    .editor-content-wrapper {
        padding: 16px 20px;
    }
    .action-btn {
        padding: 6px 14px;
        font-size: 12px;
    }
    /* 手机分享模式额外保障 */
    body.share-mode .note-content-view {
        padding: 16px;
        font-size: 15px;
    }
}