/* ====== 网页端自定义样式 ====== */

/* ====== CSS变量系统 ====== */
:root {
    /* 颜色系统 - 紫色主题 */
    --primary-color: #667eea;
    --primary-light: #8b5cf6;
    --primary-dark: #5b4fcf;
    --secondary-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --purple-color: #8b5cf6;
    --pink-color: #ec4899;

    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #f5f3ff 100%);

    /* 文字颜色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;

    /* 边框颜色 */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* 布局尺寸 */
    --sidebar-width: 280px;
    --card-radius: 16px;

    /* 阴影系统 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* 渐变系统 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* 动画过渡 */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ====== 侧边栏样式 ====== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(102, 126, 234, 0.3);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
    transform: translateX(4px);
}

.sidebar-menu a i {
    margin-right: 12px;
    font-size: 1.2rem;
}

/* ====== 主内容区域 ====== */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    background: var(--bg-gradient);
    transition: var(--transition);
}

/* ====== 顶部栏 ====== */
.topbar {
    background: white;
    padding: 18px 30px;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 20px;
    z-index: 900;
}

/* ====== 统计卡片 ====== */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: white;
}

.stats-icon.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-icon.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.stats-icon.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-icon.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stats-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
    color: var(--text-primary);
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.stats-change {
    font-size: 0.75rem;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 500;
    background: transparent;
}

.stats-change.positive {
    color: #28a745;
}

.stats-change.negative {
    color: #dc3545;
}

/* ====== 欢迎区域 ====== */
.welcome-section {
    background: var(--gradient-primary);
    color: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.welcome-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-section p {
    margin: 0;
    opacity: 0.9;
}

/* ====== 用户信息 ====== */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ====== 侧边栏切换按钮 ====== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
    padding: 8px;
    border-radius: 8px;
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* ====== 加载状态 ====== */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: var(--card-radius);
}

/* ====== 响应式设计 ====== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .stats-card {
        padding: 14px 16px;
    }

    .stats-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .stats-value {
        font-size: 1.4rem;
    }

    .stats-label {
        font-size: 0.8rem;
    }

    .stats-change {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .topbar {
        padding: 12px 16px;
        margin-bottom: 16px;
        position: static;
    }

    .welcome-section {
        padding: 16px 20px;
        margin-bottom: 20px;
    }

    .welcome-section h3 {
        font-size: 1.3rem;
    }

    .welcome-section p {
        font-size: 0.85rem;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }
}

/* ====== 动画效果 ====== */
.card,
.stats-card,
.btn,
.sidebar-menu a {
    transition: var(--transition);
}

.card:hover,
.stats-card:hover {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== 滚动条美化 ====== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ====== 打印样式 ====== */
@media print {
    .sidebar,
    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar {
        box-shadow: none;
    }
}

/* ====== 欢迎区域 ====== */
.welcome-section {
    background: var(--gradient-primary);
    color: white;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.welcome-section::before,
.welcome-section::after {
    display: none;
}

.welcome-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.welcome-section p {
    margin: 0;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ====== 用户信息 ====== */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ====== 侧边栏切换按钮 ====== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
    padding: 8px;
    border-radius: 8px;
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* ====== 加载状态 ====== */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: var(--card-radius);
}

/* ====== 响应式设计 ====== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .stats-card {
        padding: 14px 16px;
    }

    .stats-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .stats-value {
        font-size: 1.4rem;
    }

    .stats-label {
        font-size: 0.8rem;
    }

    .stats-change {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .topbar {
        padding: 12px 16px;
        margin-bottom: 16px;
        position: static;
    }

    .welcome-section {
        padding: 16px 20px;
        margin-bottom: 20px;
    }

    .welcome-section h3 {
        font-size: 1.3rem;
    }

    .welcome-section p {
        font-size: 0.85rem;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }
}

/* ====== 动画效果 ====== */
.card,
.stats-card,
.btn,
.sidebar-menu a {
    transition: var(--transition);
}

.card:hover,
.stats-card:hover {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== 滚动条美化 ====== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ====== 打印样式 ====== */
@media print {
    .sidebar,
    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar {
        box-shadow: none;
    }
}
