/* 分类检查页面样式 */
.result-classification {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 32px;
    border: 1px solid #e5e7eb;
    max-width: none;
    width: 100%;
    position: relative;
    overflow: visible;
    margin: 0; /* 重置margin */
}

/* 当作为 main-layout 直接子元素时，突破容器限制，占据真正的全宽 */
.main-layout > .result-classification {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

/* 在分类检查模式下隐藏原始容器和表单区域 - 提高特异性 */
body.classification-review-mode .main-layout .container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    z-index: -1 !important;
}

/* 额外保护：确保表单区域在任何情况下都被隐藏 */
body.classification-review-mode .main-layout .analyze-form-section,
body.classification-review-mode .analyze-form-section {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    z-index: -1 !important;
}

/* 同时隐藏结果区域，因为分类界面已经移到main-layout */
body.classification-review-mode .main-layout .analyze-result-section,
body.classification-review-mode .analyze-result-section {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    z-index: -1 !important;
}

/* 确保分析内容区域在分类检查模式下不干扰布局 */
body.classification-review-mode .main-layout .analyze-content,
body.classification-review-mode .analyze-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* 确保整个分析主要部分在分类检查模式下隐藏 */
body.classification-review-mode .main-layout .analyze-main-section,
body.classification-review-mode .analyze-main-section {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* 确保分类检查界面在移动到main-layout后的基础样式 */
.main-layout > .result-classification .classification-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* 新的容器布局样式 */
.main-layout > .result-classification .classification-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* 移动端适配：隐藏侧边栏，使分类界面占据更多空间 */
@media (max-width: 768px) {
    body.classification-review-mode .gpt-sidebar {
        display: none !important;
    }
    
    body.classification-review-mode .main-layout {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* 当分类检查界面在原始位置时的样式 */
.result-content .result-classification {
    margin: 32px -40px; /* 抵消container的padding */
    width: calc(100% + 80px); /* 补偿左右margin */
}

/* 为大屏幕提供更好的视觉效果 */
@media (min-width: 1600px) {
    .result-classification {
        padding: 40px;
    }
    
    .result-content .result-classification {
        margin: 40px -40px;
    }
    
    .classification-layout {
        gap: 56px;
    }
}

/* 分类检查头部 */
.classification-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.classification-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #10a37f 0%, #047857 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.classification-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.classification-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.classification-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* 分类布局 */
.classification-layout {
    display: grid;
    grid-template-columns: 1fr min(380px, 40%);
    gap: 48px;
    align-items: start;
    min-height: 600px;
    max-width: none;
    width: 100%;
}

/* 分类检查页面整体布局 - 头部信息作为共用头部 */
.classification-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: none;
}

/* 分类内容区域 - 左右布局 */
.classification-content {
    display: grid;
    grid-template-columns: 1fr min(380px, 40%);
    gap: 48px;
    align-items: start;
    min-height: 600px;
    width: 100%;
}

.classification-main {
    min-width: 0;
}

.classification-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 为老旧浏览器提供fallback */
    position: -webkit-sticky; /* Safari需要前缀 */
    position: sticky;
    top: 90px; /* 导航栏高度80px + 10px间距，避免紧贴 */
    align-self: start;
    max-height: calc(100vh - 110px); /* 视口高度 - 导航栏高度 - 上下间距 */
    overflow-y: auto;
    transition: all 0.3s ease;
    padding-right: 4px; /* 为滚动条留出空间 */
}

/* 美化侧边栏滚动条 */
.classification-sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.classification-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.classification-sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 添加表单区块 */
.add-form-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.form-section-header svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.form-section-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-section-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #374151;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.add-form-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    box-shadow: none;
}

.add-form-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    box-shadow: none;
}

.add-form-btn svg {
    width: 16px;
    height: 16px;
}

/* 模块容器 */
.modules-container {
    min-height: 200px;
    margin-bottom: 20px;
}

/* 模块卡片 */
.module-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: visible;
    transition: all 0.2s;
}

.module-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.module-card.sortable-ghost {
    opacity: 0.5;
}

.module-card.sortable-chosen {
    background: #f3f4f6;
    border-color: #667eea;
}

/* 模块头部 */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    min-height: 48px;
}

.module-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.module-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #9ca3af;
    cursor: grab;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.module-drag-handle:active {
    cursor: grabbing;
    background: rgba(156, 163, 175, 0.1);
}

.module-drag-handle svg {
    width: 16px;
    height: 16px;
}

.module-title {
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    margin: 0;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: text;
    transition: all 0.2s;
}

.module-title:hover {
    background: white;
    border-color: #d1d5db;
}

.module-title:focus {
    outline: none;
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.module-actions {
    display: flex;
    gap: 8px;
}

.module-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    box-shadow: none;
}

.module-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    box-shadow: none;
}

.module-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* 模块统计 */
.module-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    font-size: 12px;
    color: #6b7280;
}

.module-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.module-stat-icon {
    width: 14px;
    height: 14px;
}

/* 课程列表 */
.courses-list {
    min-height: 40px;
    padding: 8px 16px 16px;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
    min-height: 40px;
}

.course-item:hover {
    border-color: #d1d5db;
    box-shadow: none;
}

.course-item.sortable-ghost {
    opacity: 0.5;
}

.course-item.sortable-chosen {
    background: #f8fafc;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.course-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #9ca3af;
    cursor: grab;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.course-drag-handle:active {
    cursor: grabbing;
    background: rgba(156, 163, 175, 0.1);
}

.course-drag-handle svg {
    width: 12px;
    height: 12px;
}

.course-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}

.course-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    padding: 2px 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: text;
    transition: all 0.2s;
}

.course-name:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.course-name:focus {
    outline: none;
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.course-credits {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.course-credits-input {
    width: 50px;
    padding: 2px 6px;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    cursor: text;
    transition: all 0.2s;
    text-align: center;
    height: auto;
    line-height: 1.2;
}

.course-credits-input:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.course-credits-input:focus {
    outline: none;
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.course-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 课程移动选择框 */
.course-move-select {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    color: #374151;
    cursor: pointer;
    width: 95px;
    max-width: 95px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.course-move-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.course-move-select:hover {
    border-color: #9ca3af;
}

/* 选择框选项样式 */
.course-move-select option {
    padding: 4px 8px;
    font-size: 12px;
    color: #374151;
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #dc2626;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    box-shadow: none;
}

.course-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    box-shadow: none;
}

.course-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* 空状态 */
.empty-module {
    text-align: center;
    padding: 24px;
    color: #9ca3af;
    font-size: 14px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    margin: 8px 0;
}

.empty-module-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    opacity: 0.5;
}

/* 操作按钮 */
.classification-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #065f46 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.confirm-btn svg {
    width: 16px;
    height: 16px;
}

.reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    box-shadow: none;
}

.reset-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    box-shadow: none;
}

.reset-btn svg {
    width: 16px;
    height: 16px;
}

/* 拖拽相关样式 */
.sortable-drag {
    opacity: 0.8;
    transform: rotate(5deg);
}

.sortable-drop-indicator {
    height: 2px;
    background: #667eea;
    margin: 4px 0;
    border-radius: 1px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .classification-layout {
        grid-template-columns: 1fr min(360px, 40%);
        gap: 40px;
    }
    
    .classification-content {
        grid-template-columns: 1fr min(360px, 40%);
        gap: 40px;
    }
    
    .classification-sidebar {
        max-height: calc(100vh - 130px);
        top: 100px;
    }
}

@media (max-width: 768px) {
    .classification-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .classification-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .classification-sidebar {
        order: -1;
        position: static;
        max-height: none;
        overflow-y: visible;
        top: auto;
        align-self: stretch;
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .result-classification {
        padding: 20px;
    }
    
    .result-content .result-classification {
        margin: 20px -20px; /* 抵消移动端container的padding */
        width: calc(100% + 40px); /* 补偿左右margin */
    }
    
    /* 移动端的 main-layout 子元素样式 */
    .main-layout > .result-classification {
        padding: 15px !important;
        border-radius: 8px;
    }
    
    /* 移动端内部布局调整 */
    .main-layout > .result-classification .classification-layout {
        max-width: none;
        padding: 0 10px;
    }
    
    .main-layout > .result-classification .classification-container {
        max-width: none;
        padding: 0 10px;
    }
    
    .classification-controls {
        flex-direction: column;
    }
    
    .add-module-btn,
    .add-course-btn {
        justify-content: center;
    }
    
    .course-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .course-actions {
        align-self: flex-end;
    }
    
    .classification-actions {
        flex-direction: column;
    }
    
    .confirm-btn,
    .reset-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .result-classification {
        padding: 16px;
    }
    
    .result-content .result-classification {
        margin: 16px -15px; /* 抵消小屏幕container的padding */
        width: calc(100% + 30px); /* 补偿左右margin */
    }
    
    /* 小屏幕的 main-layout 子元素样式 */
    .main-layout > .result-classification {
        padding: 16px !important;
        border-radius: 6px;
    }
    
    .classification-layout {
        gap: 16px;
    }
}

/* 操作提示样式 - 使用分析页面的usage-tip样式 */
.operation-tips {
    background: linear-gradient(135deg, #fef7f0 0%, #fef3ec 100%);
    border: 1px solid #fed7aa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 32px;
    position: relative;
    display: flex;
    gap: 16px;
}

.tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ea580c;
    font-size: 16px;
}

.tips-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #ea580c;
}

.tips-content {
    flex: 1;
}

.tips-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-top: 8px;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.tip-icon {
    width: 24px;
    height: 24px;
    color: #ea580c;
    flex-shrink: 0;
}

.tip-text {
    color: #9a3412;
    font-size: 14px;
    line-height: 1.5;
}

.tips-notice {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.tips-notice p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #dc2626;
}

.tips-notice strong {
    font-weight: 600;
    color: #991b1b;
}

/* 模态窗口关闭按钮样式 */
.tips-close {
    color: #666;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
    line-height: 1;
    padding: 0;
    margin: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 15px;
    right: 15px;
    font-family: Arial, sans-serif;
    user-select: none;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
}

.tips-close:hover {
    color: #ffffff;
    background: #dc3545;
    border-color: #dc3545;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(220,53,69,0.4);
}

.tips-close:active {
    transform: rotate(90deg) scale(0.95);
    box-shadow: 0 2px 8px rgba(220,53,69,0.4);
    transition: all 0.1s ease;
}

.tips-close:focus {
    box-shadow: 0 0 0 3px rgba(220,53,69,0.2), 0 4px 16px rgba(220,53,69,0.3);
}

/* 响应式提示 */
@media (max-width: 768px) {
    .tips-list {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .operation-tips {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .tips-header {
        font-size: 14px;
    }
    
    .tip-text {
        font-size: 13px;
    }
    
    .tips-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
}

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

.module-card {
    animation: fadeIn 0.3s ease-out;
}

.course-item {
    animation: fadeIn 0.2s ease-out;
}

/* 滚动条样式 */
.modules-container::-webkit-scrollbar {
    width: 6px;
}

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

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

.modules-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}