/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #fff;
    color: #000;
    line-height: 1.6;
    padding-top: 100px;
    transition: all 0.4s ease;
    overflow-x: hidden;
}

/* 暗色主题样式 */
body.dark-theme {
    background: #121212;
    color: #fff;
}

body.dark-theme .controls-container {
    background: rgba(30, 30, 30, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .category-intro {
    background: transparent;
    color: #fff;
}

body.dark-theme .card {
    background: #1e1e1e;
}

body.dark-theme .card__content {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
}

body.dark-theme .lightbox-info {
    background: rgba(20, 20, 20, 0.95);
}

body.dark-theme .footer {
    color: #fff;
}

/* 控制栏样式 */
.controls-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    height: 40px;
    cursor: pointer;
}

.logo-img {
    height: 100%;
    max-width: 120px;
    object-fit: contain;
    transition: all 0.3s ease;
}

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

.light-logo {
    display: block;
}

.dark-logo {
    display: none;
}

body.dark-theme .light-logo {
    display: none;
}

body.dark-theme .dark-logo {
    display: block;
}

/* 筛选按钮样式 */
.controls {
    display: flex;
    gap: 12px;
}

.filter-btn {
    padding: 10px 22px;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark-theme .filter-btn {
    color: #fff;
}

.filter-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #666;
    border-radius: 1px;
}

body.dark-theme .filter-btn.active::after {
    background: #aaa;
}

.filter-btn:hover,
.filter-btn.active {
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
    color: inherit !important;
}

/* 分类介绍样式 */
.category-intro {
    max-width: 1000px;
    margin: 20px auto 40px;
    padding: 20px;
    text-align: center;
    color: #000;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    font-size: 1.1rem;
    background: transparent;
    box-shadow: none;
}

body.dark-theme .category-intro {
    color: #fff;
}

/* 画廊网格布局 */
.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    grid-auto-flow: dense;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.gallery-item {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    background: white;
    cursor: pointer;
}

body.dark-theme .gallery-item {
    background: #1e1e1e;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* 卡片尺寸样式 */
.size-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.size-2x1 {
    grid-column: span 2;
    grid-row: span 1;
}

.size-1x2 {
    grid-column: span 1;
    grid-row: span 2;
}

.size-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

/* 卡片样式 */
.card {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.card.style1 {
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.card.style2 {
    border-radius: 8px 18px 18px 8px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.card.style3 {
    border-radius: 18px 8px 8px 18px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.card.style4 {
    border-radius: 12px;
    border: 2px solid rgba(0,0,0,0.1);
}

body.dark-theme .card.style4 {
    border: 2px solid rgba(255,255,255,0.1);
}

.card.style5 {
    border-radius: 22px 8px 22px 8px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

/* 悬停效果 */
.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

body.dark-theme .gallery-item:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* 卡片内容样式 */
.card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    color: white;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.gallery-item:hover .card__content {
    opacity: 1;
}

.card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.card__description {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.85;
    margin-bottom: 8px;
    color: #fff;
}

.card__category {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    align-self: flex-start;
    color: #fff;
}

/* 灯箱样式 */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-container {
    display: flex;
    flex-direction: column;
    max-width: 90%;
    max-height: 90%;
    width: auto;
    position: relative;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    object-fit: contain;
}

/* 修改后的灯箱信息区域 */
.lightbox-info {
    padding: 15px 20px;
    background: rgba(20, 20, 20, 0.95);
    color: white;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lightbox-info-content {
    flex: 1;
    min-width: 0;
}

.lightbox-title {
    font-size: 1.6rem;
    margin-bottom: 8px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-desc {
    font-size: 1rem;
    margin-bottom: 12px;
    opacity: 0.85;
    line-height: 1.5;
    color: #fff;
}

.lightbox-category {
    display: inline-block;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 0.9rem;
    color: #fff;
    margin-right: 15px;
}

/* 修改后的复制按钮样式 */
.lightbox-download {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.lightbox-download i {
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.lightbox-download .fa-check {
    position: absolute;
    opacity: 0;
    color: #4CAF50;
    transform: scale(0);
}

.lightbox-download.copied .fa-copy {
    opacity: 0;
    transform: scale(0);
}

.lightbox-download.copied .fa-check {
    opacity: 1;
    transform: scale(1);
}

/* 复制提示样式 */
#copy-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2100;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

#copy-notification.show {
    opacity: 1;
    transform: translateY(0);
}

#copy-notification::before {
    content: "✓";
    font-size: 1.1rem;
    color: #4CAF50;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    transform: scale(1.1);
    color: #ff6b6b;
    background: rgba(0, 0, 0, 0.8);
}

/* 灯箱导航按钮样式 */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.lightbox-nav i {
    font-size: 1.5rem;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 30px;
    font-size: 0.95rem;
    color: #000;
    margin-top: 20px;
    transition: color 0.4s ease;
}

body.dark-theme .footer {
    color: #fff;
}

/* 加载动画 */
.loader {
    display: flex;
    justify-content: center;
    padding: 30px;
}

.loader .dot {
    width: 12px;
    height: 12px;
    background: #666;
    border-radius: 50%;
    margin: 0 5px;
    animation: bounce 1.2s infinite ease-in-out;
}

body.dark-theme .loader .dot {
    background: #aaa;
}

.loader .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
}

/* 分类标签颜色 */
.slide .card__category { background: rgba(255, 107, 107, 0.4); }
.nature .card__category { background: rgba(29, 209, 161, 0.4); }
.life .card__category { background: rgba(84, 160, 255, 0.4); }
.abstract .card__category { background: rgba(254, 202, 87, 0.4); }
.slide .lightbox-category { background: rgba(255, 107, 107, 0.4); }
.nature .lightbox-category { background: rgba(29, 209, 161, 0.4); }
.life .lightbox-category { background: rgba(84, 160, 255, 0.4); }
.abstract .lightbox-category { background: rgba(254, 202, 87, 0.4); }

/* 主题切换按钮 */
.toggle-btn {
    --bg: #e8e8e8;
    --fg: #212121;
    background-color: var(--bg);
    border-radius: 10px;
    --dimensions: 40px;
    width: var(--dimensions);
    height: var(--dimensions);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

body.dark-theme .toggle-btn {
    --bg: #212121;
    --fg: #e8e8e8;
}

.toggle-btn .icon {
    position: absolute;
    transition: transform 0.5s ease, opacity 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn .icon--moon {
    color: var(--fg);
    transform: scale(1);
    opacity: 1;
}

body.dark-theme .toggle-btn .icon--moon {
    transform: scale(0);
    opacity: 0;
}

.toggle-btn .icon--sun {
    color: var(--fg);
    transform: scale(0);
    opacity: 0;
}

body.dark-theme .toggle-btn .icon--sun {
    transform: scale(1);
    opacity: 1;
}

.toggle-btn .icon svg {
    width: 20px;
    height: 20px;
}

/* 汉堡菜单 */
.hamburger {
    height: 40px;
    width: 40px;
    position: relative;
    cursor: pointer;
    display: none;
}

.hamburger .checkbox {
    position: absolute;
    opacity: 0;
    height: 100%;
    width: 100%;
    cursor: pointer;
    z-index: 2;
}

.line {
    transition: 0.5s;
    stroke-width: 6px;
    stroke: black;
}

body.dark-theme .line {
    stroke: white;
}

.lineTop {
    stroke-dasharray: 40 40;
    stroke-dashoffset: 25;
}

.lineBottom {
    stroke-dasharray: 40 40;
    stroke-dashoffset: 60;
}

.lineMid {
    stroke-dasharray: 40 40;
}

.hamburger .checkbox:checked + svg .line {
    stroke: crimson;
}

.hamburger .checkbox:checked + svg .lineTop {
    stroke-dashoffset: 0;
    transform-origin: left;
    transform: rotateZ(45deg) translate(-7px, -5px);
}

.hamburger .checkbox:checked + svg .lineMid {
    stroke-dashoffset: 40;
}

.hamburger .checkbox:checked + svg .lineBottom {
    stroke-dashoffset: 0;
    transform-origin: left;
    transform: rotateZ(-45deg) translate(-5px, 5px);
}

/* 移动菜单 */
.mobile-menu {
    position: fixed;
    top: 60px;
    right: -300px;
    width: 280px;
    height: calc(100% - 60px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1099;
    padding: 20px;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}

body.dark-theme .mobile-menu {
    background: rgba(30, 30, 30, 0.95);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu .filter-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    text-align: left;
    margin-bottom: 10px;
    border-radius: 8px;
}

.mobile-menu .filter-btn.active {
    background: rgba(0,0,0,0.1) !important;
}

body.dark-theme .mobile-menu .filter-btn.active {
    background: rgba(255,255,255,0.1) !important;
}

/* 遮罩层 */
.overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1098;
}

.overlay.active {
    display: block;
}

body.dark-theme .overlay {
    background: rgba(0,0,0,0.5);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #666;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
}

body.dark-theme .back-to-top {
    background: #aaa;
}

.back-to-top:hover {
    background: #888;
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.back-to-top.show {
    display: flex;
}

/* 右侧控制区 */
.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 移动端主题切换 */
.theme-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    text-align: center;
}

body.dark-theme .theme-container {
    border-top: 1px solid rgba(255,255,255,0.1);
}

.theme-container p {
    margin-bottom: 10px;
    font-weight: 600;
}

.desktop-theme-toggle {
    display: block;
}

/* 懒加载样式 */
.image-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.dark-theme .image-loader {
    background: #2a2a2a;
}

.image-loader::after {
    content: "";
    width: 45px;
    height: 40px;
    background: linear-gradient(#0000 calc(1*100%/6),#000 0 calc(3*100%/6),#0000 0),
              linear-gradient(#0000 calc(2*100%/6),#000 0 calc(4*100%/6),#0000 0),
              linear-gradient(#0000 calc(3*100%/6),#000 0 calc(5*100%/6),#0000 0);
    background-size: 10px 400%;
    background-repeat: no-repeat;
    animation: matrix 1s infinite linear;
}

body.dark-theme .image-loader::after {
    background: linear-gradient(#0000 calc(1*100%/6),#fff 0 calc(3*100%/6),#0000 0),
              linear-gradient(#0000 calc(2*100%/6),#fff 0 calc(4*100%/6),#0000 0),
              linear-gradient(#0000 calc(3*100%/6),#fff 0 calc(5*100%/6),#0000 0);
    background-size: 10px 400%;
    background-repeat: no-repeat;
    animation: matrix 1s infinite linear;
}

.card-image.loaded + .image-loader {
    display: none;
}

@keyframes matrix {
    0% {
        background-position: 0% 100%, 50% 100%, 100% 100%;
    }
    100% {
        background-position: 0% 0%, 50% 0%, 100% 0%;
    }
}

/* 响应式设计 */
@media (max-width: 1400px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        padding: 15px;
    }
    .controls {
        gap: 6px;
    }
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
        gap: 5px;
    }
    .category-intro {
        padding: 15px;
        font-size: 1rem;
        margin: 15px auto 30px;
    }
    .lightbox-container {
        max-width: 95%;
    }
    .lightbox-title {
        font-size: 1.4rem;
    }
    .lightbox-desc {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 80px;
    }
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
        column-gap: 15px;
        row-gap: 15px;
        padding: 15px;
    }
    .controls-container {
        padding: 10px 15px;
        height: 60px;
    }
    .controls {
        display: none;
    }
    .controls-right {
        display: flex;
        align-items: center;
    }
    .category-intro {
        padding: 15px;
        margin: 10px auto 25px;
        font-size: 0.9rem;
    }
    .lightbox-container {
        max-height: 85%;
    }
    .lightbox-info {
        padding: 12px 15px;
    }
    .lightbox-title {
        font-size: 1.3rem;
    }
    .lightbox-desc {
        font-size: 0.9rem;
    }
    .close-btn {
        top: 10px;
        right: 10px;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }
    .desktop-theme-toggle {
        display: none;
    }
    .hamburger {
        display: block;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 150px;
    }
    .category-intro {
        padding: 10px;
        font-size: 0.85rem;
    }
    .lightbox {
        padding: 10px;
    }
    .lightbox-container {
        max-width: 100%;
        max-height: 100%;
        width: 100%;
        height: 100%;
        border-radius: 0;
        background: transparent;
    }
    .lightbox-content {
        border-radius: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        background: transparent;
        box-shadow: none;
    }
    .lightbox-img {
        max-height: none;
        flex: 1;
        object-fit: contain;
        height: auto;
    }
    .lightbox-info {
        border-radius: 0;
        padding: 15px 10px 10px;
        flex-shrink: 0;
        max-height: 35%;
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.8);
    }
    .lightbox-title {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    .lightbox-desc {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    .lightbox-category {
        font-size: 0.8rem;
    }
    .close-btn {
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.7);
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
    }
}