/* Canlı destek — tema: html[data-theme] ile uyumlu */
:root {
    --lc-radius: 16px;
    --lc-radius-sm: 12px;
    --lc-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    --lc-launcher-bg: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --lc-launcher-text: #fff;
    --lc-panel-bg: #ffffff;
    --lc-panel-border: rgba(15, 23, 42, 0.08);
    --lc-header-border: rgba(15, 23, 42, 0.06);
    --lc-text: #0f172a;
    --lc-muted: #64748b;
    --lc-incoming-bg: #f1f5f9;
    --lc-outgoing-bg: #2563eb;
    --lc-outgoing-text: #fff;
    --lc-input-bg: #f8fafc;
    --lc-online: #22c55e;
    --lc-sep: #e2e8f0;
}

[data-theme="dark"] {
    --lc-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --lc-launcher-bg: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --lc-panel-bg: #1e293b;
    --lc-panel-border: rgba(255, 255, 255, 0.08);
    --lc-header-border: rgba(255, 255, 255, 0.06);
    --lc-text: #f1f5f9;
    --lc-muted: #94a3b8;
    --lc-incoming-bg: #334155;
    --lc-outgoing-bg: #3b82f6;
    --lc-outgoing-text: #fff;
    --lc-input-bg: #0f172a;
    --lc-sep: #334155;
}

.live-chat-launcher {
    position: fixed;
    z-index: 9998;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.45rem;
    min-height: 7rem;
    max-width: 2.6rem;
    background: var(--lc-launcher-bg);
    color: var(--lc-launcher-text);
    border: none;
    border-radius: var(--lc-radius-sm) 0 0 var(--lc-radius-sm);
    box-shadow: var(--lc-shadow), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    line-height: 1.35;
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.live-chat-launcher:hover {
    filter: brightness(1.06);
    transform: translateY(-50%) translateX(-2px);
}

.live-chat-launcher:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.live-chat-launcher-badge {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    writing-mode: horizontal-tb;
    display: none;
}

.live-chat-launcher-badge.is-on {
    display: block;
}

@media (max-width: 768px) {
    .live-chat-launcher {
        top: auto;
        bottom: 5.5rem;
        right: 0;
        transform: none;
        min-height: auto;
        padding: 0.55rem 0.4rem;
        max-width: 2.4rem;
        font-size: 0.72rem;
    }
    .live-chat-launcher:hover {
        transform: translateX(-2px);
    }
}

.live-chat-panel {
    position: fixed;
    z-index: 9999;
    right: 1rem;
    bottom: 1rem;
    width: min(100vw - 2rem, 384px);
    height: min(72vh, 568px);
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    background: var(--lc-panel-bg);
    border: 1px solid var(--lc-panel-border);
    border-radius: var(--lc-radius);
    box-shadow: var(--lc-shadow), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    font-family: "Outfit", system-ui, sans-serif;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.985);
    transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.24s;
}

.live-chat-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.live-chat-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--lc-header-border);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.04) 0%, transparent 100%);
}
[data-theme="dark"] .live-chat-panel-header {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
}

.live-chat-panel-header-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--lc-text);
}

.live-chat-panel-headtext {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    gap: 0.14rem;
}

.live-chat-agent-status {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--lc-muted);
}

.live-chat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lc-online);
    flex-shrink: 0;
}

.live-chat-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: var(--lc-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-chat-close:hover {
    background: var(--lc-incoming-bg);
    color: var(--lc-text);
}

.live-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    -webkit-overflow-scrolling: touch;
}

/* Bir mesaj turu — balon sağ/sol hizada, balon genişliği metne göre */
.live-chat-turn {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.live-chat-turn--visitor {
    align-items: flex-end;
}

.live-chat-turn--staff {
    align-items: flex-start;
}

.live-chat-bubble-col {
    flex: 0 1 auto;
    width: fit-content;
    max-width: min(100%, 17.5rem);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.live-chat-day-sep {
    text-align: center;
    font-size: 0.72rem;
    color: var(--lc-muted);
    margin: 0.35rem 0;
    position: relative;
}

.live-chat-day-sep span {
    background: var(--lc-panel-bg);
    padding: 0 0.5rem;
    position: relative;
    z-index: 1;
}

.live-chat-day-sep::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--lc-sep);
    z-index: 0;
}

.live-chat-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.45rem;
    width: fit-content;
    max-width: 100%;
}

.live-chat-row--out {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.live-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #94a3b8, #64748b);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
}

.live-chat-bubble {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    box-sizing: border-box;
}

.live-chat-bubble--in {
    background: var(--lc-incoming-bg);
    color: var(--lc-text);
    border-bottom-left-radius: 4px;
}

.live-chat-staff-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--lc-muted);
    margin: 0 0 0.2rem 0.1rem;
    align-self: flex-start;
    max-width: 100%;
}

.live-chat-bubble--out {
    background: var(--lc-outgoing-bg);
    color: var(--lc-outgoing-text);
    border-bottom-right-radius: 4px;
}

.live-chat-bubble--sys {
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
    background: var(--lc-incoming-bg);
    color: var(--lc-muted);
    font-size: 0.82rem;
    border-radius: 10px;
}

.live-chat-bubble a {
    color: #2563eb;
    text-decoration: underline;
}

.live-chat-bubble--out a {
    color: #e0e7ff;
}

.live-chat-meta {
    font-size: 0.68rem;
    color: var(--lc-muted);
    margin-top: 0.2rem;
    padding-right: 0.15rem;
    text-align: right;
    width: fit-content;
    max-width: 100%;
}

.live-chat-meta--staff {
    text-align: left;
    padding-right: 0;
    padding-left: 0.15rem;
    margin-left: calc(32px + 0.45rem);
}

.live-chat-footer {
    border-top: 1px solid var(--lc-header-border);
    padding: 0.65rem 0.75rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.live-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    background: var(--lc-input-bg);
    border-radius: var(--lc-radius-sm);
    padding: 0.35rem 0.45rem;
}

.live-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--lc-text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    max-height: 5rem;
    min-height: 2.25rem;
    line-height: 1.4;
    padding: 0.35rem 0.25rem;
}

.live-chat-input:focus {
    outline: none;
}

.live-chat-input-wrap:focus-within {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    border-radius: var(--lc-radius-sm);
}

.live-chat-ico-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--lc-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.live-chat-ico-btn:hover {
    background: var(--lc-incoming-bg);
    color: var(--lc-text);
}

.live-chat-send {
    background: var(--lc-outgoing-bg) !important;
    color: var(--lc-outgoing-text) !important;
}

.live-chat-send:hover {
    filter: brightness(1.08);
}

.live-chat-emoji-pop {
    position: absolute;
    bottom: 100%;
    right: 0.5rem;
    margin-bottom: 0.35rem;
    display: none;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 220px;
    padding: 0.5rem;
    background: var(--lc-panel-bg);
    border: 1px solid var(--lc-panel-border);
    border-radius: var(--lc-radius-sm);
    box-shadow: var(--lc-shadow);
    z-index: 2;
}

.live-chat-emoji-pop.is-open {
    display: flex;
}

.live-chat-emoji-pop button {
    border: none;
    background: var(--lc-incoming-bg);
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.live-chat-input-area {
    position: relative;
}

.live-chat-banner {
    font-size: 0.78rem;
    color: #b91c1c;
    text-align: center;
    padding: 0.35rem;
}

[data-theme="dark"] .live-chat-banner {
    color: #fca5a5;
}

body.is-panel .live-chat-launcher,
body.is-panel .live-chat-panel {
    display: none !important;
}
