/* 题目库管理对话框样式 - 与图片资源管理保持一致的配色和宽度 */

.problem-library-content {
    width: 90vw;
    max-width: 1280px;  /* 与图片资源管理一致 */
    overflow: hidden;
    padding: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* 标题栏 */
.problem-library-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 24px;
    padding-right: 60px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.problem-library-header h2 {
    color: #ffffff;
    font-size: 24px;
    margin: 0;
    font-weight: 600;
}

.problem-library-header .close-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.problem-library-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* 左右布局容器 */
.problem-library-layout {
    display: flex;
    min-height: 600px;
    max-height: 70vh;
}

/* 左侧分类导航 */
.problem-library-sidebar {
    width: 200px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-category {
    display: flex;
    align-items: center;
    padding: 12px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 10px;
    color: #4b5563;
}

.sidebar-category:hover {
    background: #e5e7eb;
}

.sidebar-category.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 500;
}

.category-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.category-name {
    flex: 1;
    font-size: 14px;
}

.category-count {
    font-size: 12px;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-category.active .category-count {
    background: rgba(255, 255, 255, 0.2);
}

/* 右侧主要内容 */
.problem-library-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

/* 搜索和筛选 */
.library-controls {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #2d3748;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #2d3748;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 题目网格 */
.problem-grid {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(4, 223.334px);
    gap: 20px;
    justify-content: center;
}

/* 题目卡片 */
.problem-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    width: 223.334px;
    height: 310.667px;
    flex-shrink: 0;
}

.problem-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

/* 围棋题缩略图区域 */
.go-problem-thumbnail {
    width: 223.334px;
    height: 223.334px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.go-problem-thumbnail > div {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

.go-problem-thumbnail canvas {
    /* 不使用100%宽高，让GoBoard根据cellSize自动设置正确的尺寸 */
    display: block !important;
}

/* 选择题图标区域 */
.choice-problem-icon {
    width: 223.334px;
    height: 223.334px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px; /* 图标大小 */
    flex-shrink: 0;
}

.choice-problem-icon.single-choice {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.choice-problem-icon.multi-choice {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

/* 题目信息 */
.problem-card-info {
    padding: 8px 12px; /* 减小内边距 */
    flex: 0 0 auto; /* 不自动扩展，根据内容定高 */
    display: flex;
    flex-direction: column;
}

.problem-card-title {
    font-size: 13px; /* 减小字体 */
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px; /* 减小间距 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3; /* 减小行高 */
}

.problem-card-meta {
    display: flex;
    gap: 4px; /* 减小间距 */
    font-size: 10px; /* 减小字体 */
    color: #718096;
    flex-wrap: wrap;
}

.problem-card-meta span {
    background: #f7fafc;
    padding: 1px 4px; /* 减小内边距 */
    border-radius: 3px;
    line-height: 1.2; /* 减小行高 */
}

.problem-card-meta .difficulty-level1,
.problem-card-meta .difficulty-level2,
.problem-card-meta .difficulty-level3 {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.problem-card-meta .difficulty-level4,
.problem-card-meta .difficulty-level5,
.problem-card-meta .difficulty-level6 {
    background: rgba(255, 193, 7, 0.1);
    color: #FFC107;
}

.problem-card-meta .difficulty-level7,
.problem-card-meta .difficulty-level8,
.problem-card-meta .difficulty-level9,
.problem-card-meta .difficulty-level10 {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

/* 题目操作按钮 */
.problem-card-actions {
    padding: 6px 8px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 4px;
    justify-content: center;
}

.problem-card-btn {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    color: #718096;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    line-height: 1.2;
}

.problem-card-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.problem-card-btn.delete {
    flex: 0;
    min-width: 28px;
    padding: 4px 0;
    border: none;
    background: transparent;
    color: #f44336;
    font-size: 14px;
}

.problem-card-btn.delete:hover {
    background: rgba(244, 67, 54, 0.1);
}

/* 底部 */
.library-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.problem-count {
    font-size: 13px;
    color: #6b7280;
}

/* 分页控件 */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #4b5563;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(.disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: transparent;
}

.pagination-btn.active:hover {
    opacity: 0.9;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f3f4f6;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: #9ca3af;
    font-size: 13px;
}

/* 底部操作按钮 */
.library-actions {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    background: #f9fafb;
}

.library-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 0 0 auto;  /* 防止按钮自动扩展 */
    white-space: nowrap;  /* 防止文字换行 */
    width: auto !important;  /* 覆盖响应式设置的width: 100% */
}

.library-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.library-actions .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #684292 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.library-actions .btn-secondary {
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.library-actions .btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .problem-library-layout {
        flex-direction: column;
    }

    .problem-library-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .sidebar-category {
        padding: 8px 12px;
        flex-shrink: 0;
    }

    .problem-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
        gap: 12px;
        justify-content: center;
    }

    .problem-card {
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
    }

    .go-problem-thumbnail,
    .choice-problem-icon {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .library-controls {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .library-actions {
        flex-direction: column;
        align-items: stretch;  /* 小屏幕下按钮可以拉伸 */
    }

    .library-actions button {
        width: 100%;
        flex: 1 1 auto;  /* 小屏幕下允许按钮扩展 */
    }
}

/* 滚动条美化 */
.problem-library-sidebar::-webkit-scrollbar,
.problem-grid::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.problem-library-sidebar::-webkit-scrollbar-track,
.problem-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.problem-library-sidebar::-webkit-scrollbar-thumb,
.problem-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.problem-library-sidebar::-webkit-scrollbar-thumb:hover,
.problem-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
