/* =====================================================================
   GoreWin Canlı Destek penceresi (widget.js) — önek: gwlc-
   Ana site + /app giriş sayfalarında aynı dosya. Sayfanın CSS'ine
   güvenmez: kendi değişkenleri, kendi sıfırlaması. Gradyan YOK.
   Koyu tema: <html data-theme="dark"> (site ile panelin ortak niteliği).
   ===================================================================== */

.gwlc {
    --lc-navy: #001325;
    --lc-navy-2: #0a2a4a;
    --lc-lime: #d6ff41;
    --lc-lime-ink: #06192b;
    --lc-bg: #ffffff;
    --lc-surface: #f3f7fc;
    --lc-surface-2: #e9eff8;
    --lc-line: #e3eaf4;
    --lc-text: #08182a;
    --lc-muted: #5a6c80;
    --lc-me-bg: #001325;
    --lc-me-fg: #ffffff;
    --lc-them-bg: #eef3f9;
    --lc-them-fg: #08182a;
    --lc-ok: #16a34a;
    --lc-err: #b91c1c;
    --lc-err-bg: #fef2f2;
    --lc-launch-bg: #001325;
    --lc-launch-fg: #d6ff41;
    --lc-shadow: 0 18px 50px rgba(3, 20, 40, .22), 0 2px 8px rgba(3, 20, 40, .08);
    --lc-radius: 20px;

    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
    font-family: Inter, "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--lc-text);
    -webkit-font-smoothing: antialiased;
}

html[data-theme="dark"] .gwlc {
    --lc-bg: #071a2e;
    --lc-surface: #0c2440;
    --lc-surface-2: #12304f;
    --lc-line: #17375a;
    --lc-text: #e8f0fa;
    --lc-muted: #9db0c6;
    --lc-me-bg: #d6ff41;
    --lc-me-fg: #06192b;
    --lc-them-bg: #12304f;
    --lc-them-fg: #e8f0fa;
    --lc-err: #fca5a5;
    --lc-err-bg: rgba(185, 28, 28, .18);
    --lc-launch-bg: #d6ff41;
    --lc-launch-fg: #001325;
    --lc-shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
}

.gwlc *,
.gwlc *::before,
.gwlc *::after {
    box-sizing: border-box;
}

.gwlc :where(button, input, textarea) {
    font: inherit;
    color: inherit;
    margin: 0;
}

.gwlc :where(button) {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.gwlc svg {
    display: block;
    flex-shrink: 0;
}

/* ---------- Başlatıcı ---------- */
.gwlc-launch {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--lc-launch-bg);
    color: var(--lc-launch-fg);
    box-shadow: 0 10px 28px rgba(3, 20, 40, .28);
    transition: transform .2s ease, box-shadow .2s ease;
    animation: gwlc-pop .35s cubic-bezier(.2, .9, .3, 1.3) backwards;
}

.gwlc-launch:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 14px 34px rgba(3, 20, 40, .34);
}

.gwlc-launch:focus-visible,
.gwlc-x:focus-visible,
.gwlc-send:focus-visible,
.gwlc-attach:focus-within,
.gwlc-chip:focus-visible {
    outline: 3px solid rgba(150, 200, 0, .55);
    outline-offset: 2px;
}

.gwlc-launch .gwlc-ic-close {
    display: none;
}

.gwlc[data-open="1"] .gwlc-launch .gwlc-ic-chat {
    display: none;
}

.gwlc[data-open="1"] .gwlc-launch .gwlc-ic-close {
    display: block;
}

.gwlc-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 22px;
    text-align: center;
    border: 2px solid var(--lc-bg);
}

.gwlc-badge[hidden] {
    display: none;
}

/* ---------- Panel ---------- */
.gwlc-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 380px;
    height: min(620px, calc(100vh - 110px));
    display: flex;
    flex-direction: column;
    background: var(--lc-bg);
    border-radius: var(--lc-radius);
    box-shadow: var(--lc-shadow);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .22s ease, visibility 0s linear .22s;
}

.gwlc[data-open="1"] .gwlc-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .2s ease, transform .22s ease, visibility 0s;
}

.gwlc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 16px 16px;
    background: var(--lc-navy);
    color: #fff;
    flex-shrink: 0;
}

html[data-theme="dark"] .gwlc-head {
    background: #001325;
    border-bottom: 1px solid var(--lc-line);
}

.gwlc-ava {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--lc-lime);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.gwlc-ava img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 8px;
}

.gwlc-ava-dot {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #94a3b8;
    border: 2.5px solid var(--lc-navy);
}

.gwlc[data-online="1"] .gwlc-ava-dot {
    background: #22c55e;
}

.gwlc-hd-txt {
    flex: 1;
    min-width: 0;
}

.gwlc-hd-title {
    display: block;
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: #fff;
}

.gwlc-hd-status {
    display: block;
    margin-top: 1px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gwlc-hd-status b {
    color: var(--lc-lime);
    font-weight: 700;
}

.gwlc-x {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, .8);
    transition: background .15s ease, color .15s ease;
}

.gwlc-x:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

/* ---------- Akış ---------- */
.gwlc-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 14px 8px;
    background: var(--lc-bg);
    scrollbar-width: thin;
}

.gwlc-stream {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.gwlc-day {
    align-self: center;
    margin: 10px 0 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--lc-surface);
    color: var(--lc-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.gwlc-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.gwlc-row.is-new {
    animation: gwlc-in .22s ease backwards;
}

.gwlc-row.is-me {
    justify-content: flex-end;
}

.gwlc-row.is-gap {
    margin-top: 10px;
}

.gwlc-mini {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--lc-navy);
    color: var(--lc-lime);
    font-size: 11px;
    font-weight: 800;
}

.gwlc-mini img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 5px;
}

.gwlc-mini.is-ai {
    background: var(--lc-lime);
    color: var(--lc-lime-ink);
}

.gwlc-mini.is-blank {
    visibility: hidden;
}

.gwlc-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 80%;
}

.gwlc-row.is-me .gwlc-col {
    align-items: flex-end;
}

.gwlc-who {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 3px 2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--lc-muted);
}

.gwlc-tag {
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--lc-lime);
    color: var(--lc-lime-ink);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.gwlc-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    background: var(--lc-them-bg);
    color: var(--lc-them-fg);
    font-size: 14.5px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.gwlc-row.is-them .gwlc-bubble {
    border-bottom-left-radius: 6px;
}

.gwlc-row.is-me .gwlc-bubble {
    background: var(--lc-me-bg);
    color: var(--lc-me-fg);
    border-bottom-right-radius: 6px;
}

.gwlc-bubble a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gwlc-bubble.is-img {
    padding: 4px;
    background: var(--lc-surface);
}

.gwlc-bubble.is-img img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border-radius: 12px;
}

.gwlc-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    font-weight: 600;
}

.gwlc-meta {
    margin: 3px 4px 0;
    font-size: 11px;
    color: var(--lc-muted);
}

.gwlc-meta.is-err {
    color: var(--lc-err);
    font-weight: 600;
}

.gwlc-meta button {
    color: inherit;
    font-weight: 800;
    text-decoration: underline;
}

.gwlc-row.is-pending .gwlc-bubble {
    opacity: .7;
}

.gwlc-note {
    align-self: center;
    max-width: 92%;
    margin: 10px 0;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--lc-surface);
    color: var(--lc-muted);
    font-size: 12.5px;
    text-align: center;
}

.gwlc-note.is-err {
    background: var(--lc-err-bg);
    color: var(--lc-err);
}

/* yazıyor... */
.gwlc-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.gwlc-typing[hidden] {
    display: none;
}

.gwlc-dots {
    display: inline-flex;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
    background: var(--lc-them-bg);
}

.gwlc-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lc-muted);
    animation: gwlc-dot 1.2s infinite ease-in-out;
}

.gwlc-dots i:nth-child(2) { animation-delay: .15s; }
.gwlc-dots i:nth-child(3) { animation-delay: .3s; }

/* ---------- Çipler ---------- */
.gwlc-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding: 4px 14px 8px;
    flex-shrink: 0;
}

.gwlc-chips:empty {
    display: none;
}

.gwlc-chip {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--lc-line);
    background: var(--lc-bg);
    color: var(--lc-text);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .15s ease, background .15s ease;
    animation: gwlc-in .25s ease backwards;
}

.gwlc-chip:hover {
    border-color: var(--lc-navy);
    background: var(--lc-surface);
}

html[data-theme="dark"] .gwlc-chip:hover {
    border-color: var(--lc-lime);
}

/* ---------- Yazma alanı ---------- */
.gwlc-composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin: 0 10px 8px;
    padding: 6px 6px 6px 8px;
    border: 1.5px solid var(--lc-line);
    border-radius: 16px;
    background: var(--lc-bg);
    flex-shrink: 0;
    transition: border-color .15s ease;
}

.gwlc-composer:focus-within {
    border-color: var(--lc-navy);
}

html[data-theme="dark"] .gwlc-composer:focus-within {
    border-color: var(--lc-lime);
}

.gwlc-composer.is-busy {
    opacity: .7;
    pointer-events: none;
}

.gwlc-attach {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--lc-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease;
}

.gwlc-attach:hover {
    background: var(--lc-surface);
    color: var(--lc-text);
}

.gwlc-attach[hidden] {
    display: none;
}

.gwlc-attach input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    cursor: pointer;
}

.gwlc-input {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    max-height: 120px;
    padding: 7px 4px;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.45;
    color: var(--lc-text);
}

.gwlc-input::placeholder {
    color: var(--lc-muted);
    opacity: 1;
}

.gwlc-send {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--lc-lime);
    color: var(--lc-lime-ink);
    flex-shrink: 0;
    transition: transform .15s ease, opacity .15s ease;
}

.gwlc-send:hover {
    transform: scale(1.05);
}

.gwlc-send:disabled {
    opacity: .45;
    transform: none;
    cursor: default;
}

.gwlc-err {
    margin: -2px 14px 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--lc-err);
}

.gwlc-err:empty {
    display: none;
}

.gwlc-foot {
    padding: 0 0 10px;
    text-align: center;
    font-size: 11px;
    color: var(--lc-muted);
    flex-shrink: 0;
}

.gwlc-foot b {
    color: var(--lc-text);
    font-weight: 700;
}

/* ---------- Mobil: tam ekran ---------- */
@media (max-width: 560px) {
    .gwlc {
        right: 14px;
        bottom: 14px;
    }

    .gwlc-launch {
        width: 56px;
        height: 56px;
    }

    .gwlc-panel {
        position: fixed;
        inset: 0;
        width: auto;
        height: 100%;
        height: 100dvh;
        bottom: auto;
        border-radius: 0;
        transform: translateY(24px);
        transform-origin: bottom center;
    }

    .gwlc[data-open="1"] .gwlc-launch {
        opacity: 0;
        pointer-events: none;
        transform: scale(.6);
    }

    .gwlc-head {
        padding-top: max(14px, env(safe-area-inset-top));
    }

    .gwlc-composer {
        margin-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .gwlc-input {
        font-size: 16px; /* iOS yakınlaştırmasın */
    }

    .gwlc-foot {
        display: none;
    }
}

html.gwlc-lock,
html.gwlc-lock body {
    overflow: hidden !important;
}

@keyframes gwlc-pop {
    from { transform: scale(.4); opacity: 0; }
}

@keyframes gwlc-in {
    from { opacity: 0; transform: translateY(6px); }
}

@keyframes gwlc-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: .45; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .gwlc *,
    .gwlc-launch,
    .gwlc-panel {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .gwlc {
        display: none !important;
    }
}
