/**
 * Enhanced Product Form - AI Assistant Styles
 * Styling for AI-powered content generation interface
 */

/* AI Assistant Wrapper */
.epf-ai-assistant-wrapper {
    margin-top: 10px;
    padding: 0;
}

/* AI Assistant Button */
.epf-ai-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.epf-ai-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.epf-ai-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.epf-ai-button.generating {
    cursor: not-allowed;
    opacity: 0.8;
}

/* AI Icon */
.ai-icon {
    font-size: 16px;
    line-height: 1;
}

/* AI Loader */
.ai-loader {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.ai-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AI Result Messages */
.epf-ai-result {
    margin-top: 10px;
}

.ai-message {
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.ai-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ai-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Content Preview */
.ai-content-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ai-preview-header {
    background: #e9ecef;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.ai-close-preview {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6c757d;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ai-close-preview:hover {
    background: #dc3545;
    color: white;
}

.ai-preview-content {
    padding: 15px;
    line-height: 1.5;
    color: #495057;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-preview-actions {
    padding: 12px 15px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

.ai-preview-actions .button {
    font-size: 13px;
    padding: 6px 12px;
    height: auto;
    line-height: 1.4;
}

/* Integration with form fields */
.epf-form-row .epf-ai-assistant-wrapper,
.form-group .epf-ai-assistant-wrapper,
.field-container .epf-ai-assistant-wrapper {
    margin-top: 8px;
}

/* TinyMCE Integration */
.wp-editor-wrap .epf-ai-assistant-wrapper {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Character count warning */
.character-count.warning {
    color: #dc3545;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .epf-ai-button {
        font-size: 13px;
        padding: 6px 12px;
        gap: 6px;
    }
    
    .ai-icon {
        font-size: 14px;
    }
    
    .ai-preview-content {
        max-height: 150px;
        padding: 12px;
    }
    
    .ai-preview-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .ai-preview-actions .button {
        width: 100%;
        text-align: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ai-content-preview {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-preview-header {
        background: #4a5568;
        border-color: #2d3748;
        color: #e2e8f0;
    }
    
    .ai-preview-content {
        color: #e2e8f0;
    }
    
    .ai-preview-actions {
        background: #2d3748;
        border-color: #4a5568;
    }
}

/* Animation for smooth appearance */
.epf-ai-result {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus states for accessibility */
.epf-ai-button:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.ai-close-preview:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Loading state animation */
.epf-ai-button.generating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}
