/**
 * AI Auto-fill Section Styles
 * Styling for the auto-fill button, loading states, and auto-filled field indicators
 */

/* ============================================
   AUTO-FILL BUTTON
   ============================================ */
.ai-autofill-btn-wrap {
    margin-top: 10px;
}

.ai-autofill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.ai-autofill-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.ai-autofill-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.ai-autofill-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ai-autofill-btn svg {
    flex-shrink: 0;
}

/* Loading state */
.ai-autofill-btn.ai-autofill-loading-state {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    box-shadow: none;
}

/* Success state */
.ai-autofill-btn.ai-autofill-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.ai-autofill-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: #f0f9ff;
    border-radius: 6px;
    font-size: 13px;
    color: #0369a1;
}

.ai-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #bfdbfe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   AUTO-FILLED FIELD STYLES
   ============================================ */

/* Green border for auto-filled fields */
.ai-autofilled-field,
textarea.ai-autofilled-field,
input.ai-autofilled-field,
.ai-autofilled-field input,
.ai-autofilled-field textarea {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    transition: all 0.3s ease;
}

/* For radio/checkbox containers */
.js-question-field-container.ai-autofilled-field {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.js-question-field-container.ai-autofilled-field .radio label {
    background-color: #ecfdf5;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 2px 0;
}

/* Auto-filled label */
.ai-autofilled-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 10px;
    background-color: #d1fae5;
    color: #047857;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.ai-autofilled-label svg {
    flex-shrink: 0;
    stroke: #047857;
}

/* ============================================
   ANIMATION FOR AUTO-FILL
   ============================================ */
@keyframes ai-autofill-highlight {
    0% {
        background-color: #bbf7d0;
    }
    100% {
        background-color: #ecfdf5;
    }
}

.ai-autofilled-field {
    animation: ai-autofill-highlight 0.5s ease-out;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 768px) {
    .ai-autofill-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .ai-autofill-loading {
        font-size: 12px;
    }
}

/* ============================================
   DARK MODE SUPPORT (if applicable)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .ai-autofill-loading {
        background-color: #1e3a5f;
        color: #7dd3fc;
    }
    
    .ai-autofilled-field,
    textarea.ai-autofilled-field,
    input.ai-autofilled-field {
        background-color: #064e3b !important;
        border-color: #10b981 !important;
    }
    
    .ai-autofilled-label {
        background-color: #064e3b;
        color: #6ee7b7;
    }
}
