/* 全局样式 */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --accent: #f72585;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(67, 97, 238, 0.3);
}

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

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ==================== 侧边栏布局 ==================== */
body.sidebar-layout {
    display: flex;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-brand i {
    font-size: 1.6rem;
    color: var(--primary);
}

.sidebar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.2rem;
    cursor: pointer;
}

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 10px;
}

.sidebar-section-title {
    padding: 10px 25px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 25px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin: 2px 12px;
    border-radius: 8px;
}

.sidebar-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-link.active {
    color: #fff;
    background: var(--sidebar-active);
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.sidebar-user-avatar {
    font-size: 2rem;
    color: rgba(255,255,255,0.8);
    line-height: 1;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-coins {
    color: #ffd700;
    font-size: 0.8rem;
}

/* 主内容区 */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #333;
    cursor: pointer;
    padding: 5px;
    margin-right: 15px;
}

.topbar-title {
    flex: 1;
}

.topbar-title h5 {
    color: #333;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-coins {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #333;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* 内容区 */
.content-wrapper {
    padding: 25px;
    flex: 1;
}

/* 移动端遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ==================== 卡片 ==================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* 主页面卡片 */
.hero-card {
    background: #fff;
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4361ee, #f72585);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: #6c757d;
    font-size: 1.1rem;
}

/* ==================== 按钮 ==================== */
.btn-primary {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3f37c9 0%, #4361ee 100%);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
    border: none;
    color: white;
    border-radius: 8px;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #b5179e 0%, #f72585 100%);
    color: white;
}

/* ==================== 表单 ==================== */
.form-control {
    border-radius: 8px;
    padding: 10px 14px;
    border: 1.5px solid #e0e0e0;
}

.form-control:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.15);
}

/* ==================== 特性卡片 ==================== */
.feature-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin: 0 auto 0.8rem;
}

.feature-icon.blue { background: rgba(67, 97, 238, 0.1); color: #4361ee; }
.feature-icon.pink { background: rgba(247, 37, 133, 0.1); color: #f72585; }
.feature-icon.green { background: rgba(76, 201, 240, 0.1); color: #4cc9f0; }

/* ==================== 表格 ==================== */
.table {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    color: #555;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: #f0f0f0;
}

.table-hover tbody tr:hover {
    background: #f8f9ff;
}

/* ==================== 分页 ==================== */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: none;
    color: #555;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
}

/* ==================== 文档卡片网格 ==================== */
.doc-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.doc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-card-title a {
    color: inherit;
    text-decoration: none;
}

.doc-card-title a:hover {
    color: var(--primary);
}

.doc-card-excerpt {
    color: #888;
    font-size: 0.85rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.doc-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #999;
}

.doc-card-actions {
    display: flex;
    gap: 6px;
}

.doc-card-actions .btn {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ==================== 文档内容 ==================== */
.doc-content {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-height: 300px;
}

.doc-content pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}

/* ==================== 文件列表 ==================== */
.file-item {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.file-item:hover {
    background: #f8f9ff;
    transform: translateX(3px);
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    font-size: 1.1rem;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.8rem;
    color: #999;
}

.file-actions {
    display: flex;
    gap: 6px;
}

/* ==================== 管理后台 ==================== */
.admin-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-stat-card h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.admin-stat-card small {
    color: #999;
    font-size: 0.85rem;
}

.admin-stat-card i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    display: block;
}

/* 页面标题栏 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h3 {
    font-weight: 700;
    color: #333;
    margin-bottom: 0;
}

/* ==================== Toast 通知 ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 15px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-card {
        padding: 2rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 769px) {
    .sidebar-close,
    .topbar-toggle {
        display: none !important;
    }
}

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
    color: #ddd;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 20px;
}
