/**
 * Bilanzo Support Chat: Entwurfsschutz und Anmeldehinweis.
 * Abstaende nach Fibonacci: 3, 5, 8, 13, 21, 34.
 *
 * @package JiraSupport
 */

.bz-chat-guard {
    padding: 0 13px;
    font-size: 13px;
    line-height: 1.45;
}

/* Anmeldehinweis: ruhig, frueh, blockiert nichts. */
.bz-chat-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    margin: 0 0 8px;
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.21);
    background: rgba(37, 99, 235, 0.08);
    color: #1e3a8a;
}

.bz-chat-notice[hidden] { display: none; }

.bz-chat-notice-text { flex: 1 1 auto; }

.bz-chat-notice-link {
    font-weight: 600;
    color: #1d4ed8;
    text-decoration: underline;
    border-radius: 3px;
}

.bz-chat-notice-link:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.bz-chat-notice-hint {
    flex: 1 0 100%;
    font-size: 11px;
    opacity: 0.75;
}

/* Zwei Fenster schreiben gleichzeitig. Nichts wird ueberschrieben. */
.bz-chat-conflict {
    margin: 0 0 8px;
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid rgba(180, 83, 9, 0.26);
    background: rgba(245, 158, 11, 0.1);
    color: #7c2d12;
}

.bz-chat-conflict[hidden] { display: none; }

.bz-chat-conflict-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.bz-chat-mini {
    padding: 3px 8px;
    font-size: 11px;
    font-family: inherit;
    line-height: 1.6;
    color: #7c2d12;
    background: #fff;
    border: 1px solid rgba(180, 83, 9, 0.34);
    border-radius: 5px;
    cursor: pointer;
}

.bz-chat-mini:hover { background: rgba(245, 158, 11, 0.13); }

.bz-chat-mini:focus-visible {
    outline: 2px solid #b45309;
    outline-offset: 2px;
}

.bz-chat-conflict-body {
    margin: 5px 0 0;
    padding: 5px 8px;
    max-height: 89px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 12px;
    background: #fff;
    border-radius: 5px;
}

.bz-chat-conflict-body[hidden] { display: none; }

/* Zustandszeile. Wird vorgelesen. */
.bz-chat-status {
    min-height: 13px;
    margin: 0 0 3px;
    font-size: 11px;
    color: #475569;
}

.bz-chat-status.is-ok { color: #15803d; }
.bz-chat-status.is-warn { color: #b45309; }
.bz-chat-status.is-error { color: #b91c1c; }
.bz-chat-status.is-busy { color: #1d4ed8; }

.bz-chat-hint {
    margin: 0 0 5px;
    font-size: 11px;
    color: #64748b;
}

/* Das Feld ist jetzt ein textarea und waechst mit. */
textarea.jira-chat-input {
    resize: none;
    overflow-y: auto;
    min-height: 34px;
    max-height: 144px;
    line-height: 1.45;
    font-family: inherit;
    font-size: inherit;
}

textarea.jira-chat-input:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 1px;
}

/* Der Knopf zeigt, dass gesendet wird. */
.jira-chat-send-btn:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.jira-chat-send-btn.is-sending svg { display: none; }

.jira-chat-send-btn.is-sending::after {
    content: '';
    display: block;
    width: 13px;
    height: 13px;
    margin: 0 auto;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bz-chat-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .jira-chat-send-btn.is-sending::after { animation-duration: 2.4s; }
}

/* Dunkler Modus des Chats. */
body.chatbot-dark-mode .bz-chat-notice {
    background: rgba(37, 99, 235, 0.21);
    border-color: rgba(96, 165, 250, 0.34);
    color: #dbeafe;
}

body.chatbot-dark-mode .bz-chat-notice-link { color: #93c5fd; }

body.chatbot-dark-mode .bz-chat-conflict {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(251, 191, 36, 0.34);
    color: #fed7aa;
}

body.chatbot-dark-mode .bz-chat-mini {
    background: #1f2937;
    color: #fed7aa;
    border-color: rgba(251, 191, 36, 0.34);
}

body.chatbot-dark-mode .bz-chat-conflict-body {
    background: #111827;
    color: #e5e7eb;
}

body.chatbot-dark-mode .bz-chat-status { color: #cbd5e1; }
body.chatbot-dark-mode .bz-chat-status.is-ok { color: #86efac; }
body.chatbot-dark-mode .bz-chat-status.is-warn { color: #fcd34d; }
body.chatbot-dark-mode .bz-chat-status.is-error { color: #fca5a5; }
body.chatbot-dark-mode .bz-chat-status.is-busy { color: #93c5fd; }
body.chatbot-dark-mode .bz-chat-hint { color: #94a3b8; }
