/* AI Content Generator Widget Styles */

.ai-content-generator-widget {
    position: relative;
    display: flex;
    flex-direction: column;
}

.ai-generated-image {
    line-height: 0;
    max-width: 100%;
    overflow: visible;
    transition: all 0.3s ease;
    margin-bottom: 25px;
}

.ai-generated-image img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

/* Responsive Alignment via Prefix Classes from Elementor */
.ai-image-align-left .ai-generated-image {
    align-self: flex-start;
}

.ai-image-align-center .ai-generated-image {
    align-self: center;
}

.ai-image-align-right .ai-generated-image {
    align-self: flex-end;
}

.ai-generated-content {
    line-height: 1.6;
}

.ai-generated-content p {
    margin-bottom: 20px;
}

.ai-generated-content p:last-child {
    margin-bottom: 0;
}

/* Generator Buttons in Editor */
.ai-generator-buttons {
    margin: 20px 0;
    text-align: center;
}

.ai-generate-btn,
.ai-regenerate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100%;
    max-width: 400px;
}

.ai-generate-btn:hover,
.ai-regenerate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ai-generate-btn:active,
.ai-regenerate-btn:active {
    transform: translateY(0);
}

.ai-generate-btn:disabled,
.ai-regenerate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ai-regenerate-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.ai-regenerate-btn:hover {
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.ai-btn-icon {
    font-size: 18px;
    line-height: 1;
}

.ai-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Loading Spinner */
.ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.ai-generated-content em {
    font-style: italic;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {

    .ai-generate-btn,
    .ai-regenerate-btn {
        font-size: 14px;
        padding: 10px 20px;
    }

    .ai-generated-content {
        font-size: 14px;
    }
}

/* Elementor Editor Specific Styles */
.elementor-editor-active .ai-generator-buttons {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.elementor-editor-active .ai-generate-btn,
.elementor-editor-active .ai-regenerate-btn {
    position: relative;
    z-index: 1;
}

/* Success/Error Messages in Editor */
.ai-generation-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}

.ai-generation-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ai-generation-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Content Preview Box */
.ai-content-preview {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

/* CTA Styling (if included in generated content) */
.ai-generated-content strong {
    font-weight: 600;
    color: inherit;
}

/* Link Styling in Generated Content */
.ai-generated-content a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ai-generated-content a:hover {
    color: #764ba2;
    text-decoration: underline;
}