/**
 * 图库页面样式
 */

/* ========== 图库页面容器 ========== */
.gallery-page {
    padding: 24px;
    overflow-y: auto;
    height: 100%;
}

/* ========== 图库头部 ========== */
.gallery-header {
    margin-bottom: 32px;
}

.gallery-title {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

/* ========== 图库分区 ========== */
.gallery-section {
    margin-bottom: 40px;
}

.gallery-section-title {
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 16px 0;
}

/* ========== 图片网格 ========== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
}

/* 响应式列数 */
@media (max-width: 1600px) {
    .gallery-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1400px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-page {
        padding: 16px;
    }

    .gallery-title {
        font-size: 24px;
    }
}

/* ========== 图片项 ========== */
.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background-color: #2a2a2a;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* ========== 收藏按钮（图库页面 - 右上角） ========== */
.gallery-favorite-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background-color: #5b5b5b;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 1;
}

.gallery-item:hover .gallery-favorite-btn,
.gallery-favorite-btn.is-favorited {
    opacity: 1;
}

.gallery-favorite-btn:hover {
    background-color: #6b6b6b;
}

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

/* 未收藏 - 空心星星 */
.gallery-favorite-btn .star-outline {
    stroke: #ffffff;
    fill: none;
}

/* 已收藏 - 黄色填充星星 */
.gallery-favorite-btn.is-favorited .star-outline {
    stroke: #ffc107;
    fill: #ffc107;
}

/* ========== 收藏按钮（对话中 - 右下角 hover 显示） ========== */
.chat-favorite-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background-color: #5b5b5b;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 1;
}

.image-wrapper:hover .chat-favorite-btn,
.chat-favorite-btn.is-favorited {
    opacity: 1;
}

.chat-favorite-btn:hover {
    background-color: #6b6b6b;
}

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

/* 未收藏 - 空心星星 */
.chat-favorite-btn .star-outline {
    stroke: #ffffff;
    fill: none;
}

/* 已收藏 - 黄色填充星星 */
.chat-favorite-btn.is-favorited .star-outline {
    stroke: #ffc107;
    fill: #ffc107;
}

/* ========== 空状态 ========== */
.gallery-empty {
    display: none;
    padding: 40px 20px;
    text-align: center;
    color: #888888;
    font-size: 14px;
}

.gallery-empty.is-visible {
    display: block;
}

/* 收藏区空状态时隐藏整个 section */
#galleryFavoritesSection.is-empty {
    display: none;
}

/* ========== 加载更多按钮 ========== */
.gallery-load-more {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 24px auto 0;
    padding: 12px 24px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.gallery-load-more:hover {
    background-color: #4a4a4a;
}

.gallery-load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 侧边栏图库入口 ========== */
.gallery-entry {
    padding: 16px;
    cursor: pointer;
    border-bottom: 1px solid #2a2a2a;
}

.gallery-entry:hover {
    background-color: rgba(42, 42, 42, 0.5);
}

.gallery-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-entry-title {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

.gallery-entry-arrow {
    width: 24px;
    height: 24px;
    color: #888888;
    transition: transform 0.2s ease;
}

.gallery-entry:hover .gallery-entry-arrow {
    transform: translateX(2px);
}

/* ========== 侧边栏预览图 ========== */
.gallery-preview {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 12px;
}

.gallery-preview-item {
    width: 65px;
    height: 65px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #1a1a1a;
    flex-shrink: 0;
}

.gallery-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-preview-empty {
    width: 65px;
    height: 65px;
    border-radius: 10px;
    background-color: #1a1a1a;
    flex-shrink: 0;
}
