/**
 * AI Generator Plugin Styles
 */

/* Gallery Title */
.ai-generator-view-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: bold;
    color: #000000;
    border-bottom: 2px solid #F9627D;
    padding-bottom: 8px
}

/* AI Generator Content */
.ai-generator-content {
    width: 100%;
}

/* Prompt Label */
.ai-prompt-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 400;
}

/* Prompt Group Container (for double-side mode) */
.ai-generator-content[data-double-mode="true"] {
    display: block;
}

.ai-prompt-groups-container {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.ai-prompt-group {
    flex: 1;
    min-width: 0; /* 允许flex项目收缩 */
}

.ai-prompt-side-label {
    display: block;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 2px;
}

/* Different styles for front and back inputs */
.ai-prompt-front {
    border-left: 3px solid #5bc0ad;
}

.ai-prompt-back {
    border-left: 3px solid #F9627D;
}

/* 响应式：小屏幕时垂直排列 */
@media (max-width: 768px) {
    .ai-prompt-groups-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* Textarea */
.ai-prompt-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid rgb(233, 236, 239);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #A5A6AA !important;
    resize: vertical;
    margin-bottom: 5px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ai-prompt-input:focus {
    outline: none;
    border-color: #5bc0ad;
    box-shadow: 0 0 0 3px rgba(125, 211, 192, 0.2);
    color: #333 !important;
}

.ai-prompt-input::placeholder {
    color: #A5A6AA !important;
    opacity: 1;
}

.ai-prompt-input:focus::placeholder {
    color: #333;
    opacity: 1;
}

/* Character Count */
.ai-character-count {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-bottom: 15px;
}

/* Generation Options */
.ai-generation-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ai-option-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
}

.ai-option-group label {
    font-size: 14px;
    font-weight: 500;
    margin-right: 15px;
    color: #333;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
}

.ai-select {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    appearance: none;
    transition: border-color 0.3s ease;
}

.ai-select:focus {
    outline: none;
    border-color: #7dd3c0;
}

.ai-select:hover {
    border-color: #7dd3c0;
}

/* Custom dropdown arrow */
.ai-option-group::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 10px;
    pointer-events: none;
}

/* Generate Button */
.ai-generate-button {
    width: 100%;
    padding: 14px 20px;
    background: #000;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.ai-generate-button:hover {
    background: #333;
}

.ai-generate-button:active {
    transform: scale(0.98);
}

.ai-generate-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-generate-icon {
    margin-right: 8px;
    font-size: 18px;
}

/* Status Message */
.ai-status-message {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.ai-status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.ai-status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ai-status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Result Container */
.ai-result-container {
    margin-top: 20px;
}

.ai-result-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-generate-button.loading {
    position: relative;
    color: transparent;
}

.ai-generate-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-view-title {
        font-size: 20px;
    }
    
    .ai-option-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ai-option-group label {
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    .ai-option-group::after {
        top: calc(50% + 15px);
    }
}

/* AI Generated Images 左右切换按钮 */
.ai-gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    transition: background 0.3s ease, opacity 0.3s ease;
    z-index: 10;
    opacity: 0; /* 默认隐藏 */
    pointer-events: none; /* 隐藏时不可点击 */
}

/* 鼠标悬浮在容器上时显示按钮（未禁用时） */
.ai-generated-images-container:hover .ai-gallery-nav-btn:not(:disabled) {
    opacity: 0.7;
    pointer-events: auto; /* 显示时可点击 */
}

/* 鼠标悬浮在按钮上时（未禁用时） */
.ai-generated-images-container:hover .ai-gallery-nav-btn:not(:disabled):hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

/* 禁用状态：完全隐藏 */
.ai-gallery-nav-btn:disabled {
    opacity: 0 !important;
    pointer-events: none !important;
    cursor: not-allowed;
}

.ai-gallery-nav-btn-prev {
    left: 10px;
}

.ai-gallery-nav-btn-next {
    right: 10px;
}

/* AI Generated Images 图片项样式 - 与 Product Detailed Pictures 保持一致 */
.ai-generated-item {
    border: 2px solid #ddd !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.ai-generated-item:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    border-color: #F9627D !important;
}

.ai-generated-item.selected {
    border-color: #F9627D !important;
    box-shadow: 0 0 0 2px rgba(249, 98, 125, 0.3) !important;
}

/* AI Generated Images 删除按钮 */
.ai-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 5;
}

.ai-generated-item:hover .ai-delete-btn {
    opacity: 1;
}

.ai-delete-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}
