/**
 * 游戏化学习进度条样式
 */

/* 进度条容器 - 在手机容器内header下方 */
.learning-progress-bar {
    position: relative;
    width: 100%;
    height: 50px; /* 默认单问高度，多问时JS动态设置 */
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e2e8f0;
    z-index: 999;
    overflow-x: auto; /* 允许横向滚动（如果内容太宽） */
    overflow-y: hidden; /* 隐藏纵向滚动条 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    transition: height 0.3s ease; /* 高度变化动画 */
    /* 完全隐藏滚动条（保持滚动功能） */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* 隐藏 Webkit 滚动条 */
.learning-progress-bar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* 进度条轨道 */
.progress-track {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 100%; /* 确保至少占满容器宽度 */
    height: 100%;
    padding: 0 20px;
    justify-content: space-between; /* 首尾固定，中间均匀分布 */
    overflow: visible; /* 允许放大镜显示在外面 */
    box-sizing: border-box;
}

/* 节点基础样式 */
.progress-node {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 2;
}

/* 题目节点 */
.progress-node.question-node {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    min-width: 36px;
    width: 36px; /* 固定宽度 */
    height: 36px;
    font-size: 16px;
    flex-shrink: 0; /* 不允许缩小 */
    overflow: visible; /* 允许放大镜显示在外面 */
}

/* 步骤节点 */
.progress-node.step-node {
    background: #e2e8f0;
    color: #64748b;
    border: 2px solid #cbd5e1;
    flex-shrink: 1; /* 允许缩小 */
    min-width: 24px; /* 最小宽度 */
    min-height: 24px; /* 最小高度，保持圆形 */
    font-size: clamp(10px, 3vw, 14px); /* 字体自适应：最小10px，最大14px */
}

/* 答案节点 */
.progress-node.answer-node {
    background: #fef3c7;
    color: #d97706;
    border: 2px solid #fbbf24;
    flex-shrink: 1; /* 允许缩小 */
    min-width: 26px; /* 最小宽度（比步骤稍大） */
    min-height: 26px; /* 最小高度，保持圆形 */
    font-size: clamp(12px, 3.5vw, 16px); /* 字体自适应：最小12px，最大16px */
}

/* 总结节点 */
.progress-node.summary-node {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    min-width: 36px;
    width: 36px; /* 固定宽度 */
    height: 36px;
    font-size: 16px;
    flex-shrink: 0; /* 不允许缩小 */
}

/* 节点状态 - 锁定 */
.progress-node.locked {
    background: #f1f5f9;
    color: #cbd5e1;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 节点状态 - 学习中 */
.progress-node.learning {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2),
                0 2px 12px rgba(59, 130, 246, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2),
                    0 2px 12px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.1),
                    0 2px 16px rgba(59, 130, 246, 0.6);
    }
}

/* 节点状态 - 已完成 */
.progress-node.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* 自主模式：不显示勾勾，只显示绿色点亮状态 */
.progress-node.completed::after {
    content: none;
}

/* 放大镜图标叠加在题目节点上 */
.magnifier-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 10;
    pointer-events: none; /* 不阻挡节点点击 */
}

/* 移动端适配 */
@media (max-width: 640px) {
    .magnifier-icon {
        width: 16px;
        height: 16px;
        font-size: 9px;
        bottom: -2px;
        right: -2px;
    }
}

/* 节点状态 - 有疑问 */
.progress-node.confused {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2),
                0 2px 12px rgba(245, 158, 11, 0.4);
    animation: warning-ripple 2s ease-out infinite;
}

@keyframes warning-ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4),
                    0 2px 12px rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0),
                    0 2px 12px rgba(245, 158, 11, 0.4);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0),
                    0 2px 12px rgba(245, 158, 11, 0.4);
    }
}

/* 节点状态 - 提问中 */
.progress-node.questioning {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border-color: #06b6d4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2),
                0 2px 12px rgba(6, 182, 212, 0.4);
    animation: bubble-float 2s ease-in-out infinite;
}

@keyframes bubble-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* 移除卡点放大效果 - 不再通过放大节点表示困难程度 */

/* 连接线 */
.progress-line {
    height: 2px;
    background: #cbd5e1;
    flex: 1; /* flexbox模式：自动填充空间 */
    min-width: 8px; /* flexbox模式：最小宽度 */
    z-index: 1;
}

/* Grid模式下的连接线 */
.multi-question-mode .progress-line {
    width: 100%; /* 填满Grid单元格 */
    flex: none; /* 取消flex行为 */
}

/* 问内连接线（flexbox中自适应） */
.progress-line.inner-line {
    flex: 0 0 auto; /* 不拉伸，固定宽度 */
    width: 12px; /* 问分支内的短连接线（更紧凑） */
    min-width: 12px;
    background: #cbd5e1;
}

/* 问间连接线 */
.progress-line.outer-line {
    flex: 1;
    background: #cbd5e1;
    height: 2px;
}

/* 已完成的连接线 */
.progress-line.completed {
    background: linear-gradient(to right, #10b981 0%, #059669 100%);
}

/* 问分支容器（多问模式） */
.question-branch {
    display: flex;
    align-items: center;
    gap: 0; /* 由连接线控制间距 */
    padding: 0;
    position: relative;
    transition: all 0.3s ease;
}

/* 问分支内的节点：稍微小一点以适应横向布局 */
.question-branch .progress-node {
    margin: 0 2px; /* 更紧凑的间距 */
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* 问分支内的步骤节点 */
.question-branch .progress-node.step-node {
    min-width: 24px;
    min-height: 24px;
    width: 28px;
    height: 28px;
}

/* 问分支内的答案节点 */
.question-branch .progress-node.answer-node {
    min-width: 26px;
    min-height: 26px;
    width: 30px;
    height: 30px;
}

/* 问标签 */
.question-branch .question-label-branch {
    margin: 0 2px 0 0; /* 更紧凑的右边距 */
}

/* 当前学习的问分支（移除背景，保持简洁） */
.question-branch.active {
    /* background: 已移除 */
}

/* 已完成的问分支（移除背景，保持简洁） */
.question-branch.completed {
    /* background: 已移除 */
}

/* 问标签（分支模式，显示在左侧） */
.question-label-branch {
    font-size: 11px;
    color: #64748b;
    background: #f8fafc;
    padding: 4px 8px; /* 减少左右内边距 */
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    text-align: center;
    line-height: 1.2;
}

.question-branch.active .question-label-branch {
    color: #3b82f6;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.question-branch.completed .question-label-branch {
    color: #10b981;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

/* 旧的问分组容器样式（单行模式，已弃用但保留兼容） */
.question-group {
    display: flex;
    align-items: center;
    position: relative;
    padding: 8px 12px;
    background: transparent;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.question-group.active {
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.question-group.completed {
    background: rgba(16, 185, 129, 0.05);
}

.question-label {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #64748b;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

.question-group.active .question-label {
    color: #3b82f6;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.question-group.completed .question-label {
    color: #10b981;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

/* 节点悬停效果 */
.progress-node:not(.locked):hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* 保持统一的悬停效果 */

/* 问分支间的分隔线（仅在多行时显示） */
.multi-question-mode .question-branch {
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
}

.multi-question-mode .question-branch:last-child {
    border-bottom: none;
}

/* 适配移动端 */
@media (max-width: 640px) {
    .learning-progress-bar {
        height: 45px;
    }
    
    /* 多问模式：自适应高度 */
    .learning-progress-bar.multi-question-mode {
        height: auto;
    }
    
    .progress-track {
        padding: 0 15px;
    }
    
    .progress-node {
        width: 28px;
        height: 28px;
        font-size: clamp(9px, 2.5vw, 12px);
    }
    
    .progress-node.step-node {
        min-width: 20px;
        min-height: 20px;
        font-size: clamp(8px, 2.5vw, 11px);
    }
    
    .progress-node.answer-node {
        min-width: 22px;
        min-height: 22px;
        font-size: clamp(10px, 3vw, 13px);
    }
    
    .progress-node.question-node,
    .progress-node.summary-node {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
        font-size: 14px;
    }
    
    .progress-line {
        min-width: 4px;
    }
    
    .question-label {
        font-size: 9px;
        padding: 1px 6px;
    }
    
    .question-label-branch {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* 加载状态 */
.progress-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    font-size: 14px;
    gap: 8px;
    white-space: nowrap;
}

.progress-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

