/* ==========================================================================
   User.css - 用户端核心样式表
   描述：这是项目的"默认皮肤"，采用深色沉浸式设计。
   核心技术点：
   1. CSS 变量管理颜色系统。
   2. Glassmorphism (玻璃拟态)：背景模糊 + 半透明白边框。
   3. 动态背景：使用 animation 移动渐变背景的位置。
   ========================================================================== */

:root {
    /* ----------------------------------------------------------------------
       1. 全局变量定义 (CSS Variables)
       提示：修改这里可以一键换肤
       ---------------------------------------------------------------------- */

    /* [布局] 侧边栏宽度 - JS交互中若需折叠侧边栏，通常会操作此变量 */
    --sidebar-width: 260px;

    /* [配色] 紫色系为主，青色为辅 (Cyberpunk 风格) */
    --primary-color: #6c5ce7;
    --accent-color: #00cec9;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* [特效] 玻璃拟态核心参数 - 这一组变量决定了"玻璃"的质感 */
    --glass-bg: rgba(20, 20, 30, 0.6);             /* 整体背景：深色半透明 */
    --glass-border: 1px solid rgba(255, 255, 255, 0.15); /* 磨砂边框：极细的半透明白线 */
    --glass-panel-bg: rgba(255, 255, 255, 0.05);   /* 面板：比背景稍亮的微透层 */
    --card-bg-hover: rgba(255, 255, 255, 0.1);     /* 交互：悬停时进一步提亮 */

    /* [文字] 必须使用浅色字以适配深色背景 */
    --text-light: #ffffff;
    --text-muted: #b2bec3;                         /* 次要信息用灰色，降低视觉干扰 */
    --text-dark-on-light: #2d3436;

    /* [阴影] 弥散阴影，增加空间深度感 */
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   2. 全局基础样式 (Reset & Global)
   ========================================================================== */
body {
    font-family: 'Noto Sans SC', sans-serif;
    margin: 0;
    overflow-x: hidden; /* 防止因为动画或阴影出现横向滚动条 */

    /* --- 动态流光渐变背景核心逻辑 ---
     * 原理：创建一个 400% 大小的背景图，然后用 animation 移动它的位置(position)，
     * 从而产生颜色缓缓流动的效果。
     */
    background: linear-gradient(125deg, #1e272e 0%, #0984e3 50%, #6c5ce7 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite; /* 15秒一个循环 */

    color: var(--text-light);
    min-height: 100vh;
}

/* 背景流动动画关键帧 */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; } /* 移动到中间 */
    100% { background-position: 0% 50%; }  /* 回到起点 */
}

/* 通用重置 */
a { text-decoration: none; color: inherit; }
ul { padding: 0; margin: 0; list-style: none; }
a:hover { color: inherit; }

/* ==========================================================================
   3. 核心布局框架 (Layout Framework)
   ========================================================================== */
.app-container {
    display: flex; /* Flexbox 左右布局 */
    min-height: 100vh;
}

/* --- 侧边栏 (Sidebar) --- */
.sidebar {
    width: var(--sidebar-width);
    /* * 玻璃特效关键点：backdrop-filter *
     * 它会模糊该元素 *背后* 的内容，营造出磨砂玻璃感。
     * 必须配合半透明 background 使用。
     */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: var(--glass-border);

    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column; /* 垂直排列菜单 */

    /* 固定定位：侧边栏不动，右侧内容滚动 */
    position: fixed;
    height: 100vh;
    z-index: 1000; /* 确保层级最高 */
    left: 0; top: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* 平滑过渡，用于折叠动画 */
}

/* 品牌 Logo */
.brand-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 3rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    text-shadow: 0 0 15px rgba(108, 92, 231, 0.5); /* 文字发光 (Neon Glow) */
}

/* 导航菜单容器 */
.nav-menu {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* 撑开中间空间，把底部元素(如果有)挤下去 */
}

.nav-item { margin-bottom: 0.8rem; }

/* 导航链接样式 */
.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link-custom i { width: 25px; margin-right: 10px; font-size: 1.1rem; }

/* 导航链接悬停/激活状态 */
.nav-link-custom:hover, .nav-link-custom.active {
    color: #fff;
    /* 激活态背景：半透明渐变条 */
    background: linear-gradient(90deg, rgba(108, 92, 231, 0.8) 0%, rgba(108, 92, 231, 0.2) 100%);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    transform: translateX(5px); /* 细微交互：向右弹一下 */
}

/* --- 主内容区域 (Main Content) --- */
.main-content {
    flex: 1; /* 占据剩余宽度 */
    margin-left: var(--sidebar-width); /* *关键*：给固定定位的侧边栏留出位置 */
    padding: 2rem;
    position: relative;
}

/* ==========================================================================
   4. 首页特定组件 (Home Components)
   ========================================================================== */

/* --- 顶部工具栏 (Top Header) --- */
.top-header {
    display: flex;
    justify-content: space-between; /* 两端对齐：左搜素，右头像 */
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.05); /* 极淡的背景 */
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: var(--glass-border);
}

/* 搜索框组件 */
.search-wrapper {
    position: relative;
    width: 400px;
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2); /* 深色半透明底 */
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px; /* 胶囊形状 */
    padding: 10px 20px 10px 45px; /* 左padding留给图标 */
    color: #fff;
    transition: all 0.3s;
}

.search-input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color); /* 聚焦变青色 */
    box-shadow: 0 0 15px rgba(0, 206, 201, 0.3); /* 青色光晕 */
    outline: none;
}

.search-icon {
    position: absolute;
    left: 15px; top: 50%;
    transform: translateY(-50%); /* 垂直居中技巧 */
    color: var(--text-muted);
}

/* --- 英雄区/Banner (Hero Section) --- */
.hero-card {
    background: url('https://images.unsplash.com/photo-1517694712202-14dd9538aa97?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') center/cover;
    border-radius: 24px;
    padding: 4rem;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* 黑色遮罩层，提升文字可读性 */
.hero-overlay {
    position: absolute; inset: 0; /* 铺满父容器 */
    background: linear-gradient(90deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}
.hero-content { position: relative; z-index: 2; } /* 确保文字在遮罩之上 */

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    /* *文字渐变技巧* */
    background: linear-gradient(to right, #fff, #74b9ff);
    -webkit-background-clip: text; /* 仅在文字笔画区域显示背景 */
    -webkit-text-fill-color: transparent; /* 文字本身透明 */
    animation: slideInLeft 1s ease;
}

/* --- 课程卡片 (Course Card) --- */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}
.section-title i { color: #ff7675; margin-right: 10px; animation: bounce 2s infinite; /* 图标跳动 */ }

.course-card-new {
    background: rgba(255, 255, 255, 0.08);
    border: var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 弹性贝塞尔曲线，带有回弹感 */
    height: 100%;
    position: relative;
}

/* 课程卡片悬停特效 */
.course-card-new:hover {
    transform: translateY(-10px) scale(1.02); /* 上浮 + 轻微放大 */
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border-color: rgba(255,255,255,0.3);
}

.course-img-wrapper {
    height: 160px;
    overflow: hidden; /* 必须隐藏溢出，否则图片放大时会超出圆角 */
    position: relative;
}

.course-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.course-card-new:hover .course-img { transform: scale(1.1); /* 图片内部缓慢放大 */ }

.card-body-new { padding: 1.2rem; }

.card-title-new {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 标题太长则显示省略号... */
}

/* 课程描述：限制2行 */
.card-text-new {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    height: 42px; /* 1.5 * 14px * 2行 approx */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制显示2行 */
    -webkit-box-orient: vertical;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.price-badge { background: #ff7675; color: white; padding: 2px 8px; border-radius: 4px; font-weight: bold; font-size: 0.9rem; }
.free-badge { background: #00b894; color: white; padding: 2px 8px; border-radius: 4px; font-weight: bold; font-size: 0.9rem; }

/* --- 鼠标跟随特效 (Cursor Trail) --- */
#cursor-trail {
    position: fixed;
    top: 0; left: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px 10px rgba(108, 92, 231, 0.4); /* 紫色光晕 */
    pointer-events: none; /* *关键*：必须让鼠标穿透此层，否则无法点击下方的按钮 */
    z-index: 9999;
    transform: translate(-50%, -50%); /* 中心对齐鼠标尖端 */
    transition: width 0.2s, height 0.2s;
    mix-blend-mode: screen; /* 混合模式，让光晕在深色背景上更亮 */
}

/* ==========================================================================
   5. 个人中心/用户主页 (User Profile)
   ========================================================================== */
.glass-panel {
    background: var(--glass-panel-bg);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 20px;
    color: #fff;
    box-shadow: var(--card-shadow);
}

/* 个人资料背景封面 */
.profile-cover {
    height: 200px;
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    border-radius: 20px 20px 0 0;
    position: relative;
    margin-bottom: 80px; /* 为下方悬浮的头像留出空间 */
    opacity: 0.8;
}

/* 个人头像：悬浮在封面与内容之间 */
.profile-avatar {
    width: 120px; height: 120px;
    border: 4px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    background: #2d3436;
    /* 绝对定位实现"压线"效果 */
    position: absolute;
    bottom: -60px; /* 一半在封面外 */
    left: 50%;
    transform: translateX(-50%); /* 水平居中 */
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #b2bec3;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 10;
}

/* 发布的文章卡片 */
.article-card {
    background: var(--glass-panel-bg);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    height: 100%;
    transition: 0.3s;
    display: block;
}
.article-card:hover {
    transform: translateY(-5px);
    background: var(--card-bg-hover);
    border-color: var(--primary-color);
    color: #fff;
}
.article-card h5 a { color: white; text-decoration: none; }
.article-card a:hover { color: var(--accent-color); }

/* --- 聊天/私信模态框 (Chat Modal - Dark Mode) --- */
.modal-content { background: #2d3436; color: white; border: var(--glass-border); }
.modal-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.modal-footer, .chat-input-area { border-top: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); }
.btn-close { filter: invert(1); /* Bootstrap关闭按钮默认是黑叉，反色成白叉适配深色底 */ }

.chat-modal-body { height: 400px; display: flex; flex-direction: column; background: rgba(0,0,0,0.2); }
.chat-message { margin-bottom: 15px; display: flex; flex-direction: column; }
.chat-message.self { align-items: flex-end; /* Flex布局：自己发的消息靠右 */ }
.chat-message.other { align-items: flex-start; /* Flex布局：对方发的消息靠左 */ }

/* 聊天气泡通用样式 */
.bubble {
    max-width: 75%; padding: 10px 15px; border-radius: 15px; font-size: 0.95rem; position: relative;
    word-wrap: break-word; white-space: pre-wrap;
}
/* 自己发的气泡样式 - 紫色背景 */
.self .bubble {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: #fff;
    border-bottom-right-radius: 2px; /* 制造一个小尖角感 */
}
/* 对方发的气泡样式 - 透明灰边框 */
.other .bubble {
    background: rgba(255,255,255,0.1); color: #e0e0e0;
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom-left-radius: 2px;
}

/* ==========================================================================
   6. 学习路线 (Learning Path)
   ========================================================================== */
.path-card {
    background: var(--glass-panel-bg);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 20px;
    transition: transform 0.3s;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.path-card:hover { transform: translateY(-5px); background: var(--card-bg-hover); border-color: var(--accent-color); }

/* 垂直时间轴 */
.timeline { position: relative; padding-left: 30px; border-left: 2px dashed rgba(255,255,255,0.2); margin-left: 10px; }
.timeline-item { position: relative; margin-bottom: 40px; }
/* 时间轴节点标记 (空心圆) */
.timeline-marker {
    position: absolute; left: -39px; top: 0;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent-color); border: 3px solid #fff;
    box-shadow: 0 0 10px var(--accent-color); /* 发光效果 */
}
/* 锁定状态（置灰/不可点） */
.step-locked .timeline-marker { background: #636e72; border-color: #b2bec3; box-shadow: none; }
.step-locked { opacity: 0.5; filter: grayscale(100%); pointer-events: none; }

/* ==========================================================================
   7. 排行榜 (Leaderboard)
   ========================================================================== */
.rank-col {
    background: var(--glass-panel-bg); backdrop-filter: blur(10px);
    border: var(--glass-border); border-radius: 20px; overflow: hidden; height: 100%;
}
.rank-header { padding: 1.5rem; text-align: center; font-weight: bold; border-bottom: var(--glass-border); }
.rank-item { padding: 1rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; }

/* 排名徽章 (圆圈数字) */
.rank-num {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.1); font-weight: bold; margin-right: 15px;
}
/* 前三名特殊配色 (金/银/铜) - 使用 !important 或更高权重覆盖默认色 */
.rank-1 { background: #f1c40f; color: #000; box-shadow: 0 0 15px rgba(241, 196, 15, 0.6); }
.rank-2 { background: #bdc3c7; color: #000; }
.rank-3 { background: #e67e22; color: #fff; }

/* ==========================================================================
   8. 答题页面 (Quiz Interface)
   ========================================================================== */
.glass-card {
    background: var(--glass-panel-bg); backdrop-filter: blur(10px);
    border: var(--glass-border); border-radius: 20px; padding: 2rem;
    color: white; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 悬浮倒计时 - 固定在右上角 */
.timer-box {
    position: fixed; top: 30px; right: 40px;
    background: rgba(220, 53, 69, 0.9); /* 红色警示 */
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.5);
    color: white; padding: 10px 25px; border-radius: 50px;
    font-weight: bold; z-index: 1050; font-family: monospace; font-size: 1.2rem;
    backdrop-filter: blur(5px);
}

/* 选项按钮样式重写 - 覆盖默认 radio/checkbox */
.form-check-input {
    background-color: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3);
}
.form-check-input:checked {
    background-color: var(--accent-color); border-color: var(--accent-color);
}
.form-check-label { cursor: pointer; opacity: 0.9; }
.question-item { border-bottom: 1px solid rgba(255,255,255,0.1); }

/* ==========================================================================
   9. 动画关键帧 (Keyframes)
   ========================================================================== */
/* 左侧滑入 - 用于标题进场 */
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } }
/* 上下跳动 - 用于图标指引 */
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-6px);} 60% {transform: translateY(-3px);} }