/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 登录页面样式 */
body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
}

.login-container button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-container button:active {
    transform: translateY(0);
}

.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* 主页面样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

header {
    background: white;
    padding: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

h1 {
    font-size: 22px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-btn {
    padding: 6px 14px;
    background: #f1f3f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    align-items: start;
}

/* 侧边栏样式 */
.sidebar {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 90px;
}

.sidebar .search-box {
    background: transparent;
    padding: 0;
    margin-bottom: 16px;
    box-shadow: none;
}

.sidebar h3 {
    margin-bottom: 12px;
    font-size: 15px;
    color: #333;
}

.tag-list {
    list-style: none;
}

.tag-item {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.tag-item:hover {
    background: #f8f9fa;
}

.tag-item.active {
    background: #667eea;
    color: white;
}

.tag-count {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.tag-item.active .tag-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 内容区域 */
.content-area {
    flex: 1;
}

.search-box {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 新建笔记 */
.new-memo {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.new-memo textarea {
    width: 100%;
    min-height: 300px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    margin-bottom: 10px;
}

.new-memo textarea:focus {
    outline: none;
    border-color: #667eea;
}

.new-memo-footer {
    display: flex;
    justify-content: flex-end;
}

.new-memo button {
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.new-memo button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.new-memo button:active {
    transform: translateY(0);
}

/* 笔记列表 */
.memo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memo-item {
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: visible;
}

.memo-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.memo-header {
    margin-bottom: 6px;
}

.pinned-badge {
    font-size: 11px;
    color: #667eea;
    font-weight: 600;
    display: inline-block;
}

.memo-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    margin-bottom: 8px;
    line-height: 1.7;
    max-width: 100%;
    font-size: 14px;
}

.memo-content .hashtag {
    color: #667eea;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.memo-content .hashtag:hover {
    color: #764ba2;
    text-decoration: underline;
}

.memo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #999;
    font-size: 11px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
}

.memo-time {
    flex: 1;
}

.memo-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.memo-menu-btn {
    padding: 2px 6px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    transition: all 0.2s;
    line-height: 1;
}

.memo-menu-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.memo-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    min-width: 110px;
}

.memo-menu.active {
    display: flex;
}

.memo-menu button {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
}

.memo-menu button:hover {
    background: #f8f9fa;
    color: #333;
}

.memo-actions {
    display: flex;
    gap: 10px;
}

.memo-actions button {
    padding: 6px 12px;
    background: #f8f9fa;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s;
}

.memo-actions button:hover {
    background: #e9ecef;
    color: #333;
}

.memo-actions .delete-btn:hover {
    background: #fee;
    color: #c33;
}

.edit-mode textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    margin-bottom: 10px;
}

.edit-mode button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.edit-mode button:first-child {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.edit-mode button:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 加载更多按钮 */
.load-more-container {
    text-align: center;
    padding: 20px 0;
}

.load-more-btn {
    padding: 10px 32px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .content-area {
        order: 1;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .container {
        padding: 15px;
    }
    
    /* 防止内容溢出 */
    body {
        overflow-x: hidden;
    }
    
    .memo-content {
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .memo-item {
        max-width: 100%;
        overflow: visible;
        position: relative;
    }
    
    .new-memo textarea {
        max-width: 100%;
    }
    
    /* 手机端菜单层级提升 */
    .memo-menu {
        z-index: 9999;
    }
}
