/**
 * 图片素材库对话框样式
 */

/* 遮罩层 */
.image-library-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 对话框 */
.image-library-dialog {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 头部 */
.image-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%);
}

.image-library-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.image-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;
}

.image-library-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* 主体内容 */
.image-library-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧边栏 */
.image-library-sidebar {
    width: 240px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

/* 分类过滤器 */
.category-filter {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
    color: #4b5563;
}

.category-filter:hover {
    background: #e5e7eb;
}

.category-filter.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 500;
}

.category-icon {
    font-size: 20px;
    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;
}

.category-filter.active .category-count {
    background: rgba(255, 255, 255, 0.2);
}

/* 上传区域 */
.upload-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.upload-btn {
    width: 100%;
    padding: 12px 16px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.upload-btn:active {
    transform: translateY(0);
}

.upload-icon {
    font-size: 18px;
}

/* 右侧主要内容 */
.image-library-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

/* 搜索栏 */
.image-library-search {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

/* 图片网格 */
.image-library-grid {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

/* 图片项 */
.image-library-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.image-wrapper:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 图标项特殊样式 */
.image-library-grid.icons-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
}

.image-wrapper.icon-item {
    aspect-ratio: 1;
}

.image-wrapper.icon-item img {
    object-fit: contain;
    padding: 6px;
}

/* 图标项的删除按钮 */
.image-wrapper.icon-item .delete-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
    top: 4px;
    right: 4px;
}

.image-wrapper.icon-item .delete-btn::before {
    font-size: 16px;
}

/* 覆盖层 */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-wrapper:hover .image-overlay {
    opacity: 1;
}

/* 使用按钮 */
.use-btn {
    padding: 8px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.use-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 删除按钮 */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    content: '×';
}

.image-wrapper:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

.delete-btn::before {
    content: '🗑';
    font-size: 14px;
    line-height: 1;
}

/* 图标项的删除按钮 */
.image-wrapper.icon-item .delete-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
    top: 4px;
    right: 4px;
}

.image-wrapper.icon-item .delete-btn::before {
    font-size: 12px;
}

/* 图片信息 */
.image-info {
    padding: 0 4px;
}

.image-name {
    font-size: 12px;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 底部 */
.image-library-footer {
    padding: 12px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-count {
    font-size: 13px;
    color: #6b7280;
}

/* 分页控件 */
.pagination-controls {
    display: flex;
    align-items: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    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;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .image-library-dialog {
        width: 95vw;
        height: 90vh;
    }

    .image-library-sidebar {
        width: 180px;
    }

    .image-library-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        padding: 16px;
    }

    .category-name {
        font-size: 13px;
    }
}

/* 滚动条美化 */
.image-library-sidebar::-webkit-scrollbar,
.image-library-grid::-webkit-scrollbar {
    width: 6px;
}

.image-library-sidebar::-webkit-scrollbar-track,
.image-library-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.image-library-sidebar::-webkit-scrollbar-thumb,
.image-library-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.image-library-sidebar::-webkit-scrollbar-thumb:hover,
.image-library-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
