/**
 * Document Accessibility Checker — AI Explain Styles
 *
 * @version 1.0.0
 *
 * Namespaced with docac- to avoid conflicts with web checker.
 * Uses same purple AI gradient as web checker for brand consistency.
 */

/* ============================================================================
   AI EXPLAIN BUTTON
   Placed inside each issue card, before "Show in Preview"
   ============================================================================ */

.docac-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 4px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    font-family: inherit;
}

.docac-ai-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    color: #fff;
}

.docac-ai-btn:active {
    transform: translateY(0);
}

.docac-ai-btn:focus {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

.docac-ai-btn.docac-ai-active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* Loading state */
.docac-ai-btn.docac-ai-loading {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}

.docac-ai-btn.docac-ai-loading .docac-ai-btn-icon {
    animation: docac-ai-spin 1s linear infinite;
}

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

/* ============================================================================
   AI RESPONSE BOX
   ============================================================================ */

.docac-ai-response {
    margin: 12px 0;
    padding: 0;
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid #6366f1;
    border-radius: 0 6px 6px 0;
    overflow: hidden;
}

.docac-ai-response-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 13px;
    color: #a5b4fc;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.docac-ai-response-header svg {
    flex-shrink: 0;
    stroke: #a5b4fc;
}

.docac-ai-error-header {
    color: #f87171;
}

.docac-ai-cached {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.6;
    cursor: help;
}

.docac-ai-response-body {
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.78);
}

/* Code blocks in AI response */
.docac-ai-response-body pre.docac-ai-code {
    margin: 10px 0;
    padding: 12px;
    background: #111827;
    color: #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.docac-ai-response-body pre.docac-ai-code code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.docac-ai-response-body code.docac-ai-inline-code {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.docac-ai-response-body strong {
    color: #fff;
    font-weight: 600;
}

/* ============================================================================
   LOADING ANIMATION (3 dots)
   ============================================================================ */

.docac-ai-response-loading {
    padding: 18px;
    text-align: center;
}

.docac-ai-dots {
    display: inline-flex;
    gap: 5px;
}

.docac-ai-dots span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: docac-ai-bounce 1.4s ease-in-out infinite;
}

.docac-ai-dots span:nth-child(1) { animation-delay: 0s; }
.docac-ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.docac-ai-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes docac-ai-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================================
   CONTEXT: MANUAL REVIEW TAB — button at bottom of .docac-manual-item
   ============================================================================ */

.docac-manual-item .docac-ai-btn {
    margin: 8px 0 4px;
}

.docac-manual-item .docac-ai-response {
    margin: 8px 0 4px;
}