/* ============================================================
   Heimbach Bedachungen - Auftrags-Aufnahme-Assistent
   Nutzt ausschliesslich die Theme-Variablen aus style.css,
   damit Hell und Dunkel automatisch mitgehen.
   ============================================================ */

/* === Schaltflaeche unten rechts === */
.hb-chat-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 14px 16px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px -8px rgba(255, 107, 26, 0.55);
    transition: transform var(--transition), background var(--transition);
}
.hb-chat-bubble:hover  { background: var(--accent-hover); transform: translateY(-2px); }
.hb-chat-bubble:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 3px; }
.hb-chat-bubble svg    { width: 22px; height: 22px; flex: none; }
.hb-chat-bubble[hidden] { display: none; }

/* === Fenster === */
.hb-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 950;
    width: min(400px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-body);
    color: var(--text);
}
.hb-chat-panel[hidden] { display: none; }

@media (max-width: 560px) {
    .hb-chat-panel {
        right: 0; bottom: 0; left: 0;
        width: 100%; height: 100dvh;
        border-radius: 0; border: none;
    }
    .hb-chat-bubble { right: 16px; bottom: 16px; }
}

/* === Kopf === */
.hb-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.hb-chat-head-text  { flex: 1; min-width: 0; }
.hb-chat-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}
.hb-chat-head p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
}
.hb-chat-close {
    flex: none;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.hb-chat-close:hover { background: var(--bg-soft); color: var(--text); }
.hb-chat-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* === Verlauf === */
.hb-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.hb-msg {
    max-width: 85%;
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;   /* Zeilenumbrueche aus der Antwort erhalten */
    overflow-wrap: anywhere;
}
.hb-msg-bot {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-bottom-left-radius: var(--radius-sm);
}
.hb-msg-ich {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: var(--radius-sm);
}
.hb-msg-hinweis {
    align-self: center;
    max-width: 100%;
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.hb-msg-fertig {
    align-self: stretch;
    max-width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--accent);
}

/* Tipp-Punkte */
.hb-tippt { align-self: flex-start; display: flex; gap: 5px; padding: 14px; }
.hb-tippt span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: hb-hops 1.1s infinite ease-in-out;
}
.hb-tippt span:nth-child(2) { animation-delay: .16s; }
.hb-tippt span:nth-child(3) { animation-delay: .32s; }
@keyframes hb-hops {
    0%, 70%, 100% { transform: translateY(0);    opacity: .45; }
    35%           { transform: translateY(-5px); opacity: 1; }
}

/* === Anhaenge === */
.hb-chat-anhaenge {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
}
.hb-chat-anhaenge:empty { display: none; }
.hb-anhang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
    font-size: 12.5px;
    color: var(--text-muted);
}
.hb-anhang b {
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Eingabe === */
.hb-chat-fuss {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}
.hb-chat-fuss textarea {
    flex: 1;
    min-height: 42px;
    max-height: 130px;
    padding: 11px 13px;
    resize: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.45;
}
.hb-chat-fuss textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.hb-chat-fuss textarea:disabled { opacity: .55; cursor: not-allowed; }

.hb-knopf {
    flex: none;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.hb-knopf:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.hb-knopf:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hb-knopf:disabled { opacity: .45; cursor: not-allowed; }
.hb-knopf svg { width: 19px; height: 19px; }
.hb-knopf-senden {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.hb-knopf-senden:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }

.hb-chat-hinweis {
    padding: 0 16px 12px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-dim);
    background: var(--bg-soft);
    text-align: center;
}
.hb-chat-hinweis a { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
    .hb-chat-bubble, .hb-knopf, .hb-chat-close { transition: none; }
    .hb-tippt span { animation: none; opacity: .6; }
    .hb-chat-log   { scroll-behavior: auto; }
}
