/* ERTpanel · Aksiyon butonları + canlı destek (tema bağımsız) */
.ert-fab, .ert-chat { --ert-z: 1040; font-family: inherit; }
.ert-fab { position: fixed; z-index: var(--ert-z); display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.ert-fab > * { pointer-events: auto; }
.ert-fab--bottom-right { right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); align-items: flex-end; }
.ert-fab--bottom-left { left: max(18px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); align-items: flex-start; }
.ert-fab--middle-right { right: 0; top: 50%; transform: translateY(-50%); align-items: flex-end; gap: 6px; }
.ert-fab--middle-left { left: 0; top: 50%; transform: translateY(-50%); align-items: flex-start; gap: 6px; }

.ert-fab__btn { position: relative; display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer; text-decoration: none !important; background: var(--b); color: var(--f) !important; font-weight: 700; font-size: 14px; line-height: 1; box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .12); transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, filter .2s; -webkit-tap-highlight-color: transparent; }
.ert-fab__btn i { font-size: 22px; line-height: 1; }
.ert-fab__btn:hover { transform: translateY(-3px); filter: brightness(1.05); box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .5), 0 3px 8px rgba(0, 0, 0, .14); }
.ert-fab__btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--b) 45%, #fff); outline-offset: 3px; }

/* Yuvarlak: etiket üzerine gelince açılır */
.ert-fab--round .ert-fab__btn { width: 56px; height: 56px; border-radius: 50%; justify-content: center; }
.ert-fab--round .ert-fab__label { position: absolute; top: 50%; white-space: nowrap; padding: 8px 12px; border-radius: 10px; background: #111; color: #fff; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transform: translateY(-50%) scale(.96); transition: opacity .2s, transform .2s; }
.ert-fab--bottom-right.ert-fab--round .ert-fab__label { right: calc(100% + 12px); }
.ert-fab--bottom-left.ert-fab--round .ert-fab__label { left: calc(100% + 12px); }
.ert-fab--round .ert-fab__btn:hover .ert-fab__label, .ert-fab--round .ert-fab__btn:focus-visible .ert-fab__label { opacity: 1; transform: translateY(-50%) scale(1); }

/* Etiketli hap */
.ert-fab--pill .ert-fab__btn { height: 52px; padding: 0 20px 0 16px; border-radius: 999px; }

/* Kenar sekmeleri (orta konum) */
.ert-fab--edge .ert-fab__btn { height: 50px; padding: 0 14px; overflow: hidden; max-width: 50px; transition: max-width .35s cubic-bezier(.2, .8, .2, 1), transform .25s; }
.ert-fab--middle-right.ert-fab--edge .ert-fab__btn { border-radius: 14px 0 0 14px; }
.ert-fab--middle-left.ert-fab--edge .ert-fab__btn { border-radius: 0 14px 14px 0; flex-direction: row-reverse; }
.ert-fab--edge .ert-fab__btn i { flex: 0 0 22px; }
.ert-fab--edge .ert-fab__label { white-space: nowrap; opacity: 0; transition: opacity .2s; }
.ert-fab--edge .ert-fab__btn:hover, .ert-fab--edge .ert-fab__btn:focus-visible { max-width: 260px; transform: none; }
.ert-fab--edge .ert-fab__btn:hover .ert-fab__label, .ert-fab--edge .ert-fab__btn:focus-visible .ert-fab__label { opacity: 1; }

/* Dikkat çekici halka (yalnızca ilk buton) */
.ert-fab--pulse .ert-fab__btn:first-child::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 color-mix(in srgb, var(--b) 60%, transparent); animation: ert-pulse 2.6s cubic-bezier(.2, .8, .2, 1) infinite; pointer-events: none; }
@keyframes ert-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--b) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 16px transparent; } }

.ert-fab__badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #e11d48; color: #fff; font-size: 11px; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.ert-fab__badge[hidden] { display: none; }

.ert-fab--device-mobile { display: none; }
@media (max-width: 991px) {
    .ert-fab--device-mobile { display: flex; }
    .ert-fab--device-desktop { display: none; }
    .ert-fab--pill .ert-fab__label { display: none; }
    .ert-fab--pill .ert-fab__btn { width: 52px; padding: 0; justify-content: center; }
}

/* ----------------------------- Canlı destek ----------------------------- */
.ert-chat { position: fixed; z-index: calc(var(--ert-z) + 1); width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: #fff; color: #111; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .06); transform-origin: bottom right; animation: ert-chat-in .32s cubic-bezier(.2, .8, .2, 1); font-size: 14px; line-height: 1.45; }
.ert-chat[hidden] { display: none; }
.ert-chat--bottom-right { right: 18px; bottom: 88px; }
.ert-chat--bottom-left { left: 18px; bottom: 88px; transform-origin: bottom left; }
.ert-chat--middle-right { right: 70px; top: 50%; translate: 0 -50%; transform-origin: right center; }
.ert-chat--middle-left { left: 70px; top: 50%; translate: 0 -50%; transform-origin: left center; }
@keyframes ert-chat-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.ert-chat__head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; background: var(--c); color: #fff; }
.ert-chat__head div { flex: 1; min-width: 0; }
.ert-chat__head strong { display: block; font-size: 16px; }
.ert-chat__head small { display: block; opacity: .78; font-size: 12px; }
.ert-chat__avatar { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); font-size: 20px; }
.ert-chat__dot { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--c); }
.ert-chat__close { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.ert-chat__close:hover { background: rgba(255, 255, 255, .22); }

.ert-chat__body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: #f6f6f7; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.ert-chat__msg { max-width: 82%; }
.ert-chat__msg p { margin: 0; padding: 10px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.ert-chat__msg time { display: block; font-size: 10.5px; color: #8a8a90; margin: 3px 6px 0; }
.ert-chat__msg--admin { align-self: flex-start; }
.ert-chat__msg--admin p { background: #fff; border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.ert-chat__msg--visitor { align-self: flex-end; text-align: right; }
.ert-chat__msg--visitor p { background: var(--c); color: #fff; border-bottom-right-radius: 5px; text-align: left; }
.ert-chat__msg--system { align-self: center; max-width: 100%; }
.ert-chat__msg--system p { background: transparent; color: #8a8a90; font-size: 12px; padding: 4px; text-align: center; }
.ert-chat__msg b { display: block; font-size: 11px; color: #8a8a90; margin: 0 6px 3px; font-weight: 600; }

.ert-chat__start { padding: 14px 16px 16px; display: grid; gap: 8px; border-top: 1px solid #ececef; background: #fff; }
.ert-chat__start[hidden], .ert-chat__composer[hidden] { display: none; }
.ert-chat__note { margin: 0 0 2px; font-size: 12px; color: #6b6b72; }
.ert-chat__start input, .ert-chat__start textarea, .ert-chat__composer textarea { width: 100%; border: 1px solid #dedee3; border-radius: 12px; padding: 10px 12px; font: inherit; color: inherit; background: #fff; outline: none; resize: none; }
.ert-chat__start input:focus, .ert-chat__start textarea:focus, .ert-chat__composer textarea:focus { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.ert-chat__primary { border: 0; border-radius: 12px; padding: 12px; background: var(--c); color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.ert-chat__primary:disabled, .ert-chat__composer button:disabled { opacity: .6; cursor: wait; }
.ert-chat__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.ert-chat__error { color: #be123c; font-size: 12px; min-height: 0; }
.ert-chat__error:empty { display: none; }
.ert-chat__error--composer { padding: 0 16px 8px; background: #fff; }

.ert-chat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid #ececef; background: #fff; }
.ert-chat__composer textarea { max-height: 120px; }
.ert-chat__attach { flex: 0 0 40px; height: 44px; display: grid; place-items: center; color: #6b6b72; cursor: pointer; border-radius: 12px; font-size: 20px; }
.ert-chat__attach:hover { background: #f3f3f5; color: var(--c); }
.ert-chat__img { display: block; max-width: 220px; max-height: 240px; border-radius: 14px; cursor: zoom-in; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ert-chat__msg--visitor .ert-chat__img { margin-left: auto; }
.ert-chat__dot.is-off { background: #f59e0b; }
.ert-chat__lightbox { position: fixed; inset: 0; z-index: 2147483000; background: rgba(0,0,0,.82); display: grid; place-items: center; cursor: zoom-out; }
.ert-chat__lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; }
.ert-chat__composer button { flex: 0 0 44px; height: 44px; border: 0; border-radius: 50%; background: var(--c); color: #fff; cursor: pointer; font-size: 17px; }

@media (max-width: 575px) {
    .ert-chat { left: 8px !important; right: 8px !important; width: auto; bottom: 80px !important; top: auto !important; translate: none !important; height: min(72vh, 560px); }
}

@media (prefers-reduced-motion: reduce) {
    .ert-fab__btn, .ert-chat { transition: none; animation: none; }
    .ert-fab--pulse .ert-fab__btn:first-child::after { animation: none; }
}

@media print { .ert-fab, .ert-chat { display: none !important; } }
