/**
 * Spexo AI Text Field Styles
 * 
 * Styles for AI text generation buttons in Elementor editor
 *
 * @package Spexo_Addons
 * @since 1.0.28
 */

/* AI Button Animations */
@keyframes spexo-ai-pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4), inset 0 0 0 1px rgba(102, 126, 234, 0.4); 
    }
    50% { 
        box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.2), inset 0 0 0 1px rgba(102, 126, 234, 0.6); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.1), inset 0 0 0 1px rgba(102, 126, 234, 0.4); 
    }
}

@keyframes spexo-ai-shine {
    0% { background-position: -100px; }
    40%, 100% { background-position: 140px; }
}

@keyframes spexo-ai-rotate-pulse {
    0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
    50% { transform: scale(1.15) rotate(180deg); filter: brightness(1.2) drop-shadow(0 0 3px rgba(102, 126, 234, 0.7)); }
    100% { transform: scale(1) rotate(360deg); filter: brightness(1); }
}

@keyframes spexo-ai-glow {
    0% { filter: brightness(1) drop-shadow(0 0 1px rgba(102, 126, 234, 0.5)); }
    50% { filter: brightness(1.3) drop-shadow(0 0 3px rgba(102, 126, 234, 0.8)); }
    100% { filter: brightness(1) drop-shadow(0 0 1px rgba(102, 126, 234, 0.5)); }
}

/* Field Animation Classes */
.spexo-ai-field-pulsing {
    animation: spexo-ai-pulse 1.5s infinite cubic-bezier(0.66, 0, 0, 1) !important;
    border-color: #667eea !important;
}

.spexo-ai-field-shine {
    background-image: linear-gradient(90deg, 
        rgba(102, 126, 234, 0) 0%, 
        rgba(102, 126, 234, 0.2) 25%, 
        rgba(173, 187, 255, 0.3) 50%, 
        rgba(102, 126, 234, 0.2) 75%, 
        rgba(102, 126, 234, 0) 100%);
    background-position: -100px;
    background-size: 140px 100%;
    background-repeat: no-repeat;
    animation: spexo-ai-shine 2s infinite linear;
}

.spexo-ai-wysiwyg-active {
    outline: 2px solid #667eea !important;
    outline-offset: -2px;
    transition: all 0.3s ease;
}

/* AI Buttons Wrapper */
.spexo-ai-buttons-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 5;
    transition: all 0.3s ease;
    margin-top: 8px;
    width: 100%;
}

.spexo-ai-buttons-wrapper.is-processing .spexo-ai-generate-btn,
.spexo-ai-buttons-wrapper.is-processing .spexo-ai-change-btn {
    background: linear-gradient(135deg, #d6d6d6, #a0a0a0) !important;
    opacity: 0.7;
    cursor: default;
    box-shadow: none !important;
    pointer-events: none;
}

.spexo-ai-buttons-wrapper.is-processing img {
    filter: grayscale(100%);
}

/* AI Generate Button */
.spexo-ai-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    text-decoration: none;
}

.spexo-ai-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

.spexo-ai-generate-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* AI Change Button */
.spexo-ai-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.3);
    text-decoration: none;
}

.spexo-ai-change-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
    color: white;
}

.spexo-ai-change-btn img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* Prompt Container */
.spexo-ai-prompt-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    position: relative;
    z-index: 4;
}

.elementor-control-type-wysiwyg .spexo-ai-prompt-container {
    margin-top: 6px;
    margin-bottom: 10px;
    width: 100%;
}

.spexo-ai-prompt-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.3s ease;
}

.spexo-ai-prompt-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.spexo-ai-prompt-examples {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.4;
}

.spexo-ai-prompt-examples strong {
    color: #495057;
    font-weight: 600;
}

/* Prompt Action Buttons */
.spexo-ai-prompt-cancel {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.3s ease;
}

.spexo-ai-prompt-cancel:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff5f5;
}

.spexo-ai-prompt-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 4px;
    background-color: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.spexo-ai-prompt-submit:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.spexo-ai-prompt-submit.is-processing {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border-color: transparent !important;
}

.spexo-ai-prompt-submit.is-processing img {
    animation: spexo-ai-rotate-pulse 2s infinite ease-in-out;
}

.spexo-ai-prompt-submit.is-processing::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 8px;
    background: transparent;
    animation: spexo-ai-pulse 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
    z-index: -1;
}

.spexo-ai-prompt-submit img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* Error Messages */
.spexo-ai-error-message {
    background: #fff5f5;
    color: #dc3545;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 8px 0;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease;
}

.spexo-ai-error-message a {
    color: #0073aa;
    text-decoration: underline;
    white-space: nowrap;
    margin-left: 10px;
}

.spexo-ai-error-message a:hover {
    color: #005177;
}

/* Success Messages */
.spexo-ai-success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin: 8px 0;
    font-size: 13px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Spinner */
.spexo-ai-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spexo-ai-spin 1s linear infinite;
}

@keyframes spexo-ai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spexo-ai-spinner-inline {
    margin-left: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .spexo-ai-buttons-wrapper {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .spexo-ai-generate-btn,
    .spexo-ai-change-btn {
        justify-content: center;
        width: 100%;
    }
    
    .spexo-ai-prompt-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .spexo-ai-prompt-input {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .spexo-ai-prompt-input {
        background: #2d3748;
        border-color: #4a5568;
        color: white;
    }
    
    .spexo-ai-prompt-input:focus {
        border-color: #667eea;
        background: #2d3748;
    }
    
    .spexo-ai-prompt-cancel,
    .spexo-ai-prompt-submit {
        background: #2d3748;
        border-color: #4a5568;
        color: white;
    }
    
    .spexo-ai-prompt-cancel:hover {
        background: #4a5568;
    }
    
    .spexo-ai-prompt-submit:hover {
        background: #4a5568;
    }
    
    .spexo-ai-prompt-examples {
        color: #a0aec0;
    }
    
    .spexo-ai-prompt-examples strong {
        color: #e2e8f0;
    }
}
