/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #334155;
    background-color: #f1f5f9;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 300px;
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-in-out;
    overflow-x: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}

.sidebar.collapsed {
    width: 50px !important;
    overflow-y: hidden;
}

.sidebar.collapsed .menu-group,
.sidebar.collapsed .tree-container {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background-color: #f1f5f9;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
}

.sidebar-toggle:hover {
    background-color: #e0f2fe;
}

/* 菜单组样式 */
.menu-group {
    margin-left: 15px;
    margin-top: 50px;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.menu-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
    margin-bottom: 15px;
    cursor: pointer;
}

.menu-group-header:hover {
    background-color: #e0f2fe;
}

.menu-group-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}

.menu-item {
    margin-bottom: 16px;
}

.menu-item:last-child {
    margin-bottom: 0;
}

.menu-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.875rem;
}

.menu-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    color: #334155;
    transition: all 0.2s ease;
}

.menu-item select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    outline: none;
}

/* 树形容器样式 */
.tree-container {
    margin-left: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tree-header {
    padding: 15px 20px;
    font-weight: 500;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-size: 14px;
    color: #334155;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f1f5f9;
    overflow: hidden;
    padding: 1.5rem;
    transition: margin-left 0.3s ease-in-out;
}

/* 可折叠组件样式 */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transition: all 0.2s ease;
    cursor: pointer;
}

.toggle-collapse:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 图标旋转动画 */
.toggle-collapse svg {
    transition: transform 0.3s ease;
}

.collapsed .toggle-collapse svg {
    transform: rotate(180deg);
}

/* 知识点模块折叠时的样式 */
.knowledge-list.collapsed {
    max-height: 0 !important;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
    opacity: 0.6;
    overflow: hidden;
}

.type-list.collapsed {
    max-height: 0 !important;
    margin: 0;
    padding: 0;
    opacity: 0.6;
    overflow: hidden;
}

/* 知识点模块 */
.knowledge-points {
    flex: 0 0 auto;
    padding: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: none;
    transition: all 0.3s ease;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-radius: 6px;
}

.knowledge-list {
    padding: 12px 16px;
    max-height: 100px;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    transition: all 0.3s ease;
}

/* 题型选择器样式 */
.question-type-selector {
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.type-list {
    padding: 12px 16px;
    max-height: 100px;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    transition: all 0.3s ease;
}

/* 当收起时题型选择器的样式 */
.question-type-selector.compact {
    flex: 0 0 auto;
    border: none;
    background-color: transparent;
}

.knowledge-category {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.category-name {
    font-weight: 600;
    color: #334155;
    font-size: 14px;
}

.select-all {
    color: #4f46e5;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.select-all:hover {
    text-decoration: underline;
}

.knowledge-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin: 2px 0;
    flex: 0 0 auto;
    transition: all 0.2s ease;
    background-color: #f8fafc;
}

.knowledge-item:hover {
    background-color: #e0f2fe;
    border-color: #bae6fd;
    transform: translateY(-2px);
}

.knowledge-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    border: 2px solid #94a3b8;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.knowledge-item.selected .knowledge-checkbox {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.knowledge-item.selected .knowledge-checkbox::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.knowledge-name {
    flex: 1;
    font-size: 14px;
    color: #475569;
}

/* 题目容器 */
.question-container {
    flex: 1;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.question-header {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
    border-radius: 8px 8px 0 0;
}

.question-count-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.question-count-item {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    background-color: #f1f5f9;
    border-radius: 16px;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.question-type {
    color: #475569;
    margin-right: 8px;
}

.question-total {
    color: #4f46e5;
    font-weight: 600;
}

.question-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.type-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin: 2px 0;
    flex: 0 0 auto;
    transition: all 0.2s ease;
    background-color: #f8fafc;
}

.type-item.available {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
    cursor: pointer;
}

.type-item.available:hover {
    background-color: #e0f2fe;
    border-color: #bae6fd;
    transform: translateY(-2px);
}

.type-item.selected {
    background-color: #eff6ff;
    border-color: #4f46e5;
    color: #1e40af;
    font-weight: 500;
}

.type-count {
    margin-left: 6px;
    font-weight: 500;
    background-color: #f1f5f9;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 12px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
    border-color: #2563eb;
}

.btn-primary:hover {
    background-color: #2563eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #6366f1;
    color: white;
    border-color: #4f46e5;
}

.btn-secondary:hover {
    background-color: #4f46e5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
    border-color: #d97706;
}

.btn-warning:hover {
    background-color: #d97706;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-light {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.btn-light:hover {
    background-color: #e5e7eb;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 新增所有操作按钮样式 */
.all-actions {
    margin-top: 15px;
    display: none;
    justify-content: center;
    flex-wrap: wrap;
}

/* 按钮图标样式 */
.button-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    stroke-width: 2;
    transition: transform 0.2s ease;
}

.btn:hover .button-icon {
    transform: scale(1.1);
}

/* 题目内容 */
.question-content {
    padding: 20px;
}

/* 答题区域 */
.answer-area {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    display: none;
}

.answer-title {
    margin-bottom: 10px;
    font-weight: 500;
    color: #334155;
}

.answer-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.answer-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.hint-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
}

/* 反馈区域 */
.feedback-area {
    margin-top: 15px;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    display: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.feedback-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    box-shadow: 0 2px 8px rgba(167, 243, 208, 0.5);
}

.feedback-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    box-shadow: 0 2px 8px rgba(254, 202, 202, 0.5);
}

.feedback-hint {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    box-shadow: 0 2px 8px rgba(191, 219, 254, 0.5);
}

.hint-container {
    margin-top: 5px;
}

.hint-content {
    margin-top: 8px;
    line-height: 1.6;
    color: #334155;
}

.hint-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    color: #6366f1;
}

/* 二级操作区 */
.secondary-actions {
    margin-top: 15px;
    display: none;
}

/* 错误信息 */
.error {
    padding: 12px 16px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #b91c1c;
    margin-bottom: 16px;
    display: none;
}

/* 水平滚动容器 */
.horizontal-scroll {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 树项目样式 */
.tree-item {
    position: relative;
    padding: 8px 10px 8px 28px;
    margin: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    line-height: 1.5;
    white-space: nowrap;
    user-select: none;
    font-weight: 500;
}

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

.tree-item.selected, 
.tree-item.active {
    background-color: #e0f2fe;
    color: #0369a1;
    font-weight: 600;
}

/* 箭头图标样式 */
.tree-item.has-children::before {
    content: '▶';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #64748b;
    transition: transform 0.2s ease;
    z-index: 3;
    background-color: transparent;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tree-item.has-children.expanded::before {
    transform: translateY(-50%) rotate(90deg);
}

/* 子项容器样式 */
.tree-item .children {
    display: none;
    position: relative;
    margin-top: 2px;
}

.tree-item.expanded > .children {
    display: block;
}

/* 子项缩进和连接线样式 */
.tree-item .children .tree-item {
    padding-left: 28px;
    margin-left: 15px;
    position: relative;
    margin-top: 3px;
    margin-bottom: 3px;
}

/* 垂直连接线 */
.tree-item .children .tree-item::before {
    content: "";
    position: absolute;
    left: -15px;
    top: 0;
    height: 100%;
    width: 1.5px;
    background-color: #cbd5e1;
}

/* 水平连接线 */
.tree-item .children .tree-item::after {
    content: "";
    position: absolute;
    left: -15px;
    top: 50%;
    width: 15px;
    height: 1.5px;
    background-color: #cbd5e1;
}

/* 最后一个子项的特殊处理 - 垂直线只到中间 */
.tree-item .children .tree-item:last-child::before {
    height: 50%;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .question-count-item {
        font-size: 12px;
        padding: 3px 10px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* 当题型选择器收起时的样式 */
.question-type-selector.compact .type-list {
    display: none;
}

/* 修改collapsible-header样式 */
#questionTypesHeader {
    background-color: #f8fafc;
    border-radius: 6px;
    margin-bottom: 0;
    transition: all 0.2s ease;
}

#questionTypesHeader:hover {
    background-color: #e0f2fe;
}

/* 知识点头部样式优化 */
#knowledgePointsHeader {
    background-color: #f8fafc;
    border-radius: 6px;
    margin-bottom: 0;
    transition: all 0.2s ease;
}

#knowledgePointsHeader:hover {
    background-color: #e0f2fe;
}

/* 筛选分区样式 */
.filter-section {
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.section-header:hover {
    background-color: #e0f2fe;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

/* 收起筛选分区时的样式 */
.filter-section.collapsed-section .section-header {
    border-bottom: none;
    border-radius: 8px;
}

.filter-section.collapsed-section {
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    border-color: #e2e8f0;
}

/* 增加动画效果 */
.toggle-collapse svg {
    transition: transform 0.3s ease;
}

.collapsed .toggle-collapse svg {
    transform: rotate(180deg);
}

/* 知识点模块在筛选分区内的样式调整 */
.filter-section .knowledge-points {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0;
    box-shadow: none;
    display: block;
}

/* 题型选择容器样式调整 */
.filter-section .question-type-container {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    overflow: hidden;
}

/* 题型计数列表在筛选分区内的样式 */
.filter-section .question-count-list {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

/* 筛选分区内的题型选择器 */
.filter-section .question-type-selector {
    border: none;
    border-radius: 0;
    margin-right: 0;
}

/* 筛选分区折叠时的最小高度 */
.filter-section.collapsed-section {
    min-height: 50px;
}

/* 获取题目按钮组 */
.filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
}

/* 查询按钮组 */
.query-actions {
    margin-bottom: 10px;
    display: flex;
    justify-content: flex-end;
}

.filter-content {
    padding: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-content.collapsed {
    height: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border-top: none;
    opacity: 0;
    overflow: hidden;
}

/* 侧边栏可折叠组件样式 */
.menu-group-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.menu-group-content.collapsed {
    max-height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.tree-content {
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tree-content.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* 填空题样式 */
.blank-input {
    width: 120px;
    max-width: 120px;
    height: 30px;
    padding: 4px 8px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin: 0 5px;
    display: inline-block;
    vertical-align: middle;
}

.blank-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    outline: none;
}

.question-blanks {
    margin: 10px 0;
}

.tree-item.has-children.expanded::before {
    transform: translateY(-50%) rotate(90deg);
}

/* 历史记录UI样式 */
.history-ui {
    display: flex;
    align-items: center;
    margin-left: 15px;
    gap: 10px;
}

.viewed-count {
    font-size: 14px;
    color: #666;
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

.viewed-count.milestone {
    color: #2563eb;
    background-color: #dbeafe;
    font-weight: bold;
}

.clear-history-btn {
    background-color: #f56c6c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.clear-history-btn:hover {
    background-color: #e74c3c;
}

/* 通知栏样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #44b0ff;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* 媒体查询: 在小屏幕上调整历史记录UI */
@media (max-width: 768px) {
    .history-ui {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 10px;
        margin-left: 0;
    }
    
    .clear-history-btn {
        width: 100%;
        margin-top: 5px;
    }
}

.answer-compare {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #f8fafc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hint-container {
    margin-top: 5px;
    padding: 10px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.7);
}

.hint-container strong {
    display: block;
    margin-bottom: 8px;
    color: #4f46e5;
    font-size: 16px;
}

.hint-content {
    margin-top: 8px;
    line-height: 1.6;
    color: #334155;
    padding: 5px;
}

.hint-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    color: #6366f1;
    font-size: 16px;
}

.hint-loading strong {
    display: inline-flex;
    align-items: center;
}

.hint-loading strong::after {
    content: "";
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #6366f1;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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