/* ==================== Photo Overlay 组件样式 ==================== */

/* Overlay 容器 - 兜底样式 */
#photo-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: 99999 !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

#photo-overlay.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible !important;
    z-index: 99999 !important;
    transition: opacity 0.3s ease !important;
}

/* 兼容类选择器 */
.photo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    pointer-events: none;
}

.photo-overlay.active {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    pointer-events: auto !important;
}

/* ==================== 1. 动态骨架屏效果 (0.1不透明度扫光) ==================== */
.skeleton-container {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

.skeleton-shimmer {
    position: relative;
    overflow: hidden;
}

/* Wrapper 骨架屏背景色，扫光在其上可见 */
.main-image-wrapper.skeleton-shimmer {
    background-color: rgba(255, 255, 255, 0.06);
}

.skeleton-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite ease-in-out;
    z-index: 1;
    pointer-events: none;
}

@keyframes shimmer {
    100% { left: 200%; }
}

/* ==================== 2. 主视图与自适应舞台 (完美兼容横竖屏) ==================== */
.main-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 150px);
    padding: 20px 0 0 0;
    width: 100vw;
}

/* 舞台容器 */
.main-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
}

/* 图片本身：按原比例缩放，绝不裁切 */
.main-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    transition: opacity 0.3s ease;
    z-index: 2;
}

/* 图片骨架屏：扫光动画范围在 wrapper，图片只负责透明度 */
.main-image.image-loaded {
    opacity: 1 !important;
}

/* ==================== 3. 导航箭头 (固定定位，防全局样式污染) ==================== */
#photo-overlay .nav {
    position: fixed !important;
    top: 45% !important;
    transform: translateY(-50%) !important;
    font-size: 32px !important;
    background: rgba(0, 0, 0, 0.4) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    z-index: 100000 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#photo-overlay .nav:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

#photo-overlay .nav.prev { left: 40px !important; }
#photo-overlay .nav.next { right: 40px !important; }

/* ==================== 4. 图片信息 ==================== */
.image-info {
    margin-top: 20px;
    text-align: center;
    color: #fff;
}

.image-info .title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.4;
    letter-spacing: 0;
}

.image-info .meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.image-info .location {
    display: inline-flex;
    align-items: center;
}

.image-info .separator {
    color: rgba(255, 255, 255, 0.5);
}

/* ==================== 5. 缩略图条 ==================== */
.thumbnail-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-4);
    gap: var(--spacing-3);
    backdrop-filter: blur(10px);
}

.thumbnail-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.thumbnail-track {
    display: flex;
    gap: var(--spacing-2);
    transition: transform 0.3s ease;
}

.thumbnail-wrapper {
    position: relative;
    border-radius: 12px;
    flex-shrink: 0;
}

/* ==================== 缩略图蒙层样式 ==================== */
#photo-overlay .thumbnail-wrapper {
    position: relative;
    flex-shrink: 0;
}

#photo-overlay .thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

#photo-overlay .thumbnail-wrapper.active .thumbnail-overlay {
    opacity: 0;
}

/* ==================== 缩略图边框修复 (改用 outline) ==================== */
#photo-overlay .thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    outline: 2px solid rgba(255, 255, 255, 0.1);
    outline-offset: -2px;
    transition: outline-color 0.3s ease;
    flex-shrink: 0;
    border: none;
    position: relative;
    z-index: 0;
}

#photo-overlay .thumbnail:hover { outline-color: rgba(255, 255, 255, 0.5); }
#photo-overlay .thumbnail.active { outline-color: rgba(255, 255, 255, 1); }

.thumbnail-page-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.thumbnail-page-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.thumbnail-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==================== 6. 关闭按钮 ==================== */
.close-btn,
#photo-overlay .close-btn,
#photo-overlay.active .close-btn {
    position: fixed;
    top: var(--spacing-4);
    right: var(--spacing-5);
    width: 50px;
    height: 50px;
    font-size: 36px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 100001 !important;
    pointer-events: auto !important;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
    pointer-events: auto !important;
}

/* ==================== 7. 移动端/平板端适配 (≤1023px) ==================== */
@media (max-width: 1023px) {
    #photo-overlay .nav {
        display: none !important;
    }

    .main-view {
        height: calc(100vh - 130px);
        padding: 0;
    }

    .main-image-wrapper {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        border-radius: 0;
        touch-action: pan-y;
    }

    .main-image {
        max-width: 100vw;
        max-height: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .thumbnail {
        width: 100px;
        height: 56px;
        outline: 2px solid rgba(255, 255, 255, 0.1);
        outline-offset: -2px;
    }

    /* 缩略图条 - 小屏横向滚动 */
    .thumbnail-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        align-items: center;
        padding: 0 var(--spacing-2);
        gap: var(--spacing-2);
        backdrop-filter: blur(10px);
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .thumbnail-bar::-webkit-scrollbar {
        display: none;
    }

    .thumbnail-viewport {
        flex: 1;
        overflow: visible;
        height: 70px;
        display: flex;
        align-items: center;
    }

    .thumbnail-track {
        display: flex;
        gap: var(--spacing-2);
        transition: none;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding: 0 var(--spacing-1);
    }

    .thumbnail:hover { outline-color: rgba(255, 255, 255, 0.5); }
    .thumbnail.active { outline-color: rgba(255, 255, 255, 1); }

    /* 强制隐藏桌面端翻页按钮（小屏通过手势滑动，防全局样式污染） */
    #photo-overlay .thumbnail-page-btn {
        display: none !important;
    }

    .close-btn {
        top: var(--spacing-2);
        right: var(--spacing-2);
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .image-info {
        position: fixed;
        bottom: 110px;
        left: 0;
        right: 0;
        text-align: center;
        padding: 0 20px;
    }

    .image-info .title {
        font-size: clamp(0.875rem, 1.5vw + 0.5rem, 1rem); /* 14px - 16px */
    }

    .image-info .meta {
        font-size: clamp(0.75rem, 1vw + 0.5rem, 0.875rem); /* 12px - 14px */
    }
}

/* ==================== 8. 手机端极小屏幕适配 (≤480px) ==================== */
@media (max-width: 480px) {
    .main-view {
        height: calc(100vh - 110px);
    }

    .thumbnail-bar {
        height: 80px;
        padding: 0 var(--spacing-2);
        gap: var(--spacing-2);
    }

    .thumbnail-track {
        gap: var(--spacing-2);
        padding: 0 var(--spacing-1);
    }

    .thumbnail {
        width: 60px;
        height: 34px;
        outline: 2px solid rgba(255, 255, 255, 0.1);
        outline-offset: -2px;
    }

    .thumbnail:hover { outline-color: rgba(255, 255, 255, 0.5); }
    .thumbnail.active { outline-color: rgba(255, 255, 255, 1); }

    .image-info {
        bottom: 90px;
    }
    
    .image-info .title {
        font-size: clamp(0.75rem, 1.5vw + 0.375rem, 0.875rem); /* 12px - 14px */
    }

    .image-info .meta {
        font-size: clamp(0.75rem, 1vw + 0.5rem, 0.875rem); /* 12px - 14px */
    }

    .close-btn {
        width: 36px;
        height: 36px;
        font-size: 24px;
        top: var(--spacing-2);
        right: var(--spacing-2);
    }
}
