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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #F9FAFB;
}

/* 主色调 */
:root {
    --primary-color: #7098FE;
    --secondary-color: #F9FAFB;
    --text-color: #333;
    --border-color: #e1e5e9;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.logo h1 a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

.logo h1 a:hover {
    opacity: 0.8;
}

.search-box {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu span {
    color: var(--text-color);
    font-weight: 500;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-full {
    width: 100%;
}

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

.btn-primary:hover {
    background-color: #5a7fd8;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Banner广告位 */
.banner {
    background: linear-gradient(135deg, var(--primary-color), #5a7fd8);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* 主容器 */
.main-container {
    display: flex;
    max-width: 1200px;
    margin: 2rem auto;
    gap: 2rem;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

/* 左侧主题栏 */
.sidebar {
    width: 300px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: fit-content;
}

.sidebar h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

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

.topic-item {
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.topic-item.active {
    background-color: var(--primary-color);
    color: white;
}

.topic-title {
    flex: 1;
    cursor: pointer;
}

.topic-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.topic-item:hover .topic-actions {
    opacity: 1;
}

.topic-item .edit-btn,
.topic-item .delete-btn {
    opacity: 0;
    transition: opacity 0.3s;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.8rem;
}

.topic-item:hover .edit-btn,
.topic-item:hover .delete-btn {
    opacity: 1;
}

.topic-item.active .edit-btn,
.topic-item.active .delete-btn {
    color: white;
}

.topic-item .edit-btn {
    color: var(--primary-color);
}

.add-topic-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-topic-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

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

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.content-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.note-title {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    background: white;
}

.note-title:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 富文本编辑器 */
.editor-container {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: visible;
    position: relative;
}

.editor-scroll-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.editor-toolbar {
    background-color: var(--secondary-color);
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: var(--secondary-color);
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.toolbar-actions .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn {
    padding: 0.25rem 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

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

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

.editor-content {
    min-height: 400px;
    padding: 1rem 1rem 2rem 1rem;
    outline: none;
    line-height: 1.6;
}

.editor-content:focus {
    background-color: #fafbfc;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 消息提示 */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 认证页面样式 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #5a7fd8);
    padding: 2rem;
}

.auth-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 底部样式 */
.footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: #666;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-box {
        margin: 0;
        max-width: 100%;
    }
    
    .main-container {
        flex-direction: column;
        padding: 0 1rem;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .content-area {
        order: 1;
    }
    
    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .editor-scroll-container {
        max-height: 60vh;
    }
    
    .toolbar-btn {
        text-align: center;
    }
    
    .toolbar-actions {
        justify-content: center;
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .auth-box {
        padding: 1.5rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .sidebar {
        padding: 1rem;
    }
}

/* 笔记列表样式 */
.notes-list {
    display: grid;
    gap: 0.75rem;
}

.note-item {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: all 0.3s;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: flex-start;
}

.note-checkbox {
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.batch-mode .note-checkbox {
    opacity: 1;
}

.note-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.note-content {
    cursor: pointer;
    padding-right: 2rem;
    flex: 1;
}

.note-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(112, 152, 254, 0.1);
}

.note-item.active {
    border-color: var(--primary-color);
    background-color: #f8f9ff;
}

.note-item.selected {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
}

.note-item h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-color);
    font-size: 1rem;
    padding-right: 4rem;
}

.note-item p {
    margin: 0 0 0.25rem 0;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.note-item small {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    color: #999;
    font-size: 0.75rem;
}

.note-item .delete-btn {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem;
    border-radius: 3px;
}

.note-item:hover .delete-btn {
    opacity: 1;
}

.note-item.active .delete-btn {
    color: #dc3545;
}

/* 备份功能样式 */
.import-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.import-info p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
}

.import-info i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.file-input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.file-input-container input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
}

.file-input-label:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.file-input-label i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.file-input-label span {
    color: #666;
    font-weight: 500;
}

/* 用户菜单按钮样式调整 */
.user-menu .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.user-menu .btn i {
    font-size: 0.9rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .user-menu {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .user-menu .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .user-menu .btn span {
        display: none;
    }
    
    .user-menu .btn i {
        font-size: 1rem;
    }
    
    /* 移动端工具栏调整 */
    .toolbar-actions {
        gap: 0.4rem;
    }
    
    .toolbar-actions .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    

    
    /* 移动端保存成功提示调整 */
    .save-success {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
    
    /* 移动端搜索加载调整 */
    .search-loading {
        padding: 2rem;
        font-size: 0.9rem;
    }
}

/* 搜索加载状态样式 */
.search-loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1rem;
}

.search-loading i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* 批量操作工具栏 */
.batch-toolbar {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.batch-info {
    font-weight: 500;
    color: var(--text-color);
}

.batch-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.form-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: white;
    min-width: 150px;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #c82333;
}

/* 重命名模态框样式 */
#renameTopicModal {
    z-index: 1001; /* 确保在其他模态框之上 */
}

#renameTopicModal .modal-content {
    max-width: 500px;
    margin: 10% auto; /* 调整位置 */
}

#renameTopicModal .form-group {
    margin-bottom: 1.5rem;
}

#renameTopicModal .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

#renameTopicModal .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(112, 152, 254, 0.1);
    background-color: #fafbfc;
}

#renameTopicModal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* 确保模态框正确显示 */
#renameTopicModal[style*="display: block"] {
    display: block !important;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.message-success {
    background-color: #28a745;
}

.message-error {
    background-color: #dc3545;
}

.message-info {
    background-color: var(--primary-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
