/* 图生图界面优化样式 */

.i2i-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* 旧布局已废弃，使用新的 i2i-horizontal-layout */
.upload-preset-row {
    display: none !important;
}

/* 快速预设选择 - 左边，50%宽度 */
.upload-preset-row .quick-select-container {
    flex: 1;
    order: 1; /* 确保预设在左边 */
}

/* 图片上传区域 - 右边，50%宽度 */
.upload-preset-row .image-upload-area {
    flex: 1;
    order: 2; /* 确保图片上传在右边 */
}

.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* 图片上传区域优化 - 紧凑设计 */
.image-upload-area {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-upload-area:hover {
    border-color: #8b5cf6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
}

.upload-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.upload-label {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.upload-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
    font-size: 0.9rem;
}

.upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.image-upload-zone {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 6px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    transition: all 0.2s ease;
}

.image-upload-zone:hover {
    border-color: #8b5cf6;
    background: #faf5ff;
}

.upload-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    padding: 0.5rem;
}

.upload-placeholder i {
    font-size: 1.5rem;
    color: #9ca3af;
}

.upload-placeholder-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.upload-placeholder p {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
    color: #374151;
}

.upload-placeholder span {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* 参考图片预览优化 */
.reference-preview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #ffffff;
}

.reference-preview img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.remove-image:hover {
    background: rgba(220, 38, 38, 0.8);
    transform: scale(1.1);
}

/* 图生图快速预设容器特殊样式 */
#quick-presets-container {
    order: 2; /* 确保预设选择在合适的位置 */
}

/* 图生图提示词输入框优化 - 全宽显示 */
.img2img-prompt {
    order: 3; /* 确保输入框在最后 */
    width: 100%;
}

.img2img-prompt .prompt-container,
.img2img-prompt textarea {
    width: 100%;
    box-sizing: border-box;
}

.img2img-prompt textarea {
    min-height: 80px;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.5;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.img2img-prompt textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.prompt-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* 整体图生图容器的间距优化 */
.i2i-content .image-upload-container > * {
    margin-bottom: 0; /* 移除默认的margin，使用gap控制间距 */
}

/* 移动端优化 - 文生图和图生图的快速选择在一行显示 */
@media (max-width: 768px) {
    .i2i-content {
        gap: 1rem;
    }
    
    /* 移动端图片上传和预设选择改为垂直布局 */
    .upload-preset-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .image-upload-area {
        padding: 0.75rem;
    }
    
    .upload-area-header {
        margin-bottom: 0.5rem;
    }
    
    .upload-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .image-upload-zone {
        min-height: 70px;
    }
    
    .upload-placeholder {
        gap: 0.5rem;
        padding: 0.4rem;
    }
    
    .upload-placeholder i {
        font-size: 1.2rem;
    }
    
    .upload-placeholder p {
        font-size: 0.85rem;
    }
    
    .upload-placeholder span {
        font-size: 0.75rem;
    }
    
    .img2img-prompt textarea {
        min-height: 70px;
        font-size: 0.95rem;
        padding: 0.75rem;
    }
    
    /* 移动端快速选择区域的特殊布局 */
    .tab-content {
        position: relative;
    }
    
    /* 在移动端创建快速选择横向布局容器 */
    .mobile-quick-select-row {
        display: block !important; /* 强制显示，确保在移动端可见 */
        width: 100%;
        margin-bottom: 1rem;
        overflow: visible !important; /* 确保内容不被裁剪 */
        visibility: visible !important; /* 确保可见性 */
        opacity: 1 !important; /* 确保不透明 */
    }
    
    .mobile-quick-select-row .quick-select-container {
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.6rem;
        box-sizing: border-box;
    }
    
    .mobile-quick-select-row .quick-select-header h4 {
        font-size: 0.9rem;
    }
    
    .mobile-quick-select-row .view-more-btn {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* 确保移动端的网格布局正确 */
    .mobile-quick-select-row .quick-styles-grid,
    .mobile-quick-select-row .quick-presets-grid {
        display: grid !important;
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        grid-template-rows: auto !important;
        gap: 4px !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .i2i-content {
        gap: 0.8rem;
    }
    
    .image-upload-area {
        padding: 0.6rem;
    }
    
    .upload-area-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        margin-bottom: 0.4rem;
    }
    
    .upload-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .image-upload-zone {
        min-height: 60px;
    }
    
    .upload-placeholder {
        flex-direction: column;
        gap: 0.4rem;
        text-align: center;
    }
    
    .upload-placeholder-text {
        gap: 0.2rem;
    }
    
    .upload-placeholder i {
        font-size: 1.1rem;
    }
    
    .upload-placeholder p {
        font-size: 0.8rem;
    }
    
    .upload-placeholder span {
        font-size: 0.7rem;
    }
    
    .img2img-prompt textarea {
        min-height: 60px;
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    /* 小屏幕上的快速选择区域调整 */
    .mobile-quick-select-row {
        margin-bottom: 0.8rem;
    }
    
    .mobile-quick-select-row .quick-select-container {
        padding: 0.5rem;
        margin-bottom: 0.4rem;
    }
    
    .mobile-quick-select-row .quick-select-header h4 {
        font-size: 0.85rem;
    }
    
    /* 小屏幕网格布局调整 */
    .mobile-quick-select-row .quick-styles-grid,
    .mobile-quick-select-row .quick-presets-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        grid-template-rows: auto !important;
        gap: 4px !important;
    }
    
    /* 确保图标正确显示 */
    .mobile-quick-select-row .quick-style-item.active::after,
    .mobile-quick-select-row .quick-preset-item.active::after {
        width: 18px;
        height: 18px;
        font-size: 9px;
        top: 3px;
        right: 3px;
    }
}
