/* ========== 缩略图样式 ========== */

/* 带缩略图的多选框 - 卡片式布局 */
.checkbox-item-with-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--background-lighter);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    text-align: center;
    position: relative;
}

.checkbox-item-with-thumb:hover {
    border-color: var(--primary-color);
    background: var(--background-dark);
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.checkbox-item-with-thumb.checked {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.2);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.checkbox-item-with-thumb input[type="checkbox"] {
    display: none;
}

/* 缩略图 */
.thumbnail {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    transition: var(--transition);
    min-height: 100px;
}

.checkbox-item-with-thumb:hover .thumbnail {
    transform: scale(1.03);
}

/* 缩略图上的选中标记 */
.thumb-check-mark {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--background-card);
    border: 2px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1;
}

.checkbox-item-with-thumb.checked .thumb-check-mark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.thumb-check-mark::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: none;
}

.checkbox-item-with-thumb.checked .thumb-check-mark::after {
    display: block;
}

/* 标签文本 */
.thumb-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.3;
    padding: 0 4px;
}

/* 带缩略图的标签 */
.tag-item-with-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: var(--background-lighter);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    text-align: center;
    position: relative;
}

.tag-item-with-thumb:hover {
    border-color: var(--primary-color);
    background: var(--background-dark);
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.tag-item-with-thumb.active {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.2);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.tag-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    transition: var(--transition);
    min-height: 100px;
}

.tag-item-with-thumb:hover .tag-thumb {
    transform: scale(1.03);
}

.tag-thumb-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    transition: var(--transition);
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--background-card);
}

.tag-item-with-thumb.active .tag-thumb-indicator {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.tag-thumb-indicator::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: none;
}

.tag-item-with-thumb.active .tag-thumb-indicator::after {
    display: block;
}

.tag-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    padding: 0 4px;
}

/* 图片预览模态框 */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.image-preview-modal.active {
    display: flex;
}

.image-preview-content {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: var(--background-card);
    display: flex;
    flex-direction: column;
}

.image-preview-content img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    display: block;
    object-fit: contain;
}

.image-preview-title {
    color: var(--text-primary);
    text-align: center;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    background: var(--background-card);
    flex-shrink: 0;
}

.close-preview {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.close-preview:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* 缩略图网格布局 */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .thumbnail-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .thumbnail, .tag-thumb {
        min-height: 80px;
    }

    .checkbox-item-with-thumb,
    .tag-item-with-thumb {
        padding: 10px;
    }

    .thumb-label, .tag-text {
        font-size: 12px;
    }

    .thumb-check-mark, .tag-thumb-indicator {
        width: 20px;
        height: 20px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .thumbnail-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .thumbnail, .tag-thumb {
        min-height: 70px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 加载状态 */
.thumbnail.loading,
.tag-thumb.loading {
    background: linear-gradient(90deg,
        var(--background-lighter) 25%,
        var(--background-dark) 50%,
        var(--background-lighter) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
