/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f5f7; /* 浅灰背景，保护视力 */
    color: #333;
    height: 100vh;
    overflow: hidden; /* 防止整体滚动 */
}

/* 整体容器：左右分栏 */
.app-container {
    display: flex;
    height: 100%;
}

/* --- 左侧边栏样式 --- */
.sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0; /* 防止被压缩 */
}

.logo h1 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    margin-bottom: 20px;
}

.search-box input:focus {
    border-color: #42b983; /* Vue 的标志性绿色 */
}

/* 分类树样式 */
.category-tree {
    flex: 1;
    overflow-y: auto;
}

.tree-item {
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
    margin-bottom: 2px;
}

.tree-item:hover {
    background-color: #f0f2f5;
}

.tree-item.active {
    background-color: #e6f7ef; /* 浅绿背景 */
    color: #42b983;
    font-weight: bold;
}

.tree-children {
    margin-left: 20px; /* 层级缩进 */
    margin-top: 4px;
}

.tree-children .tree-item {
    font-size: 13px;
    color: #666;
}

.icon {
    margin-right: 6px;
}

/* --- 右侧主内容样式 --- */
.main-content {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    padding: 20px 30px;
    overflow-y: auto; /* 内容多时右侧滚动 */
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.content-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-primary {
    background-color: #42b983;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background-color: #3aa876;
}

/* 笔记卡片样式 */
.note-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 响应式网格 */
    gap: 20px;
}

.note-card {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* 轻微阴影 */
    transition: transform 0.2s;
    cursor: pointer;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.note-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.note-card .meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-card .tag {
    background-color: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    color: #666;
}

.note-card p {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    /* 文字超出部分省略 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    /* 最多显示2行 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 旧版浏览器兼容 */
    line-clamp: 2;         /* 新增：标准属性 */
    -webkit-box-orient: vertical;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
}

.form-actions button {
    margin-left: 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 回收站入口 */
.trash-entry {
    position: relative;
    color: #888;
}
.trash-entry.active {
    color: #e74c3c;
    background: #fdf2f2;
}
.trash-count {
    position: absolute;
    right: 10px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}
.tree-divider {
    height: 1px;
    background: #eee;
    margin: 10px 0;
}

/* 卡片头部布局 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.card-header h3 {
    flex: 1;
    margin: 0;
}
.card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.note-card:hover .card-actions {
    opacity: 1;
}
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
}
.btn-icon:hover {
    background: #f0f0f0;
}
.btn-delete:hover {
    background: #fdeaea;
}

/* 回收站卡片 */
.trash-card {
    background: #fff;
    opacity: 0.8;
}
.deleted-time {
    color: #999;
    font-size: 12px;
}

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

/* 按钮样式 */
.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}
.btn-danger:hover {
    background: #c0392b;
}