﻿/* ===== 全局样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f5f7fa;
    font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

/* ===== 双栏布局 ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 260px;
    background-color: #1e2a3a;
    color: #e0e4e8;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #2c3e4e;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
}

.sidebar-header .sub {
    font-size: 0.75rem;
    color: #8aa0b5;
    letter-spacing: 1px;
}

/* 分类按钮组 */
.category-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

.cat-btn {
    background: none;
    border: none;
    text-align: left;
    padding: 12px 16px;
    font-size: 1rem;
    color: #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.cat-btn:hover {
    background-color: #2c3e4e;
    color: white;
}

.cat-btn.active {
    background-color: #2c5f8a;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ===== 右侧主内容 ===== */
.main-content {
    flex: 1;
    padding: 24px 30px;
    background-color: #f5f7fa;
}

/* 搜索框 */
.search-box {
    text-align: center;
    margin-bottom: 30px;
}

#searchInput {
    width: 80%;
    max-width: 500px;
    padding: 12px 20px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 40px;
    background-color: white;
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    border-color: #4285f4;
    box-shadow: 0 0 8px rgba(66, 133, 244, 0.3);
}

/* 大图预览区域 */
.preview-area {
    text-align: center;
    margin: 20px auto 30px;
    padding: 16px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    max-width: 800px;
}

.preview-area img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    object-fit: contain;
}

.preview-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 12px 0 6px;
    color: #1e2a3a;
}

.preview-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.preview-tags .tag {
    background-color: #e8f0fe;
    color: #2c5f8a;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* 图片网格 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    padding: 0;
}

/* 图片卡片 */
.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.image-card:hover {
    transform: translateY(-5px);
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 15px;
}

.image-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    background-color: #e8f0fe;
    color: #4285f4;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 12px;
}

/* 下载按钮样式 */
.download-btn {
    background-color: #4285f4;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
    transition: background 0.2s;
}

.download-btn:hover {
    background-color: #3367d6;
}

/* 无结果提示 */
.no-result {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
    grid-column: 1 / -1;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .sidebar-header h2 {
        font-size: 1rem;
    }
    .cat-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .main-content {
        padding: 16px;
    }
    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    #searchInput {
        width: 90%;
    }
}
/* ===== 灯箱 Lightbox ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}
.lightbox.active {
    visibility: visible;
    opacity: 1;
}
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}
.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
.close-lightbox {
    position: absolute;
    top: -40px;
    right: -40px;
    font-size: 36px;
    color: white;
    cursor: pointer;
    background: rgba(0,0,0,0.6);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.close-lightbox:hover {
    background: rgba(255,255,255,0.3);
}
.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 36px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.prev-btn { left: -70px; }
.next-btn { right: -70px; }
.prev-btn:hover, .next-btn:hover {
    background: rgba(255,255,255,0.3);
}
.lightbox-caption {
    margin-top: 16px;
    color: #ddd;
    font-size: 1rem;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 768px) {
    .prev-btn, .next-btn {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    .prev-btn { left: 10px; }
    .next-btn { right: 10px; }
    .close-lightbox {
        top: 10px;
        right: 10px;
    }
}