/* AI Elementor Widgets Styles */

/* AI Content Container */
.ai-content-container {
    position: relative;
    transition: all 0.3s ease;
}

.ai-content-container:hover {
    outline: 2px dashed #0073aa;
    outline-offset: 5px;
}

/* AI Edit Buttons */
.ai-edit-buttons {
    position: absolute;
    display: none;
    gap: 5px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.elementor-editor-active .ai-content-container:hover .ai-edit-buttons {
    display: flex;
}

.ai-edit-buttons.top-left {
    top: -40px;
    left: 0;
}

.ai-edit-buttons.top-right {
    top: -40px;
    right: 0;
}

.ai-edit-buttons.bottom-left {
    bottom: -40px;
    left: 0;
}

.ai-edit-buttons.bottom-right {
    bottom: -40px;
    right: 0;
}

.ai-edit-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-edit-btn:hover {
    background: #005177;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ai-edit-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ai-edit-btn.loading {
    opacity: 0.6;
    cursor: wait;
}

.ai-edit-btn.loading .dashicons {
    animation: spin 1s linear infinite;
}

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

/* AI Modal */
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ai-modal {
    background: #fff;
    border-radius: 8px;
    padding: 0;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ai-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.ai-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.ai-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.ai-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.ai-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* AI Options */
.ai-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-option-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ai-option-group select,
.ai-option-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.ai-option-group textarea {
    min-height: 100px;
    resize: vertical;
}

.ai-option-group select:focus,
.ai-option-group textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* AI Variations */
.ai-variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-variation {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ai-variation:hover {
    border-color: #0073aa;
    background: #f8f9fa;
}

.ai-variation.selected {
    border-color: #0073aa;
    background: #e7f5fe;
}

.ai-variation-content {
    color: #333;
    line-height: 1.6;
}

.ai-variation-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #0073aa;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Buttons */
.ai-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ai-btn-primary {
    background: #0073aa;
    color: #fff;
}

.ai-btn-primary:hover {
    background: #005177;
}

.ai-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.ai-btn-secondary:hover {
    background: #e0e0e0;
}

.ai-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-btn .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Loading State */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.ai-loading-text {
    color: #666;
    font-size: 14px;
}

/* Success Message */
.ai-success-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
    margin-bottom: 15px;
}

.ai-success-message .dashicons {
    color: #28a745;
}

/* Error Message */
.ai-error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    margin-bottom: 15px;
}

.ai-error-message .dashicons {
    color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .ai-modal-header,
    .ai-modal-body,
    .ai-modal-footer {
        padding: 15px;
    }
    
    .ai-edit-buttons {
        flex-wrap: wrap;
    }
}
