/* ============================================================
   misacform.ai.css — AI document extraction styles
   ============================================================ */

/* ── AI Extract button ─────────────────────────────────────── */
.misac-ai-extract-btn {
    white-space: nowrap;
}

/* ── AI Process toggle (upload ai_process flag) ────────────── */
.misac-ai-process-toggle {
    white-space: nowrap;
}
.misac-ai-process-toggle--on {
    color: #7c3aed !important;
    border-color: rgba(124, 58, 237, 0.5) !important;
}
.misac-ai-process-toggle--on:hover {
    background: rgba(124, 58, 237, 0.07) !important;
}
.misac-ai-process-toggle--off {
    opacity: 0.45;
}
[data-theme="dark"] .misac-ai-process-toggle--on {
    color: #a78bfa !important;
    border-color: rgba(167, 139, 250, 0.5) !important;
}
[data-theme="dark"] .misac-ai-process-toggle--on:hover {
    background: rgba(167, 139, 250, 0.07) !important;
}

/* ── Overwrite checkbox label ──────────────────────────────── */
.misac-ai-overwrite-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0 6px;
    white-space: nowrap;
    user-select: none;
}
.misac-ai-overwrite-label input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
}

/* ── Status banner ─────────────────────────────────────────── */
.misac-ai-status-banner {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 4px;
    margin-top: 6px;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.misac-ai-banner-text {
    flex: 1 1 auto;
}

.misac-ai-status-polling {
    background: #fff8e6;
    color: #7a5700;
    border: 1px solid #ffc107;
}

.misac-ai-status-completed {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #81c784;
}

.misac-ai-status-failed {
    background: #fdecea;
    color: #7f1d1d;
    border: 1px solid #ef9a9a;
}

.misac-ai-status-timeout {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* Banner action buttons */
.misac-ai-cancel,
.misac-ai-retry,
.misac-ai-dismiss {
    padding: 0 4px;
    font-size: 0.8125rem;
    line-height: 1;
    flex-shrink: 0;
}
.misac-ai-dismiss {
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    opacity: 0.6;
}
.misac-ai-dismiss:hover {
    opacity: 1;
}

/* Document overview text (completed state) */
.misac-ai-overview {
    display: block;
    width: 100%;
    margin-top: 3px;
    font-size: 0.75rem;
    color: #4b7e55;
    font-style: italic;
}

/* ── AI select suggestion pill ─────────────────────────────── */
.misac-ai-select-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    padding: 3px 8px 3px 6px;
    background: rgba(124, 58, 237, 0.07);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 4px;
    font-size: 0.75rem;
    color: #5b21b6;
    max-width: 100%;
}

.misac-ai-brand-icon {
    vertical-align: middle;
    flex-shrink: 0;
}
.misac-ai-process-toggle .misac-ai-brand-icon,
.misac-ai-extract-btn .misac-ai-brand-icon {
    margin-right: 2px;
}

.misac-ai-select-hint .fa-magic {
    font-size: 0.72rem;
    color: #7c3aed;
    flex-shrink: 0;
}

.misac-ai-select-hint-label {
    font-weight: 600;
    flex-shrink: 0;
    color: #7c3aed;
}

.misac-ai-select-hint-value {
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    min-width: 0;
}

.misac-ai-select-hint-dismiss {
    background: none;
    border: none;
    padding: 0 0 0 2px;
    cursor: pointer;
    color: #7c3aed;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.5;
    flex-shrink: 0;
}
.misac-ai-select-hint-dismiss:hover { opacity: 1; }

/* ── AI-filled field highlight ─────────────────────────────── */
.misac-ai-filled,
.misac-ai-filled.form-control,
.misac-ai-filled.form-select {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ── Fuzzy-match hint ──────────────────────────────────────── */
.misac-ai-hint {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    color: #6c757d;
    font-style: italic;
}

/* ── Dark theme ────────────────────────────────────────────── */
[data-theme="dark"] .misac-ai-status-polling {
    background: #332900;
    color: #ffd54f;
    border-color: #7a5700;
}
[data-theme="dark"] .misac-ai-status-completed {
    background: #1a2e1a;
    color: #81c784;
    border-color: #2e7d32;
}
[data-theme="dark"] .misac-ai-status-failed {
    background: #2d1111;
    color: #ef9a9a;
    border-color: #7f1d1d;
}
[data-theme="dark"] .misac-ai-status-timeout {
    background: #1f2937;
    color: #d1d5db;
    border-color: #4b5563;
}
[data-theme="dark"] .misac-ai-select-hint {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.3);
    color: #c4b5fd;
}
[data-theme="dark"] .misac-ai-select-hint .fa-magic,
[data-theme="dark"] .misac-ai-select-hint-label,
[data-theme="dark"] .misac-ai-select-hint-dismiss {
    color: #a78bfa;
}

[data-theme="dark"] .misac-ai-overwrite-label {
    color: #9ca3af;
}
[data-theme="dark"] .misac-ai-hint {
    color: #9ca3af;
}
[data-theme="dark"] .misac-ai-overview {
    color: #6ee7b7;
}
[data-theme="dark"] .misac-ai-filled,
[data-theme="dark"] .misac-ai-filled.form-control {
    border-color: #a78bfa !important;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.22) !important;
}
