/* Photo grid layout */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 2px;
}

.photo-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

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

.photo-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.photo-video-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.15), rgba(15, 23, 42, 0.65));
    color: #fff;
    pointer-events: none;
}

.video-play-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: rgba(15, 23, 42, 0.55);
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1;
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-content img {
    max-width: 100%;
    max-height: calc(100vh - 80px);
    /* 减去底部信息栏的高度 */
    object-fit: contain;
}

/* Swiper custom styles */
.photo-swiper {
    position: relative;
    width: 100%;
    height: 100vh;
    z-index: 2;
}

.photo-swiper .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-swiper .swiper-slide img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

.photo-swiper .swiper-slide video {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    background: #000;
    border-radius: 4px;
}

.photo-swiper .swiper-button-next,
.photo-swiper .swiper-button-prev {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    margin-top: -22px;
}

.photo-swiper .swiper-button-next:after,
.photo-swiper .swiper-button-prev:after {
    font-size: 18px;
}

.photo-swiper .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.8);
}

.photo-swiper .swiper-pagination-bullet-active {
    background: #ffffff;
}

.photo-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 20px;
    z-index: 10;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.photo-info-overlay.show {
    transform: translateY(0);
}

.photo-swiper .swiper-zoom-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .photo-swiper .swiper-button-next,
    .photo-swiper .swiper-button-prev {
        width: 40px;
        height: 40px;
        margin-top: -20px;
    }

    .photo-swiper .swiper-button-next:after,
    .photo-swiper .swiper-button-prev:after {
        font-size: 16px;
    }

    .photo-info-overlay {
        padding: 15px;
    }

    .photo-info-overlay h3 {
        font-size: 1rem;
    }

    /* Hide navigation buttons, prioritize swipe operation */
    .photo-swiper .swiper-button-next,
    .photo-swiper .swiper-button-prev {
        opacity: 0.3;
        transition: opacity 0.3s ease;
    }

    .photo-swiper:hover .swiper-button-next,
    .photo-swiper:hover .swiper-button-prev {
        opacity: 0.8;
    }
}

/* Loading indicator */
.photo-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* Swiper transition effect optimization */
.photo-swiper .swiper-slide {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.photo-swiper .swiper-slide-active {
    opacity: 1;
}

/* 图片懒加载样式 */
.image-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* 加载中状态 */
.image-placeholder.loading {
    background: rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

.loading-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* 未加载状态 */
.image-placeholder.pending {
    background: rgba(0, 0, 0, 0.1);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* 内容切换淡入淡出动画（用于标签切换时骨架屏与网格） */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.2s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

/* 已加载图片样式 */
.photo-image {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Vue v-cloak to prevent initial flash */
[v-cloak] { display: none !important; }

.photo-image.loading {
    opacity: 0;
}

.photo-image.loaded {
    opacity: 1;
}

.preview-video-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    pointer-events: none;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 渐入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.photo-image {
    animation: fadeIn 0.3s ease;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
    
    .placeholder-icon {
        font-size: 36px;
    }
    
    .loading-text {
        font-size: 12px;
    }
}
