/* themes/livechat.css - Live-Chat-Box: dunkler Kopf mit Status, Avatare, Blasen mit spitzer Ecke, Trennlinien */

html.theme-livechat {
    --p: #1fb889; --s: #ffffff; --ol: #d8dee8; --onp: #ffffff;
    --txt: #1f2a44; --muted: #8a94a6; --chip-bg: #e3f7ef; --chip-txt: #0f8a63;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --head: linear-gradient(160deg, #1f2a44 0%, #2c3c60 100%);
    /* Farben, die das Script-Tag beim Einbetten überschreiben kann (data-header-color, data-button-color) */
    --head-h: 70px;   /* Kopf auf Anmeldeseite und im Chat gleich hoch */
    --head-bg: var(--head); --head-txt: #fff; --head-sub: rgba(255, 255, 255, .65); --head-pill: #3d5080;
    --accent: #1fb889; --accent-txt: #fff; --link: #0f8a63;
    --send-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z'/%3E%3C/svg%3E");
    min-height: 100%;
    background: #f7f8fa;
}
.theme-livechat body { background: transparent; font-size: 14px; line-height: 19px; }
.theme-livechat a { color: var(--link); }
.theme-livechat ::-webkit-scrollbar { width: 6px; height: 6px; }
.theme-livechat ::-webkit-scrollbar-track { background: transparent; box-shadow: none; }
.theme-livechat ::-webkit-scrollbar-thumb { background: #c5ccd8; border-radius: 3px; }
.theme-livechat * { scrollbar-color: #c5ccd8 transparent; scrollbar-width: thin; }

/* ---------- Box unten rechts */
.theme-livechat #app {
    position: fixed; right: 20px; bottom: 20px; width: 400px; height: min(620px, calc(100vh - 40px));
    display: flex; flex-direction: column; background: #f2f4f7; border-radius: 10px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 25, 45, .25), 0 1px 3px rgba(15, 25, 45, .15);
}
.theme-livechat #wrapper { display: contents; }   /* Kopf, Menüleiste, Verlauf, Eingabe als Geschwister im Fenster */
.theme-livechat #menu { order: 1; }
.theme-livechat #header { order: 2; display: flex; align-items: center; gap: 2px; height: 38px; padding: 0 8px; background: #fff; border-bottom: 1px solid #e3e7ee; }
.theme-livechat #header .logout { margin-inline-start: auto; }
.theme-livechat #mydiv { order: 3; }
.theme-livechat #chatbox { order: 4; }
.theme-livechat #msgform { order: 5; }
.theme-livechat .footer-line { order: 6; }

/* Kopf: Avatar mit Online-Punkt, Raum, Begrüßung */
.theme-livechat #menu { padding: 0 16px; background: var(--head-bg); color: var(--head-txt); display: flex; align-items: center; }
.theme-livechat #menu .welcome { flex: 1; min-width: 0; }
/* feste Höhe für beide Köpfe; ID-Gewichtung, damit keine Retro-Regel (#loginform p ...) dazwischenfunkt */
html.theme-livechat #menu {
    height: var(--head-h); min-height: 0; padding-top: 0; padding-bottom: 0; box-sizing: border-box;
}
/* Anmeldeseite: geklonter Kopf statt der Marke; gleiche Schrift wie auf der Chatseite (body) */
html.theme-livechat #loginform #menu { font-size: 14px; line-height: 19px; }
html.theme-livechat #loginform p.brand { display: none !important; }
html.theme-livechat .w-avatar { width: 42px; height: 42px; flex: 0 0 42px; box-sizing: border-box; }
.theme-livechat .welcome { display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 12px; align-items: center; }
.theme-livechat .brand .w-avatar { flex: 0 0 42px; }
.theme-livechat .w-avatar, .theme-livechat .brand .w-avatar {
    grid-column: 1; grid-row: 1 / span 2; position: relative; width: 42px; height: 42px; border-radius: 50%;
    background-color: var(--head-pill); color: var(--head-txt); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .15);
}
.theme-livechat .w-avatar::before { content: attr(data-initial); }
.theme-livechat .w-avatar.has-img::before { content: none; }
.theme-livechat a.w-avatar:hover { box-shadow: 0 0 0 2px #3ddc97; }
.theme-livechat .w-avatar::after {
    content: ""; position: absolute; inset-inline-end: -1px; bottom: -1px; width: 10px; height: 10px;
    border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 2px #24314f;
}
.theme-livechat .w-room { grid-column: 2; grid-row: 1; font-size: 15px; line-height: 20px; font-weight: 600; }
.theme-livechat .w-room a { color: var(--head-txt); }
.theme-livechat .w-hello { grid-column: 2; grid-row: 2; font-size: 12px; line-height: 17px; color: var(--head-sub); }
.theme-livechat .w-hello b { font-weight: 400; }

.theme-livechat #header .tlink { padding: 5px 10px; border-radius: 4px; color: #1f2a44; font-size: 13px; font-weight: 500; }
.theme-livechat #header .tlink:hover { background: #f2f4f7; color: var(--link); }
.theme-livechat #mydiv { padding: 7px 14px; background: #fff; border-bottom: 1px solid #e3e7ee; font-size: 12px; color: #5b6476; }
.theme-livechat #mydiv .tlink { display: inline-block; margin: 2px; padding: 2px 8px; border: 1px solid #d8dee8; border-radius: 4px; color: #1f2a44; }
.theme-livechat #mydiv .tlink:hover { border-color: var(--accent); color: var(--link); }

/* ---------- Verlauf: Avatar links, Blase, Zeit darunter */
.theme-livechat #chatbox { flex: 1; min-height: 0; padding: 14px 16px 8px; background: #f2f4f7; }
.theme-livechat .msgln:not(.sysln) {
    display: grid; grid-template-columns: 30px minmax(0, auto) 1fr; column-gap: 8px; align-items: end;
    grid-template-areas: "av name ip" "av quote quote" "av text text" ". ts ts"; margin: 0 0 10px; max-width: 88%;
}
.theme-livechat .msgln:not(.sysln)::before {
    content: attr(data-initial); grid-area: av; align-self: end; width: 30px; height: 30px; border-radius: 50%;
    background: hsl(var(--hue) 45% 55%); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.theme-livechat .name_link { grid-area: name; font-size: 11px; line-height: 16px; color: #8a94a6; padding-inline-start: 4px; }
.theme-livechat .msgln:not(.sysln) .ip { grid-area: ip; padding-inline-start: 6px; line-height: 16px; }
.theme-livechat .msgln:not(.sysln) .ip a { color: #a9b1c0; }
.theme-livechat .m-quote { grid-area: quote; justify-self: start; margin: 2px 0 4px; padding: 6px 10px; border-inline-start: 3px solid var(--accent); background: #e6eaf0; border-radius: 10px; border-start-start-radius: 4px; border-end-start-radius: 4px; font-size: 12px; line-height: 16px; color: #5b6476; }
.theme-livechat .m-quote small { font-size: inherit; }
.theme-livechat .m-qname { display: block; font-weight: 600; color: #1f2a44; }
.theme-livechat .msgln:not(.sysln) .m-text {
    grid-area: text; justify-self: start; padding: 9px 13px; background: #fff; color: #1f2a44;
    border: 1px solid #e3e7ee; border-radius: 14px; border-end-start-radius: 4px; box-shadow: 0 1px 1px rgba(15, 25, 45, .04);
}
.theme-livechat .m-ts { grid-area: ts; justify-self: start; padding-block-start: 3px; padding-inline-start: 4px; font-size: 11px; line-height: 14px; }
.theme-livechat .m-ts a { color: #a9b1c0; }

/* eigene Nachrichten: rechts, ohne Avatar, Akzentfarbe */
.theme-livechat .msgln.own { grid-template-columns: 1fr; grid-template-areas: "quote" "text" "ts"; margin-inline-start: auto; justify-items: end; }
.theme-livechat .msgln.own::before, .theme-livechat .own .name_link { display: none; }
.theme-livechat .own .m-quote { justify-self: end; }
.theme-livechat .msgln.own:not(.sysln) .m-text { justify-self: end; background: var(--accent); color: var(--accent-txt); border-color: var(--accent); border-radius: 14px; border-end-end-radius: 4px; }
.theme-livechat .own .m-ts { justify-self: end; padding-block-start: 3px; padding-inline-end: 4px; }
.theme-livechat .botmsg::before { background: #1f2a44 !important; }

/* Systemhinweise als Trennlinie */
.theme-livechat .sysln { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: #8a94a6; font-size: 11px; line-height: 15px; background: none; text-align: center; }
.theme-livechat .sysln::before, .theme-livechat .sysln::after { content: ""; flex: 1; height: 1px; background: #dde2ea; }
.theme-livechat .sysln i { flex: 0 1 auto; max-width: 75%; }
.theme-livechat .sysln .m-ts { display: none; }
.theme-livechat .sysln .ip a { color: #a9b1c0; }
.theme-livechat .sysln.deleted { font-style: italic; }

/* Eingabe: Pille und runder Senden-Knopf */
.theme-livechat #msgform { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #e3e7ee; }
.theme-livechat #usermsg { height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 20px; background: #f2f4f7; color: #1f2a44; font-size: 14px; }
.theme-livechat #usermsg:focus { border-color: var(--accent); background: #fff; box-shadow: none; }
.theme-livechat #submitmsg {
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; font-size: 0; color: transparent; cursor: pointer;
    background: var(--accent) var(--send-icon) center / 20px no-repeat;
}
.theme-livechat #submitmsg:hover { filter: brightness(.92); }
.theme-livechat .footer-line { padding: 5px 12px 7px; background: #fff; font-size: 10.5px; line-height: 14px; color: #a9b1c0; text-align: center; }
.theme-livechat .footer-line .tlink { color: #8a94a6; margin: 0 3px; }

/* ---------- Anmeldung: dieselbe Box */
.theme-livechat #loginform {
    top: auto; left: auto; right: 20px; bottom: 20px; transform: none; width: 400px; max-width: calc(100vw - 24px);
    background: #f2f4f7; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(15, 25, 45, .25), 0 1px 3px rgba(15, 25, 45, .15);
}
.theme-livechat .login-box { padding: 18px 0; border: 0; background: #fff; color: #1f2a44; }
.theme-livechat .brand { margin: 0 0 16px !important; padding: 0 16px; background: var(--head-bg); display: flex; align-items: center; gap: 12px; }
.theme-livechat .brand a, .theme-livechat .brand b { min-width: 0; color: var(--head-txt); font-size: 15px; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-livechat .login-box form > *:not(.brand) { margin-left: 16px !important; margin-right: 16px !important; width: auto; }
.theme-livechat .login-box #name { width: calc(100% - 32px); }
.theme-livechat #loginform label { font-size: 12px; color: #5b6476; margin-bottom: 6px; font-weight: 600; }
.theme-livechat #name, .theme-livechat #chat_room_id { height: 40px; padding: 0 12px; border: 1px solid #d8dee8; border-radius: 8px; background: #fff; color: #1f2a44; font-size: 14px; }
.theme-livechat #name:focus, .theme-livechat #chat_room_id:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 184, 137, .15); }
.theme-livechat #enter { height: 40px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-txt); font-size: 14px; font-weight: 600; cursor: pointer; }
.theme-livechat #enter:hover { filter: brightness(.92); }
.theme-livechat .room-box { margin: 0; padding: 14px 16px 18px; background: #f2f4f7; color: #5b6476; border: 0; border-top: 1px solid #e3e7ee; }
.theme-livechat #copy, .theme-livechat #change_create, .theme-livechat #new_id, .theme-livechat #help {
    height: 32px; padding: 0 12px; border: 1px solid #d8dee8; border-radius: 6px; background: #fff; color: #1f2a44; font-size: 13px; cursor: pointer;
}
.theme-livechat #copy:hover, .theme-livechat #change_create:hover, .theme-livechat #new_id:hover, .theme-livechat #help:hover { border-color: var(--accent); color: #0f8a63; }
.theme-livechat #footer { left: 20px; right: auto; bottom: 20px; text-align: left; color: #8a94a6; font-size: 12px; }
.theme-livechat #footer .tlink { color: #5b6476; margin: 0 4px; }

/* ---------- Dialoge */
.theme-livechat .pop_overlay:target { background: rgba(15, 25, 45, .45); }
.theme-livechat .popup { padding: 0 0 18px; background: #fff; border: 0; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(15, 25, 45, .3); color: #5b6476; min-height: 0; }
.theme-livechat .popup h3 { height: auto; margin: 0 0 14px; padding: 14px 18px; background: var(--head-bg); color: var(--head-txt); font-size: 15px; line-height: 20px; font-weight: 600; }
.theme-livechat .popup .pop_content { color: #5b6476; font-size: 13px; line-height: 19px; }
.theme-livechat .pop_content p { margin: 0 18px 6px; }
.theme-livechat .popup center { text-align: end; padding: 0 18px; }
.theme-livechat .popup center .tlink { display: inline-block; margin-left: 6px; padding: 7px 16px; border: 1px solid #d8dee8; border-radius: 6px; color: #1f2a44; font-size: 13px; }
.theme-livechat .popup center .tlink:first-of-type { background: var(--accent); border-color: var(--accent); color: var(--accent-txt); }
.theme-livechat .tlink-inline { color: var(--link); font-weight: 600; }
.theme-livechat .pop-field { height: 34px; padding: 0 10px; border: 1px solid #d8dee8; border-radius: 6px; background: #fff; color: #1f2a44; }
.theme-livechat .pop-btn { height: 34px; padding: 0 14px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-txt); font-weight: 600; cursor: pointer; }
.theme-livechat .keybox { background: #e3f7ef; color: #0f8a63; padding: 2px 6px; border-radius: 4px; }

html.embed.theme-livechat .embed-x { top: 20px; inset-inline-end: 14px; }   /* mittig im 70-px-Kopf */

@media only screen and (max-width: 600px) {
    .theme-livechat #app { inset: 0; width: auto; height: auto; border-radius: 0; }
    .theme-livechat #loginform { right: 10px; left: 10px; bottom: 50px; width: auto; max-width: none; }
    .theme-livechat #footer { left: 0; right: 0; bottom: 14px; text-align: center; }
}
