:root {
    --ls-accent: #ff1a1a;
    --ls-accent-end: #ff7b7b;
    --ls-accent-soft: rgba(255, 26, 26, 0.08);
    --ls-dark: #111111;
    --ls-dark-soft: #3b3b3b;
    --ls-surface: #ffffff;
    --ls-border: rgba(17, 24, 39, 0.08);
    --ls-muted: #6b7280;
    --ls-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
}

.live-support {
    bottom: var(--ls-offset-y, 24px);
    left: auto;
    position: fixed;
    right: var(--ls-offset-x, 24px);
    z-index: 10050;
    isolation: isolate;
}

.live-support--left {
    left: var(--ls-offset-x, 24px);
    right: auto;
}

.live-support--right {
    left: auto;
    right: var(--ls-offset-x, 24px);
}

/* Alt çubukta "canlı destek" varken yüzen buton yalnızca mobilde gizlenir (footer .bottom-nav ≤768px ile uyumlu); masaüstünde eski yüzen buton görünür */
@media (max-width: 768px) {
    .live-support--no-launcher .live-support__launcher {
        display: none !important;
    }
}

.live-support__launcher {
    align-items: center;
    background: linear-gradient(135deg, var(--ls-dark) 0%, var(--ls-dark-soft) 100%);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 20px 40px rgba(17, 17, 17, 0.28);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    gap: 0.85rem;
    padding: 0.8rem 1rem 0.8rem 0.85rem;
}

.live-support__launcher-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--ls-accent), var(--ls-accent-end));
    border-radius: 50%;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.live-support__launcher-icon svg,
.live-support__icon-btn svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
    width: 18px;
}

.live-support__launcher-copy {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.live-support__launcher-copy strong {
    font-size: 0.95rem;
    line-height: 1.1;
}

.live-support__launcher-copy small {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.76rem;
}

.live-support__panel {
    background: var(--ls-surface);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 28px;
    bottom: 76px;
    box-shadow: var(--ls-shadow);
    max-height: calc(100vh - 112px);
    max-height: calc(100dvh - 112px);
    overflow: hidden;
    position: absolute;
    right: 0;
    width: min(390px, calc(100vw - 32px));
}

/* Do not set display:flex on [hidden] — site CSS order can override the hidden attribute */
.live-support__panel:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.live-support__panel[hidden] {
    display: none !important;
}

.live-support--left .live-support__panel {
    left: 0;
    right: auto;
}

.live-support__header {
    align-items: flex-start;
    background:
        radial-gradient(circle at top right, var(--ls-accent-soft), transparent 36%),
        linear-gradient(135deg, var(--ls-dark), var(--ls-dark-soft));
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 1.15rem 1.2rem;
}

.live-support__badge {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
    padding: 0.35rem 0.7rem;
}

.live-support__header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.live-support__header p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    margin: 0;
}

.live-support__header-actions {
    display: flex;
    gap: 0.4rem;
}

.live-support__icon-btn {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.live-support__body {
    background: #f8fafc;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.live-support__intro,
.live-support__thread {
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}

.live-support__intro:not([hidden]),
.live-support__thread:not([hidden]) {
    display: flex;
}

.live-support__intro[hidden],
.live-support__thread[hidden] {
    display: none !important;
}

.live-support__intro-card {
    background: #fff;
    border: 1px solid var(--ls-border);
    border-radius: 20px;
    padding: 1rem;
}

.live-support__intro-card h3,
.live-support__thread-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.live-support__intro-card p,
.live-support__thread-status,
.live-support__thread-page,
.live-support__composer-note,
.live-support__form-note {
    color: var(--ls-muted);
    font-size: 0.82rem;
    margin: 0;
}

.live-support__topic-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.live-support__topic-chip {
    background: #fff;
    border: 1px solid var(--ls-border);
    border-radius: 18px;
    color: #374151;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 56px;
    padding: 0.7rem 0.8rem;
    text-align: left;
}

.live-support__topic-chip:hover {
    background: var(--ls-accent-soft);
    border-color: var(--ls-accent-soft);
    color: var(--ls-accent);
}

.live-support__form {
    display: grid;
    gap: 0.8rem;
}

/* Self-contained form styles: pages without Bootstrap still render correctly */
.live-support .form-control,
.live-support input.form-control,
.live-support textarea.form-control,
.live-support select.form-control {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--ls-border, rgba(17, 24, 39, 0.12));
    border-radius: 16px;
    box-shadow: none;
    box-sizing: border-box;
    color: #111827;
    display: block;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    min-height: 2.75rem;
    padding: 0.7rem 0.95rem;
    width: 100%;
}

.live-support textarea.form-control {
    min-height: 6.5rem;
    resize: vertical;
}

.live-support .form-control::placeholder,
.live-support input::placeholder,
.live-support textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.live-support .form-control:focus,
.live-support input.form-control:focus,
.live-support textarea.form-control:focus {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 0 0 3px var(--ls-accent-soft, rgba(255, 26, 26, 0.12));
    outline: 0;
}

.live-support .btn,
.live-support button.btn {
    border-radius: 14px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    min-height: 2.75rem;
    padding: 0.65rem 1.2rem;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border-width: 1px;
    border-style: solid;
    border-color: transparent;
    -webkit-tap-highlight-color: transparent;
}

.live-support .btn.w-100,
.live-support .w-100 {
    width: 100%;
    max-width: 100%;
}

.live-support__thread-meta {
    align-items: center;
    background: #fff;
    border: 1px solid var(--ls-border);
    border-radius: 20px;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.95rem 1rem;
}

.live-support__thread-page {
    max-width: 120px;
    text-align: right;
}

.live-support__messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 140px;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.live-support__messages::-webkit-scrollbar {
    width: 4px;
}

.live-support__messages::-webkit-scrollbar-thumb {
    background: rgba(17, 24, 39, 0.18);
    border-radius: 999px;
}

.live-support__message {
    display: flex;
    gap: 0.65rem;
    max-width: 85%;
}

.live-support__message.is-admin {
    align-self: flex-start;
}

.live-support__message.is-visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.live-support__message-badge {
    align-items: center;
    background: linear-gradient(135deg, var(--ls-dark), var(--ls-accent));
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.live-support__message.is-visitor .live-support__message-badge {
    background: linear-gradient(135deg, var(--ls-dark), var(--ls-dark-soft));
}

.live-support__message-card {
    background: #fff;
    border: 1px solid var(--ls-border);
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
    padding: 0.85rem 0.95rem;
}

.live-support__message.is-visitor .live-support__message-card {
    background: linear-gradient(180deg, var(--ls-dark), var(--ls-dark-soft));
    color: #fff;
}

.live-support .btn-danger {
    color: #fff;
    background: linear-gradient(135deg, var(--ls-accent), var(--ls-accent-end));
    border-color: transparent;
}

.live-support .btn-danger:hover,
.live-support .btn-danger:focus {
    background: linear-gradient(135deg, var(--ls-accent), var(--ls-accent-end));
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
}

.live-support .btn-dark {
    color: #fff;
    background: linear-gradient(135deg, var(--ls-dark), var(--ls-dark-soft));
    border-color: transparent;
}

.live-support .btn-dark:hover,
.live-support .btn-dark:focus {
    background: linear-gradient(135deg, var(--ls-dark), var(--ls-dark-soft));
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
}

.live-support__message-author {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.live-support__message-text {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.live-support__message-time {
    color: #9ca3af;
    font-size: 0.72rem;
    margin-top: 0.45rem;
}

.live-support__message.is-visitor .live-support__message-time {
    color: rgba(255, 255, 255, 0.68);
}

.live-support__composer {
    background: #fff;
    border: 1px solid var(--ls-border);
    border-radius: 20px;
    flex-shrink: 0;
    padding: 0.9rem;
}

.live-support__composer-footer {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 0.8rem;
}

.live-support__status-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 0.35rem;
    padding: 0.4rem 0.7rem;
}

.live-support__status-pill.is-open {
    background: #dcfce7;
    color: #15803d;
}

.live-support__status-pill.is-pending {
    background: #fff7ed;
    color: #c2410c;
}

.live-support__status-pill.is-closed {
    background: #f3f4f6;
    color: #6b7280;
}

@media (max-height: 900px) {
    .live-support {
        bottom: var(--ls-offset-y, 16px);
    }

    .live-support__panel {
        bottom: 72px;
        width: min(380px, calc(100vw - 24px));
    }

    .live-support__header {
        padding: 1rem 1rem 0.95rem;
    }

    .live-support__intro,
    .live-support__thread {
        gap: 0.85rem;
        padding: 0.9rem;
    }

    .live-support__topic-grid {
        gap: 0.55rem;
    }

    .live-support__topic-chip {
        min-height: 50px;
        padding: 0.65rem 0.75rem;
    }

    .live-support__form {
        gap: 0.65rem;
    }
}

@media (max-height: 760px) {
    .live-support__launcher {
        padding: 0.72rem 0.92rem 0.72rem 0.8rem;
    }

    .live-support__launcher-icon {
        height: 38px;
        width: 38px;
    }

    .live-support__launcher-copy strong {
        font-size: 0.9rem;
    }

    .live-support__launcher-copy small {
        font-size: 0.72rem;
    }

    .live-support__header h2 {
        font-size: 1rem;
    }

    .live-support__intro-card,
    .live-support__thread-meta,
    .live-support__composer {
        border-radius: 18px;
    }

    .live-support__form .form-control,
    .live-support__composer .form-control {
        border-radius: 14px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .live-support__form textarea.form-control,
    .live-support__composer textarea.form-control {
        min-height: 112px;
    }
}

@media (max-width: 575px) {
    .live-support {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .live-support__launcher {
        justify-content: center;
        width: 100%;
    }

    .live-support__panel {
        bottom: 84px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 112px);
        max-height: calc(100dvh - 112px);
        width: 100%;
    }

    .live-support__topic-grid {
        grid-template-columns: 1fr;
    }
}
