/* ============ Canlı Destek — WhatsApp-style live support (ported from the livesupport project) ============
   Everything is scoped under .lc so it does not touch Bootstrap / the panel styles.
   Used by /destek (templates/chat/index.html.twig) and /admin/destek (templates/admin/chat/index.html.twig). */
.lc, .lc-lightbox {
    --lc-header-bg: #008069;
    --lc-header-fg: #fff;
    --lc-chat-bg: #efeae2;
    --lc-pattern: rgba(0, 0, 0, .045);
    --lc-bubble-in: #fff;
    --lc-bubble-out: #d9fdd3;
    --lc-text: #111b21;
    --lc-text-muted: #667781;
    --lc-composer-bg: #f0f2f5;
    --lc-input-bg: #fff;
    --lc-accent: #00a884;
    --lc-tick-read: #53bdeb;
    --lc-panel-bg: #fff;
    --lc-border: #e9edef;
    --lc-hover: #f5f6f6;
    --lc-active: #f0f2f5;
    --lc-system-bg: #ffeecd;
    --lc-day-bg: #fff;
    --lc-danger: #ea0038;
    --lc-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
[data-bs-theme="dark"] .lc, [data-bs-theme="dark"] .lc-lightbox {
    --lc-header-bg: #202c33;
    --lc-header-fg: #e9edef;
    --lc-chat-bg: #0b141a;
    --lc-pattern: rgba(255, 255, 255, .03);
    --lc-bubble-in: #202c33;
    --lc-bubble-out: #005c4b;
    --lc-text: #e9edef;
    --lc-text-muted: #8696a0;
    --lc-composer-bg: #202c33;
    --lc-input-bg: #2a3942;
    --lc-panel-bg: #111b21;
    --lc-border: #222d34;
    --lc-hover: #202c33;
    --lc-active: #2a3942;
    --lc-system-bg: #182229;
    --lc-day-bg: #182229;
}

.lc { color: var(--lc-text); font-size: 14.2px; -webkit-font-smoothing: antialiased; }
.lc *, .lc *::before, .lc *::after { box-sizing: border-box; }
.lc [hidden] { display: none !important; }
.lc button { font: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.lc-header {
    display: flex; align-items: center; gap: 12px;
    height: 60px; padding: 0 16px; flex-shrink: 0;
    background: var(--lc-header-bg); color: var(--lc-header-fg);
}
.lc-header .title { font-size: 16px; font-weight: 500; line-height: 1.2; }
.lc-header .subtitle { font-size: 13px; opacity: .8; }
.lc-header .grow { flex: 1; min-width: 0; }
.lc-header .grow > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-icon-btn {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: transparent; color: inherit; text-decoration: none;
}
.lc-icon-btn:hover { background: rgba(127, 127, 127, .15); color: inherit; }
.lc-icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

.lc-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    font-weight: 600; font-size: 15px; color: #fff;
    background: #6b7c85;
}
.lc-avatar.is-support { background: #25d366; font-size: 22px; }

/* ---------- Messages ---------- */
.lc-chat-window { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; background: var(--lc-chat-bg); }
.lc-messages {
    flex: 1; overflow-y: auto; padding: 12px 6% 8px;
    background-color: var(--lc-chat-bg);
    background-image: radial-gradient(var(--lc-pattern) 1.2px, transparent 1.3px);
    background-size: 18px 18px;
    overscroll-behavior: contain;
}
@media (max-width: 700px) { .lc-messages { padding: 10px 10px 6px; } }

.lc .day { display: flex; justify-content: center; margin: 10px 0; }
.lc .day span {
    background: var(--lc-day-bg); color: var(--lc-text-muted);
    font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: var(--lc-shadow);
}
.lc-system-note {
    max-width: 420px; margin: 8px auto 14px; padding: 8px 12px; text-align: center;
    background: var(--lc-system-bg); color: var(--lc-text); border-radius: 8px;
    font-size: 13px; line-height: 1.45; box-shadow: var(--lc-shadow);
}

.lc .msg { display: flex; margin: 2px 0; }
.lc .msg.out { justify-content: flex-end; }
.lc .msg.first { margin-top: 10px; }
.lc .bubble {
    position: relative; max-width: min(65%, 560px);
    padding: 6px 7px 8px 9px; border-radius: 8px;
    background: var(--lc-bubble-in); box-shadow: var(--lc-shadow);
    line-height: 19px; word-wrap: break-word; overflow-wrap: anywhere;
}
@media (max-width: 700px) { .lc .bubble { max-width: 85%; } }
.lc .msg.out .bubble { background: var(--lc-bubble-out); }
.lc .msg.first.in .bubble { border-top-left-radius: 0; }
.lc .msg.first.out .bubble { border-top-right-radius: 0; }
.lc .msg.first.in .bubble::before, .lc .msg.first.out .bubble::before {
    content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.lc .msg.first.in .bubble::before { left: -8px; background: var(--lc-bubble-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.lc .msg.first.out .bubble::before { right: -8px; background: var(--lc-bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }

.lc .bubble .text { white-space: pre-wrap; }
.lc .bubble .meta {
    float: right; margin: 6px 0 -4px 10px;
    font-size: 11px; color: var(--lc-text-muted); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 3px;
}
.lc .bubble .meta .tick { width: 16px; height: 11px; fill: var(--lc-text-muted); }
.lc .bubble .meta .tick.read { fill: var(--lc-tick-read); }

.lc .bubble.image { padding: 3px; }
.lc .bubble.image img {
    display: block; max-width: 100%; width: 300px; max-height: 340px; min-height: 120px;
    object-fit: cover; border-radius: 6px; cursor: zoom-in; background: rgba(127, 127, 127, .15);
}
.lc .bubble.image .meta {
    position: absolute; right: 8px; bottom: 7px; margin: 0; float: none;
    color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .6);
}
.lc .bubble.image .meta .tick { fill: #fff; }
.lc .bubble.image .meta .tick.read { fill: var(--lc-tick-read); }
.lc .msg.pending .bubble { opacity: .7; }
.lc .msg.failed .bubble { outline: 1px solid var(--lc-danger); }
.lc .msg.failed .meta { color: var(--lc-danger); }

.lc-scroll-down {
    position: absolute; right: 18px; bottom: 76px; z-index: 2;
    width: 42px; height: 42px; border-radius: 50%; border: 0;
    background: var(--lc-panel-bg); color: var(--lc-text-muted); box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    display: none; place-items: center;
}
.lc-scroll-down.show { display: grid; }
.lc-scroll-down svg { width: 22px; fill: currentColor; }
.lc-scroll-down .count {
    position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 10px; background: var(--lc-accent); color: #fff; font-size: 12px; line-height: 20px;
}
.lc-scroll-down .count:empty { display: none; }

/* ---------- Composer ---------- */
.lc-composer {
    display: flex; align-items: flex-end; gap: 6px; margin: 0;
    padding: 8px 10px; flex-shrink: 0;
    background: var(--lc-composer-bg);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.lc-composer .lc-icon-btn { color: var(--lc-text-muted); margin: 1px 0; }
.lc-composer textarea {
    flex: 1; resize: none; border: 0; outline: 0;
    min-height: 42px; max-height: 140px; padding: 11px 14px;
    border-radius: 8px; background: var(--lc-input-bg); color: var(--lc-text);
    font: inherit; font-size: 16px; line-height: 20px;
}
.lc-composer textarea::placeholder { color: var(--lc-text-muted); }
.lc-composer .send { color: var(--lc-accent); }
.lc-composer .send:disabled { opacity: .4; cursor: default; }

.lc-toast {
    position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); z-index: 5;
    max-width: 90%; padding: 9px 14px; border-radius: 8px;
    background: #323739; color: #fff; font-size: 13.5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    opacity: 0; transition: opacity .2s; pointer-events: none;
}
.lc-toast.show { opacity: 1; }

.lc-drop-overlay {
    position: absolute; inset: 0; z-index: 4; display: none;
    place-items: center; background: rgba(0, 168, 132, .15);
    border: 3px dashed var(--lc-accent); color: var(--lc-accent); font-size: 18px; font-weight: 600;
}
.lc-drop-overlay.show { display: grid; }

/* ---------- Photo preview ---------- */
.lc-lightbox {
    position: fixed; inset: 0; z-index: 2000;
    display: grid; place-items: center;
    background: rgba(11, 20, 26, .92); cursor: zoom-out;
}
.lc-lightbox img { max-width: 94vw; max-height: 92vh; object-fit: contain; }
.lc-lightbox .lc-icon-btn { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; }
.lc-lightbox .lc-icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

/* ============ Visitor page (/destek): full screen, like a chat app ============ */
body.chat-page .site-navbar, body.chat-page .tabbar, body.chat-page .toast-stack { display: none !important; }
body.chat-page { overflow: hidden; }
.lc-visitor { position: fixed; inset: 0; z-index: 1030; height: 100vh; height: 100dvh; }
.lc-visitor .lc-header { height: calc(58px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 14px 0; gap: 10px; }
.lc-visitor .lc-avatar { width: 38px; height: 38px; }
@media (min-width: 760px) {
    /* Desktop: centered phone-width column */
    .lc-visitor { max-width: 760px; margin: 0 auto; border-left: 1px solid var(--lc-border); border-right: 1px solid var(--lc-border); }
}

/* ============ Admin page (/admin/destek): WhatsApp Web layout inside the admin panel ============ */
.lc-admin {
    display: grid; grid-template-columns: minmax(280px, 340px) 1fr;
    height: calc(100vh - 190px); height: calc(100dvh - 190px); min-height: 520px;
    border: 1px solid var(--lc-border); border-radius: 10px; overflow: hidden; background: var(--lc-panel-bg);
}
.lc-sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--lc-border); background: var(--lc-panel-bg); }
.lc-search { padding: 8px 12px; border-bottom: 1px solid var(--lc-border); }
.lc-search input {
    width: 100%; height: 36px; padding: 0 14px; border: 0; outline: 0; border-radius: 8px;
    background: var(--lc-composer-bg); color: var(--lc-text); font: inherit;
}
.lc-conv-list { flex: 1; overflow-y: auto; }
.lc .conv {
    display: flex; gap: 12px; align-items: center; width: 100%;
    padding: 0 0 0 13px; border: 0; background: transparent; color: inherit; text-align: left;
}
.lc .conv:hover { background: var(--lc-hover); }
.lc .conv.active { background: var(--lc-active); }
.lc .conv .body { flex: 1; min-width: 0; padding: 12px 15px 12px 0; border-bottom: 1px solid var(--lc-border); }
.lc .conv-row { display: flex; align-items: center; gap: 6px; }
.lc .conv .name { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc .member-tag { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: rgba(0, 168, 132, .12); color: var(--lc-accent); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.lc .conv .time { font-size: 12px; color: var(--lc-text-muted); }
.lc .conv .preview { flex: 1; color: var(--lc-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.lc-badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--lc-accent); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.lc .conv.unread .time { color: var(--lc-accent); }
.lc .conv.unread .preview { color: var(--lc-text); }
.lc .conv-empty { padding: 40px 24px; text-align: center; color: var(--lc-text-muted); }

.lc-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.lc-placeholder {
    flex: 1; display: grid; place-items: center; text-align: center; padding: 24px;
    background: var(--lc-composer-bg); color: var(--lc-text-muted); border-bottom: 6px solid var(--lc-accent);
}
.lc-placeholder .ti { font-size: 48px; color: var(--lc-accent); }
.lc-placeholder h2 { color: var(--lc-text); font-weight: 300; font-size: 26px; margin: 8px 0 10px; }
.lc .note-input {
    width: 100%; max-width: 260px; height: 30px; padding: 0 8px; border: 0; outline: 0; border-radius: 6px;
    background: rgba(255, 255, 255, .18); color: inherit; font: inherit; font-size: 15px;
}
.lc .name-edit { background: none; border: 0; color: inherit; padding: 0; font: inherit; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lc .name-edit:not(.is-member):hover { text-decoration: underline; }
.lc .name-edit.is-member { cursor: default; }
.lc-profile { flex-shrink: 0; --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .45); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255, 255, 255, .15); --bs-btn-hover-border-color: rgba(255, 255, 255, .6); }
.lc-back-btn { display: none !important; }

@media (max-width: 760px) {
    .lc-admin { grid-template-columns: 1fr; height: calc(100dvh - 150px); min-height: 440px; }
    .lc-admin.has-chat .lc-sidebar { display: none; }
    .lc-admin:not(.has-chat) .lc-main { display: none; }
    .lc-back-btn { display: inline-grid !important; }
    .lc-admin .lc-header { padding: 0 8px; gap: 8px; }
}
