/********** Schwebende Elemente: WhatsApp-Knopf und Chat-Attrappe **********/
/* Struktur und Klassennamen uebernommen von der PcMac-Profi-Seite,
   Farben auf Issler umgestellt. Der Chat ist ein Platzhalter ohne Funktion. */

.pcmac-chat {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px));
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: 'Ubuntu', sans-serif;
    /* Der Stapel selbst faengt keine Klicks ab, sonst liegt sein unsichtbarer
       Panel-Bereich ueber dem Pfeil nach oben. Nur die Kinder sind klickbar. */
    pointer-events: none;
}
.pcmac-chat > * { pointer-events: auto; }


/* ---- Nach oben mit Fortschrittsring ---- */
.scroll-top {
    position: relative;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 38, .22);
    cursor: pointer;
    display: grid; place-items: center;
    opacity: 0; visibility: hidden; transform: translateY(14px);
    transition: opacity .3s ease, visibility .3s, transform .3s ease, box-shadow .18s ease;
}
.scroll-top.sichtbar { opacity: 1; visibility: visible; transform: none; }
.scroll-top:hover { box-shadow: 0 12px 28px rgba(15, 23, 38, .3); }
.scroll-top:focus-visible { outline: 3px solid var(--signal, #FFD400); outline-offset: 3px; }
.scroll-top .progress-circle { position: absolute; inset: 0; width: 100%; height: 100%; }
.scroll-top .progress-circle path {
    fill: none;
    stroke: var(--primary, #2A4B9A);
    stroke-width: 10;
    transition: stroke-dashoffset 60ms linear;
}
.scroll-top .pfeil { position: relative; z-index: 1; width: 19px; height: 19px; fill: var(--primary, #2A4B9A); }

/* ---- Knoepfe ---- */
.pcmac-chat-fab,
.pcmac-wa-fab {
    position: relative;
    width: 58px; height: 58px;
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 38, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.pcmac-chat-fab:hover,
.pcmac-wa-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15, 23, 38, .34); }

.pcmac-chat-fab { background: var(--primary, #2A4B9A); }
.pcmac-wa-fab   { background: #25D366; }

.pcmac-chat-fab svg,
.pcmac-wa-fab svg { width: 27px; height: 27px; fill: #fff; }
.pcmac-chat-fab .icon-close { display: none; }
.pcmac-chat.offen .pcmac-chat-fab .icon-chat { display: none; }
.pcmac-chat.offen .pcmac-chat-fab .icon-close { display: block; }

.pcmac-chat-fab-dot {
    position: absolute; top: 4px; right: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--signal, #FFD400);
    border: 2px solid #fff;
    animation: pcmacPuls 2.4s ease-in-out infinite;
}
@keyframes pcmacPuls {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.22); opacity: .6; }
}

/* ---- Sprechblase am Knopf ---- */
.pcmac-wa-label,
.pcmac-chat-label {
    position: absolute; right: 70px; top: 50%; transform: translateY(-50%);
    white-space: nowrap; font-size: 13.5px; font-weight: 600;
    background: #fff; color: var(--dark, #0F1726);
    padding: 7px 13px; border-radius: 999px;
    box-shadow: 0 4px 14px rgba(15, 23, 38, .18);
    opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.pcmac-wa-fab:hover .pcmac-wa-label,
.pcmac-chat-fab:hover .pcmac-chat-label { opacity: 1; transform: translateY(-50%) translateX(-4px); }
/* Auf schmalen Geraeten gibt es kein Ueberfahren, die Blasen entfallen. */
@media (max-width: 767.98px), (hover: none) {
    .pcmac-wa-label, .pcmac-chat-label { display: none; }
}

/* ---- Chatfenster ---- */
.pcmac-chat-panel {
    width: min(340px, calc(100vw - 40px));
    background: #fff;
    border: 1px solid var(--linie, #D6DDE9);
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(15, 23, 38, .24);
    overflow: hidden;
    transform-origin: bottom right;
    opacity: 0; transform: translateY(12px) scale(.96);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s cubic-bezier(.22,.7,.3,1);
}
.pcmac-chat.offen .pcmac-chat-panel { opacity: 1; transform: none; pointer-events: auto; }

.pcmac-chat-head {
    display: flex; align-items: center; gap: 11px;
    padding: 14px 16px;
    background: var(--secondary, #152653); color: #fff;
}
.pcmac-chat-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--primary, #2A4B9A); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Barlow', sans-serif; font-weight: 700; font-size: 14px; letter-spacing: .04em;
    flex: 0 0 auto;
}
.pcmac-chat-head-text { min-width: 0; }
.pcmac-chat-head-title { margin: 0; font-family: 'Barlow', sans-serif; font-weight: 700; font-size: 15px; color: #fff; }
.pcmac-chat-head-sub   { margin: 0; font-size: 12.5px; color: rgba(255,255,255,.7); }

.pcmac-chat-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--light, #EEF1F7); }
.pcmac-chat-msg {
    max-width: 88%; padding: 10px 13px; border-radius: 12px; font-size: 14.5px; line-height: 1.5;
}
.pcmac-chat-msg.bot { background: #fff; color: var(--dark, #0F1726); border: 1px solid var(--linie, #D6DDE9); border-bottom-left-radius: 4px; }
.pcmac-chat-msg.ich { background: var(--primary, #2A4B9A); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.pcmac-chat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.pcmac-chat-chip {
    background: #fff; border: 1px solid var(--linie, #D6DDE9); color: var(--primary, #2A4B9A);
    font: inherit; font-size: 13px; font-weight: 600;
    padding: 6px 12px; border-radius: 999px; cursor: pointer;
    transition: border-color .16s, background-color .16s, color .16s;
}
.pcmac-chat-chip:hover { border-color: var(--primary, #2A4B9A); background: var(--primary, #2A4B9A); color: #fff; }

.pcmac-chat-foot { display: flex; gap: 8px; padding: 12px 16px; background: #fff; border-top: 1px solid var(--linie, #D6DDE9); }
.pcmac-chat-input {
    flex: 1 1 auto; min-width: 0; font: inherit; font-size: 14px;
    padding: 9px 12px; border: 1px solid var(--linie, #D6DDE9); border-radius: 999px; background: var(--light, #EEF1F7);
    color: var(--dark, #0F1726);
}
.pcmac-chat-input:focus { outline: none; border-color: var(--primary, #2A4B9A); }
.pcmac-chat-send {
    flex: 0 0 auto; width: 38px; height: 38px; border: none; border-radius: 50%;
    background: var(--primary, #2A4B9A); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pcmac-chat-send svg { width: 17px; height: 17px; fill: #fff; }

.pcmac-chat-hint { padding: 10px 16px 13px; font-size: 12px; color: #7b879f; background: #fff; }

@media (prefers-reduced-motion: reduce) {
    .pcmac-chat-fab, .pcmac-wa-fab, .pcmac-chat-panel, .pcmac-chat-fab-dot,
    .pcmac-wa-label, .pcmac-chat-label { animation: none !important; transition: none !important; }
}
