/* 界面优化和增强样式 */

/* 图片选择区域优化 */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-gallery::-webkit-scrollbar {
    width: 6px;
}

.image-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.image-gallery::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 3px;
}

.image-gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

.image-item {
    position: relative;
    cursor: pointer;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    aspect-ratio: 1;
}

.image-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.3);
}

.image-item.active {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    transform: scale(1.05);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-item:hover img {
    transform: scale(1.1);
}

.image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 0.7rem;
    padding: 0.3rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 按钮增强效果 */
.btn, .test-btn, .config-toggle-btn, .refresh-btn, .folder-select-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before, .test-btn::before, .config-toggle-btn::before, .refresh-btn::before, .folder-select-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before, .test-btn:hover::before, .config-toggle-btn:hover::before, .refresh-btn:hover::before, .folder-select-btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active, .test-btn:active, .config-toggle-btn:active, .refresh-btn:active, .folder-select-btn:active {
    transform: scale(0.95);
}

/* 刷新按钮动画 */
.refresh-btn:hover {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 图片对比区域优化 */
.image-comparison {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    position: relative;
}

.image-panel {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-panel:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.1);
}

.panel-title {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(78, 205, 196, 0.1));
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.title-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px rgba(0, 212, 255, 0.5));
}

.image-container {
    height: calc(100% - 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

.placeholder {
    text-align: center;
    color: #666;
    transition: all 0.3s ease;
}

.placeholder:hover {
    color: #888;
    transform: scale(1.05);
}

.placeholder svg {
    margin-bottom: 1rem;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.placeholder:hover svg {
    opacity: 0.8;
    transform: scale(1.1);
}

/* VS分隔符优化 */
.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 60px;
    height: 100%;
}

.vs-divider::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 20%;
    bottom: 20%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(0, 212, 255, 0.5), transparent);
    transform: translateX(-50%);
}

.vs-text {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(78, 205, 196, 0.2));
    color: #00d4ff;
    padding: 0.5rem 0.8rem;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.8rem;
    border: 2px solid rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(10px);
    animation: pulse 2s ease-in-out infinite;
    z-index: 2;
    position: relative;
}

/* 监控面板优化 */
.monitor-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.monitor-panel:hover {
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.1);
}

.panel-header {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(78, 205, 196, 0.1));
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #00d4ff;
    font-weight: 600;
}

.monitor-content {
    padding: 1rem;
}

/* 状态指示器动画 */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
    animation: statusPulse 2s ease-in-out infinite;
}

.status-indicator.success {
    background: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.status-indicator.warning {
    background: #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.status-indicator.error {
    background: #dc3545;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00d4ff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式优化 */
@media screen and (max-width: 768px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.3rem;
        padding: 0.3rem;
        max-height: 150px;
    }
    
    .image-comparison {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .vs-divider {
        width: 100%;
        height: 40px;
    }
    
    .vs-divider::before {
        left: 20%;
        right: 20%;
        top: 50%;
        bottom: auto;
        width: auto;
        height: 2px;
        transform: translateY(-50%);
        background: linear-gradient(to right, transparent, rgba(0, 212, 255, 0.5), transparent);
    }
    
    .panel-header h3 {
        font-size: 0.8rem;
    }
    
    .config-actions {
        flex-direction: column;
    }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
    .image-panel {
        background: rgba(0, 0, 0, 0.3);
    }
    
    .placeholder {
        color: #555;
    }
    
    .placeholder:hover {
        color: #777;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .image-panel {
        border-width: 2px;
    }
    
    .vs-text {
        border-width: 3px;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .image-item,
    .placeholder,
    .vs-text,
    .status-indicator {
        animation: none;
    }
    
    .btn::before,
    .test-btn::before,
    .config-toggle-btn::before,
    .refresh-btn::before,
    .folder-select-btn::before {
        transition: none;
    }
}