/*
 * PIT20-1392 — Chat-dokk (Messenger-szerű beszélgetőablakok minden dashboard-oldalon).
 *
 * Rétegrend (PIT20-1287 / §5.1): FAB 1030 < súgó-fül 1035 < DOKK 1038 < modal 1050.
 * ⚠️ PIT20-1489: a NYITOTT lebegő menü 1039 — a dokk fölé kerül (app.css), különben nagyításnál
 *    a gombjai az avatarok mögé csúsznak.
 * ⚠️ Mérve: a PlanIT lebegő gombja a JOBB FELSŐ sarokban ül (`fab-menu-top`), a jobb alsó
 * sarokban egyetlen éles nézet sem használ gombot — a dokk ezért a jobb alsó sarokba kerül, az
 * ablakok az avatar-oszloptól balra. A böngészős kör a számlák listáján (ahol van FAB) méri,
 * hogy semmi nem takar semmit.
 */

.chat-dock {
    --cd-bg: #ffffff;
    --cd-fg: #333333;
    --cd-muted: #8a8a8a;
    --cd-border: rgba(0, 0, 0, .12);
    --cd-head-bg: #ffffff;
    --cd-in-bg: #eef0f2;
    --cd-in-fg: #222222;
    --cd-out-bg: #2196f3;
    --cd-out-fg: #ffffff;
    --cd-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    --cd-badge: #f44336;
    --cd-online: #4caf50;
    --cd-away: #ffb300;
    --cd-hover: rgba(0, 0, 0, .05);
    --cd-window-w: 328px;
    --cd-window-h: 455px;
    --cd-rail-right: 20px;
    --cd-rail-bottom: 20px;
    --cd-gap: 8px;

    position: fixed;
    z-index: 1038;
    right: 0;
    bottom: 0;
    pointer-events: none;
    color: var(--cd-fg);
    font-size: 13px;
}

html[data-theme="dark"] .chat-dock {
    --cd-bg: #2c2d33;
    --cd-fg: #e6e6e6;
    --cd-muted: #9a9ca3;
    --cd-border: rgba(255, 255, 255, .12);
    --cd-head-bg: #33343b;
    --cd-in-bg: #3c3e46;
    --cd-in-fg: #ececec;
    --cd-out-bg: #1e88e5;
    --cd-shadow: 0 6px 24px rgba(0, 0, 0, .5);
    --cd-hover: rgba(255, 255, 255, .06);
}

.chat-dock > * { pointer-events: auto; }
.chat-dock .d-none { display: none !important; }

/* ── ablakok ─────────────────────────────────────────────────────────── */

.chat-dock-windows {
    position: fixed;
    right: calc(var(--cd-rail-right) + 64px);
    bottom: 0;
    display: flex;
    flex-direction: row-reverse;   /* a legfrissebb jobbra, az avatar-oszlop mellé */
    align-items: flex-end;
    gap: var(--cd-gap);
    pointer-events: none;
}

.chat-window {
    pointer-events: auto;
    position: relative;
    width: var(--cd-window-w);
    height: var(--cd-window-h);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: var(--cd-shadow);
    overflow: hidden;
}

.chat-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 6px 6px 8px;
    background: var(--cd-head-bg);
    border-bottom: 1px solid var(--cd-border);
    min-height: 52px;
}

/* PIT20-1448 — lefelé húzás érintőképernyőn: a fejléc saját kezelésben (a lap nem görget
 * vele), az ablak az ujjat követi. A változót a JS állítja, a rajzolás a CSS-é. */
@media (pointer: coarse) { .chat-window-header { touch-action: none; } }

/* PIT20-1475 — a fogantyú csak érintőképernyőn látszik (egérrel nem húzható). */
.chat-window-header { position: relative; }
.chat-window-grabber { display: none; }
@media (pointer: coarse) {
    .chat-window-header { padding-top: 12px; }
    .chat-window-grabber {
        display: block;
        position: absolute;
        top: 4px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 2px;
        background: var(--cd-muted);
        opacity: .45;
        pointer-events: none;
    }
}
.chat-window.is-dragging { transform: translateY(var(--cd-drag, 0)); transition: none; }

.chat-window.is-flashing .chat-window-header { animation: chatDockFlash 1s ease 2; }
@keyframes chatDockFlash { 50% { background: rgba(33, 150, 243, .18); } }

.chat-window-who { display: flex; align-items: center; min-width: 0; cursor: pointer; }
.chat-window-titles { margin-left: 8px; min-width: 0; }
.chat-window-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-window-status { font-size: 11px; color: var(--cd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-window-actions { display: flex; align-items: center; flex-shrink: 0; }

.chat-window-btn {
    border: 0;
    background: transparent;
    color: var(--cd-muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.chat-window-btn:hover { background: var(--cd-hover); color: var(--cd-fg); }
.chat-window-btn i { font-size: 15px; }
/* PIT20-1415 — az emoji-gomb FontAwesome-ikon (a karakteres emoji platformonként másképp nézett ki). */

.chat-window-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 8px 4px;
    display: flex;
    flex-direction: column;
}
.chat-window-older { align-self: center; }
.chat-window-messages { display: flex; flex-direction: column; gap: 2px; }

.chat-window-typing { font-size: 11px; color: var(--cd-muted); padding: 4px 4px 0; display: flex; align-items: center; gap: 6px; }
.chat-typing-dots { display: inline-flex; gap: 3px; }
.chat-typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--cd-muted); animation: chatTyping 1.2s infinite ease-in-out; }
.chat-typing-dots span:nth-child(2) { animation-delay: .15s; }
.chat-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes chatTyping { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-window-drop {
    position: absolute;
    inset: 52px 0 0 0;
    background: rgba(33, 150, 243, .12);
    border: 2px dashed #2196f3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 3;
    color: #1976d2;
    pointer-events: none;
}
.chat-window-drop i { font-size: 28px; }

.chat-window-panel {
    position: absolute;
    inset: 52px 0 0 0;
    background: var(--cd-bg);
    z-index: 4;
    overflow-y: auto;
}

/* ── üzenetek ────────────────────────────────────────────────────────── */

.chat-msg { display: flex; align-items: flex-end; gap: 6px; margin-top: 6px; position: relative; }
.chat-msg.is-grouped { margin-top: 1px; }
.chat-msg-in { justify-content: flex-start; }
.chat-msg-out { justify-content: flex-end; }
.chat-msg-avatar { width: 28px; flex-shrink: 0; }
.chat-msg-main { max-width: 75%; display: flex; flex-direction: column; min-width: 0; }
.chat-msg-out .chat-msg-main { align-items: flex-end; }
.chat-msg-sender { font-size: 11px; color: var(--cd-muted); margin: 0 0 2px 10px; }

.chat-msg-bubble {
    padding: 7px 11px;
    border-radius: 18px;
    background: var(--cd-in-bg);
    color: var(--cd-in-fg);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}
.chat-msg-out .chat-msg-bubble { background: var(--cd-out-bg); color: var(--cd-out-fg); }
.chat-msg-bubble.is-emoji-only { background: transparent !important; font-size: 32px; padding: 0 2px; line-height: 1.2; }
.chat-msg.is-pending { opacity: .6; }

.chat-msg-system, .chat-msg-date { text-align: center; font-size: 11px; color: var(--cd-muted); margin: 8px 0 4px; }
.chat-msg-date span { padding: 0 8px; }

.chat-msg-react {
    border: 0;
    background: transparent;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .12s;
    cursor: pointer;
    align-self: center;
    padding: 0;
}
.chat-msg:hover .chat-msg-react, .chat-msg-react:focus { opacity: .8; }
.chat-msg-react i { font-size: 13px; }
/* PIT20-1415 — hivatkozás az üzenetben: a buborék színét örökli (a kimenő kék, a bejövő szürke), aláhúzással. */
.chat-msg-link { color: inherit; text-decoration: underline; word-break: break-all; }
.chat-msg-link:hover, .chat-msg-link:focus { color: inherit; text-decoration: none; }
.chat-msg-react:hover { background: var(--cd-hover); opacity: 1; }

.chat-msg-reactions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: -4px; position: relative; z-index: 1; }
.chat-reaction {
    border: 1px solid var(--cd-border);
    background: var(--cd-bg);
    border-radius: 12px;
    padding: 0 6px;
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
    color: var(--cd-fg);
}
.chat-reaction.is-own { border-color: #2196f3; background: rgba(33, 150, 243, .12); }
.chat-reaction-count { margin-left: 3px; font-size: 11px; }

.chat-reaction-bar {
    position: absolute;
    bottom: 100%;
    z-index: 5;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 20px;
    box-shadow: var(--cd-shadow);
}
.chat-msg-in .chat-reaction-bar { left: 30px; }
.chat-msg-out .chat-reaction-bar { right: 0; }
.chat-reaction-bar button { border: 0; background: transparent; font-size: 20px; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; padding: 0; color: var(--cd-fg); }
.chat-reaction-bar button:hover { background: var(--cd-hover); transform: scale(1.15); }
.chat-reaction-bar-more i { font-size: 14px; }

/* ── csatolmányok ────────────────────────────────────────────────────── */

.chat-att-image { display: block; margin-top: 3px; border-radius: 12px; overflow: hidden; max-width: 220px; border: 1px solid var(--cd-border); }
.chat-att-image img { display: block; max-width: 220px; max-height: 220px; width: auto; height: auto; }

/* PIT20-1416 — egy üzenet képei rácsban, legfeljebb három egy sorban. Egy képnél a megszokott
   méret marad; kettőtől négyzetes, kitöltött cellák (a kép kivágva, nem torzítva). */
.chat-att-gallery { display: grid; gap: 3px; margin-top: 3px; max-width: 220px; }
.chat-att-gallery-1 { grid-template-columns: 1fr; }
.chat-att-gallery-2 { grid-template-columns: repeat(2, 1fr); }
.chat-att-gallery-3 { grid-template-columns: repeat(3, 1fr); }
.chat-att-gallery .chat-att-image { margin-top: 0; }
.chat-att-gallery-2 .chat-att-image,
.chat-att-gallery-3 .chat-att-image { border-radius: 8px; aspect-ratio: 1 / 1; }
.chat-att-gallery-2 .chat-att-image img,
.chat-att-gallery-3 .chat-att-image img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.chat-msg-out .chat-att-gallery { margin-left: auto; }

/* PIT20-1416 — kép-nagyító (nem a PDF-néző). A modalok (1050) fölött, hogy egy nyitott
   ablakból indítva se kerüljön mögé. */
.chat-lightbox { position: fixed; inset: 0; z-index: 1060; display: none; flex-direction: column; background: rgba(0, 0, 0, .9); color: #fff; }
.chat-lightbox.is-open { display: flex; }
.chat-lightbox-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.chat-lightbox-caption { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-lightbox-counter { opacity: .75; font-variant-numeric: tabular-nums; }
.chat-lightbox-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.chat-lightbox-btn:hover { background: rgba(255, 255, 255, .25); color: #fff; text-decoration: none; }
.chat-lightbox-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px 24px; }
.chat-lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: pointer; user-select: none; }
.chat-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 20px; cursor: pointer; }
.chat-lightbox-nav:hover { background: rgba(255, 255, 255, .28); }
.chat-lightbox-prev { left: 8px; }
.chat-lightbox-next { right: 8px; }
@media (max-width: 575.98px) {
    .chat-lightbox-stage { padding: 0 8px 16px; }
    .chat-lightbox-nav { width: 40px; height: 40px; background: rgba(0, 0, 0, .45); }
}
.chat-att-file {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    padding: 7px 10px;
    border-radius: 12px;
    border: 1px solid var(--cd-border);
    background: var(--cd-bg);
    color: var(--cd-fg);
    max-width: 230px;
    text-decoration: none;
}
.chat-att-file:hover { background: var(--cd-hover); color: var(--cd-fg); text-decoration: none; }
.chat-att-icon { font-size: 24px; flex-shrink: 0; }
.chat-att-icon-pdf { color: #e53935; }
.chat-att-icon-word { color: #1e88e5; }
.chat-att-icon-sheet { color: #43a047; }
.chat-att-icon-slides { color: #fb8c00; }
.chat-att-icon-zip { color: #8d6e63; }
.chat-att-meta { display: flex; flex-direction: column; min-width: 0; }
.chat-att-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.chat-att-size { font-size: 11px; color: var(--cd-muted); }
.chat-att-expired { opacity: .65; cursor: default; }

/* ── szerkesztő ──────────────────────────────────────────────────────── */

.chat-window-composer { border-top: 1px solid var(--cd-border); padding: 6px; }
/*
 * A gombok és a szövegmező EGY VONALBAN (középre igazítva). A DOMBuilder a mezőt két burkolóba
 * teszi (`.input-group` > `.form-group-floating2`); mindkettőnek ki kell töltenie a sort, és
 * nem lehet margója. Többsoros üzenetnél a gombok a mező közepéhez igazodnak.
 */
.chat-window-inputrow { display: flex; align-items: center; gap: 2px; }
.chat-window-inputwrap { flex: 1 1 auto; min-width: 0; margin: 0 !important; }
.chat-window-inputwrap > .form-group-floating2 { flex: 1 1 auto; width: 100%; margin: 0; }
.chat-window-input {
    resize: none;
    display: block;
    max-height: 110px;
    min-height: 34px;
    border-radius: 18px !important;
    padding: 7px 12px !important;
    background: var(--cd-in-bg) !important;
    color: var(--cd-fg) !important;
    border: 0 !important;
    font-size: 13px;
    line-height: 1.35;
    overflow-y: auto;
}
.chat-window-send i { color: #2196f3; }

.chat-window-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 6px; }
.chat-pending {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 150px;
    padding: 4px 22px 4px 4px;
    border: 1px solid var(--cd-border);
    border-radius: 8px;
    background: var(--cd-bg);
    font-size: 11px;
}
.chat-pending-thumb { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; background: var(--cd-in-bg); }
.chat-pending-thumb img { width: 32px; height: 32px; object-fit: cover; }
.chat-pending-thumb i { font-size: 18px; }
.chat-pending-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pending-progress { position: absolute; left: 4px; right: 4px; bottom: 2px; height: 2px; background: transparent; }
.chat-pending-bar { display: block; height: 2px; width: calc(var(--chat-progress, 0) * 100%); background: #2196f3; transition: width .15s; }
.chat-pending.is-done .chat-pending-progress { display: none; }
.chat-pending.is-error { border-color: #e53935; color: #e53935; }
.chat-pending-remove { position: absolute; top: 2px; right: 2px; border: 0; background: transparent; padding: 0 2px; cursor: pointer; color: var(--cd-muted); }

/* ── emoji-választó ──────────────────────────────────────────────────── */

/* PIT20-1415 — a gémkapocs választója, a szövegmező fölött, a gomb fölé igazítva. */
.chat-attach-menu {
    position: absolute;
    left: 6px;
    bottom: 52px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    padding: 4px 0;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 10px;
    box-shadow: var(--cd-shadow);
}
.chat-attach-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.chat-attach-option:hover,
.chat-attach-option:focus {
    background: var(--cd-hover);
    outline: none;
}
.chat-attach-option i { font-size: 16px; opacity: .8; }
/* PIT20-1415 — a számítógépről csatolt fájl megőrzési ideje: a választás ELŐTT látszik, mert a
   gombra kattintva már a fájlválasztó nyílik. */
.chat-attach-note { margin: 0 14px 6px 40px; max-width: 240px; font-size: 11px; line-height: 1.35; color: var(--cd-muted, #888); white-space: normal; }

.chat-emoji-picker {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 52px;
    z-index: 6;
    height: 260px;
    display: flex;
    flex-direction: column;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 10px;
    box-shadow: var(--cd-shadow);
}
.chat-emoji-search { padding: 6px; }
.chat-emoji-search .form-group { margin: 0; }
.chat-emoji-cats { display: flex; justify-content: space-between; padding: 0 4px; border-bottom: 1px solid var(--cd-border); }
.chat-emoji-cat { border: 0; background: transparent; font-size: 16px; padding: 4px 2px; cursor: pointer; opacity: .55; border-bottom: 2px solid transparent; }
.chat-emoji-cat.is-active { opacity: 1; border-bottom-color: #2196f3; }
.chat-emoji-grid { flex: 1 1 auto; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); padding: 4px; align-content: start; }
.chat-emoji-item { border: 0; background: transparent; font-size: 21px; height: 34px; border-radius: 6px; cursor: pointer; padding: 0; }
.chat-emoji-item:hover { background: var(--cd-hover); }

/* ── avatar ──────────────────────────────────────────────────────────── */

.chat-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.chat-avatar.is-sm { width: 28px; height: 28px; font-size: 11px; }
.chat-avatar.is-lg { width: 48px; height: 48px; font-size: 16px; }
.chat-avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.chat-avatar-status { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--cd-bg); display: none; }
.chat-avatar-status.is-online { display: block; background: var(--cd-online); }
.chat-avatar-status.is-away { display: block; background: var(--cd-away); }
.chat-avatar-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    /* Kör alakú, szegély nélkül (Manager-kérés). A szám 99 fölött „99+"-ként megy ki,
       ezért fix méret: 20 px-ben a „99+" is elfér, és a jelvény nem nyúlik kapszulává. */
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    background: var(--cd-badge);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    border: 0;
    box-sizing: border-box;
}
.chat-avatar-c0 { background: #26a69a; }
.chat-avatar-c1 { background: #5c6bc0; }
.chat-avatar-c2 { background: #ef5350; }
.chat-avatar-c3 { background: #ab47bc; }
.chat-avatar-c4 { background: #ff7043; }
.chat-avatar-c5 { background: #42a5f5; }
.chat-avatar-c6 { background: #8d6e63; }
.chat-avatar-c7 { background: #66bb6a; }

/* ── avatar-oszlop (rail) ────────────────────────────────────────────── */

.chat-dock-rail {
    position: fixed;
    right: var(--cd-rail-right);
    bottom: var(--cd-rail-bottom);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}
.chat-dock-rail > * { pointer-events: auto; }
.chat-dock-heads { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chat-dock-head { position: relative; cursor: pointer; border-radius: 50%; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.chat-dock-head .chat-avatar { width: 48px; height: 48px; font-size: 16px; }
.chat-dock-head-close {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: var(--cd-bg);
    color: var(--cd-fg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.chat-dock-head-close i { font-size: 10px; }
.chat-dock-head:hover .chat-dock-head-close { display: flex; }

.chat-dock-more, .chat-dock-round {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    background: var(--cd-head-bg);
    color: var(--cd-fg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-dock-round { width: 40px; height: 40px; }

.chat-dock-overflow {
    position: absolute;
    right: 60px;
    bottom: 0;
    width: 280px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 10px;
    box-shadow: var(--cd-shadow);
    padding: 6px 0;
}
.chat-dock-overflow-title { font-size: 11px; color: var(--cd-muted); padding: 2px 12px 6px; text-transform: uppercase; }
.chat-dock-overflow-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 12px; cursor: pointer; }
.chat-dock-overflow-item:hover { background: var(--cd-hover); }
.chat-dock-overflow-text { flex: 1 1 auto; min-width: 0; }
.chat-dock-overflow-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-dock-overflow-preview { font-size: 11px; color: var(--cd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-dock-overflow-close { border: 0; background: transparent; color: var(--cd-muted); cursor: pointer; padding: 4px; }

.chat-dock-menu-wrap .dropdown-item i { margin-right: 8px; }

.chat-dock-picker {
    position: fixed;
    right: calc(var(--cd-rail-right) + 64px);
    bottom: var(--cd-rail-bottom);
    width: 300px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    background: var(--cd-bg);
    border: 1px solid var(--cd-border);
    border-radius: 10px;
    box-shadow: var(--cd-shadow);
    padding: 8px;
}
.chat-dock-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.chat-dock-picker-title { font-weight: 600; }
.chat-dock-picker .form-group { margin-bottom: 6px; }
.chat-dock-picker-list { overflow-y: auto; }
.chat-dock-picker-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 6px; border-radius: 8px; text-align: left; color: var(--cd-fg); cursor: pointer; }
.chat-dock-picker-row:hover { background: var(--cd-hover); }

/* ── csoport tagjai ──────────────────────────────────────────────────── */

.chat-members { padding: 8px; }
.chat-members-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.chat-members-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chat-member { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.chat-member-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-member-actions { display: flex; }

/* ── telefonos értesítő-buborék (D1) ─────────────────────────────────── */

.chat-dock-toast { position: fixed; top: 64px; left: 12px; right: 12px; z-index: 1039; }
.chat-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--cd-bg);
    color: var(--cd-fg);
    border: 1px solid var(--cd-border);
    border-radius: 12px;
    box-shadow: var(--cd-shadow);
    cursor: pointer;
    animation: chatToastIn .2s ease-out;
}
.chat-toast-text { min-width: 0; flex: 1 1 auto; }
.chat-toast-title { font-weight: 600; }
.chat-toast-body { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-toast-more { font-size: 11px; color: var(--cd-muted); }
@keyframes chatToastIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── telefon: egy ablak, teljes szélességű lap; rövidebb avatar-oszlop ── */

@media (max-width: 575.98px) {
    .chat-dock { --cd-rail-right: 12px; --cd-rail-bottom: 16px; }
    .chat-dock-windows { left: 0; right: 0; }
    .chat-window { width: 100%; height: 80vh; max-height: 80vh; border-radius: 12px 12px 0 0; }
    .chat-dock.is-sheet-open .chat-dock-rail { display: none; }
    .chat-dock-head .chat-avatar, .chat-dock-more { width: 44px; height: 44px; }
    .chat-dock-picker, .chat-dock-overflow { right: 12px; left: 12px; width: auto; bottom: 0; }
    .chat-window-title, .chat-window-status { max-width: 60vw; }
}

/* PIT20-1393 — topbar 💬 legördülő (a korábbi inline stílusok helyett) */
.topbar-chat-preview { max-width: 200px; }
.topbar-chat-empty-icon { font-size: 24px; }
#chatTopbarDropdownBody .chat-avatar { flex-shrink: 0; }

/* PIT20-1414 — „Látta" a saját utolsó üzenet alatt */
.chat-seen { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin: -2px 2px 4px 0; font-size: 11px; color: var(--cd-muted); }
.chat-seen i { font-size: 11px; }

/* PIT20-1414 — csoportok az Üzenetek → Chat fülön */
.chat-group-row { cursor: pointer; }
.chat-group-row:hover { background-color: rgba(0, 0, 0, .03); }
.chat-group-heading { letter-spacing: .04em; }

/* ================================================================
 * PIT20-1462 — üzenet-műveletek (reakció · válasz · továbbiak), a Messenger mintájára
 * ================================================================ */
.chat-msg-actions {
    display: flex;
    align-items: center;
    gap: 0;
    align-self: center;
    opacity: 0;
    transition: opacity .12s;
}
/* Kimenő üzenetnél a gombok a buborék BAL oldalán, fordított sorrendben (⋮ ↩ 😊). */
.chat-msg-out .chat-msg-actions { flex-direction: row-reverse; }
.chat-msg:hover .chat-msg-actions,
.chat-msg-actions:focus-within,
.chat-msg:has(.chat-msg-menu) .chat-msg-actions,
.chat-msg:has(.chat-reaction-bar) .chat-msg-actions { opacity: 1; }
/* Érintőképernyőn nincs rámutatás: halványan mindig látszik. */
@media (hover: none) {
    .chat-msg-actions { opacity: .55; }
}
.chat-msg-act {
    border: 0;
    background: transparent;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    color: var(--cd-muted);
}
.chat-msg-act i { font-size: 13px; }
.chat-msg-act:hover, .chat-msg-act:focus { background: var(--cd-hover); color: var(--cd-fg); outline: 0; }

/* A „továbbiak" menü: sötét, lekerekített lebegő doboz. */
.chat-msg-menu {
    position: absolute;
    bottom: 100%;
    z-index: 6;
    display: flex;
    flex-direction: column;
    min-width: 150px;
    padding: 6px;
    background: #242526;
    border-radius: 10px;
    box-shadow: var(--cd-shadow);
}
.chat-msg-in .chat-msg-menu { left: 30px; }
.chat-msg-out .chat-msg-menu { right: 0; }
.chat-msg-menu-item {
    border: 0;
    background: transparent;
    color: #e4e6eb;
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.chat-msg-menu-item:hover, .chat-msg-menu-item:focus { background: rgba(255, 255, 255, .1); outline: 0; }

/* Idézet: „Válaszoltál neki: X" + az eredeti, halvány buborék a válasz fölött. */
.chat-msg-reply { display: flex; flex-direction: column; cursor: pointer; margin-bottom: -10px; max-width: 100%; }
.chat-msg-out .chat-msg-reply { align-items: flex-end; }
.chat-msg-reply-label { font-size: 11px; color: var(--cd-muted); margin: 0 10px 2px; }
.chat-msg-reply-label i { font-size: 10px; margin-right: 4px; }
.chat-msg-reply-bubble {
    padding: 7px 11px 16px;
    border-radius: 18px;
    background: var(--cd-in-bg);
    color: var(--cd-muted);
    font-size: 12px;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    opacity: .85;
}
.chat-msg-reply-bubble.is-removed { background: transparent; border: 1px solid var(--cd-border); font-style: italic; }
.chat-msg-reply + .chat-msg-flags, .chat-msg-reply + .chat-msg-bubble { position: relative; z-index: 1; }

/* Szerkesztve / Rögzítve jelzés. */
.chat-msg-flags { display: flex; gap: 8px; font-size: 10px; color: var(--cd-muted); margin: 0 10px 1px; }
.chat-msg-flags i { font-size: 9px; margin-right: 3px; }
.chat-msg-flag { white-space: nowrap; }

/* Eltávolított üzenet: körvonalas, dőlt, halvány. */
.chat-msg.is-deleted .chat-msg-bubble {
    background: transparent !important;
    color: var(--cd-muted) !important;
    border: 1px solid var(--cd-border);
    font-style: italic;
}

/* Ugrás az idézett / rögzített üzenetre: rövid kiemelés. */
.chat-msg.is-highlight .chat-msg-bubble { animation: chatMsgHighlight 1.6s ease-out; }
@keyframes chatMsgHighlight {
    0%, 40% { box-shadow: 0 0 0 3px rgba(33, 150, 243, .55); }
    100% { box-shadow: 0 0 0 3px rgba(33, 150, 243, 0); }
}

/* A szerkesztő fölötti sáv: „Válasz X számára" / „Üzenet szerkesztése". */
.chat-window-composerbar { padding: 6px 10px 2px; border-top: 1px solid var(--cd-border); }
.chat-composer-bar { display: flex; align-items: flex-start; gap: 8px; }
.chat-composer-bar-text { flex: 1 1 auto; min-width: 0; }
.chat-composer-bar-title { font-size: 12px; font-weight: 600; color: var(--cd-fg); }
.chat-composer-bar-preview { font-size: 12px; color: var(--cd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rögzített üzenet sávja a fejléc alatt. */
.chat-window-pinned { border-bottom: 1px solid var(--cd-border); background: var(--cd-head-bg); }
.chat-pinned-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.chat-pinned-bar:hover { background: var(--cd-hover); }
.chat-pinned-bar > i { color: var(--cd-muted); font-size: 12px; }
.chat-pinned-text { flex: 1 1 auto; min-width: 0; }
.chat-pinned-title { font-size: 11px; color: var(--cd-muted); }
.chat-pinned-preview { font-size: 12px; color: var(--cd-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pinned-count { font-size: 11px; color: var(--cd-muted); flex-shrink: 0; }

/* Nincs hely a buborék fölött → lefelé nyílik. */
.chat-msg-menu.is-below, .chat-reaction-bar.is-below { bottom: auto; top: 100%; }

/* PIT20-1478 — a küszöbön túl húzott ablak halványul: elengedve kicsinyedik */
.chat-window.will-minimize {
    opacity: .55;
}
