/**
 * Forum Theme - 图片灯箱样式
 */

/* 遮罩层 */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: var(--z-overlay, 500);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal, 0.3s ease);
}

.lightbox-overlay.active {
    opacity: 1;
}

/* 容器 */
.lightbox-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px);
    flex-shrink: 0;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-sm, 14px);
}

.lightbox-actions {
    display: flex;
    gap: var(--spacing-sm, 8px);
}

.lightbox-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background var(--transition-fast, 0.15s ease);
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 主体 */
.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    padding: 0 var(--spacing-lg, 24px);
}

/* 导航按钮 */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all var(--transition-fast, 0.15s ease);
    z-index: 10;
}

.lightbox-nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-prev {
    left: var(--spacing-lg, 24px);
}

.lightbox-next {
    right: var(--spacing-lg, 24px);
}

/* 图片容器 */
.lightbox-image-wrap {
    max-width: calc(100% - 120px);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 图片 */
.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: var(--radius-md, 8px);
    transition: transform var(--transition-normal, 0.3s ease), opacity var(--transition-fast, 0.15s ease);
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-image.zoomed {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
    transform: scale(1.5);
}

/* 加载状态 */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm, 8px);
}

.lightbox-loading span {
    font-size: var(--font-sm, 14px);
}

/* 旋转动画 */
@keyframes ri-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ri-spin {
    animation: ri-spin 1s linear infinite;
}

/* 底部 */
.lightbox-footer {
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px);
    flex-shrink: 0;
}

/* 缩略图 */
.lightbox-thumbnails {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm, 8px);
    overflow-x: auto;
    padding: var(--spacing-xs, 4px) 0;
}

.lightbox-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all var(--transition-fast, 0.15s ease);
    flex-shrink: 0;
    border: 2px solid transparent;
}

.lightbox-thumb:hover {
    opacity: 0.8;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: var(--primary-color, #3B82F6);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 帖子内图片样式增强 */
.post-body img.lightbox-ready,
.post-content img.lightbox-ready,
.comment-content img.lightbox-ready {
    transition: transform var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
}

.post-body img.lightbox-ready:hover,
.post-content img.lightbox-ready:hover,
.comment-content img.lightbox-ready:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

/* 响应式 */
@media (max-width: 768px) {
    .lightbox-header {
        padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
    }
    
    .lightbox-body {
        padding: 0 var(--spacing-sm, 8px);
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: var(--spacing-sm, 8px);
    }
    
    .lightbox-next {
        right: var(--spacing-sm, 8px);
    }
    
    .lightbox-image-wrap {
        max-width: calc(100% - 60px);
    }
    
    .lightbox-image {
        max-height: calc(100vh - 160px);
    }
    
    .lightbox-footer {
        padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
    }
    
    .lightbox-thumb {
        width: 48px;
        height: 48px;
    }
}
