/* Müşteri vitini — sol alt yüzen canlı destek */
.ls-widget {
    position: fixed;
    z-index: 9990;
    left: var(--float-actions-left, max(16px, env(safe-area-inset-left, 0px)));
    right: auto;
    bottom: calc(var(--float-actions-nav-offset, 62px) + var(--float-actions-lift, 2px) + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: var(--font-base);
    pointer-events: none;
}

.ls-widget.is-open {
    pointer-events: auto;
    z-index: 10070;
}

.ls-widget__backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(15, 23, 42, 0.42);
    border: none;
    padding: 0;
    margin: 0;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: none;
}

.ls-widget__backdrop:not([hidden]) {
    display: block;
    pointer-events: auto;
}

body.has-paz-compare-dock .ls-widget {
    bottom: calc(134px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
    .ls-widget {
        bottom: max(26px, env(safe-area-inset-bottom, 0px));
    }

    body.has-paz-compare-dock .ls-widget {
        bottom: max(26px, env(safe-area-inset-bottom, 0px));
    }
}

.ls-widget__fab {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px 12px 16px;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    background: var(--gradient-primary-vertical);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        0 4px 14px color-mix(in srgb, var(--primary) 45%, transparent),
        0 2px 6px rgba(15, 23, 42, 0.12);
    transition:
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
    .ls-widget__fab:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow:
            0 8px 28px color-mix(in srgb, var(--primary-dark) 35%, transparent),
            0 4px 12px rgba(15, 23, 42, 0.15);
    }
}
.ls-widget__fab-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
.ls-widget__fab-label {
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.ls-widget__panel {
    pointer-events: auto;
    position: absolute;
    left: 0;
    right: auto;
    bottom: calc(100% + 12px);
    width: min(400px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    background: var(--surface-card, #fff);
    border-radius: 18px;
    overflow: hidden;
    touch-action: manipulation;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(15, 23, 42, 0.06);
    animation: ls-widget-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ls-widget__panel[hidden] {
    display: none !important;
}
@keyframes ls-widget-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.ls-widget__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    background: var(--gradient-brand-deep);
    color: #fff;
}
.ls-widget__title {
    display: block;
    font-size: 17px;
    letter-spacing: 0.02em;
}
.ls-widget__subtitle {
    display: block;
    font-size: 12px;
    opacity: 0.88;
    margin-top: 4px;
    font-weight: 400;
}
.ls-widget__close {
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.ls-widget__close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.ls-widget__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    padding: 12px 14px 14px;
    overflow: hidden;
}
.ls-widget__step-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800, #1f2937);
    margin: 0 0 12px;
}
.ls-widget__field {
    display: block;
    margin-bottom: 10px;
}
.ls-widget__field span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    margin-bottom: 4px;
}
.ls-widget__field abbr {
    text-decoration: none;
    color: var(--danger, #dc2626);
}
.ls-widget__btn-next,
.ls-widget__btn-back,
.ls-widget__btn-connect {
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    padding: 12px 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.ls-widget__btn-next {
    width: 100%;
    margin-top: 8px;
    background: var(--primary);
    color: #fff;
}
.ls-widget__step-actions {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px;
    margin-top: 12px;
}
.ls-widget__btn-back {
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-800, #1f2937);
}
.ls-widget__btn-connect {
    background: linear-gradient(135deg, #059669 0%, var(--primary) 100%);
    color: #fff;
}
.ls-widget__btn-connect:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ls-widget__topics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 2px;
}
.ls-widget__topic {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 2px solid var(--gray-200, #e5e7eb);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.35;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.ls-widget__topic:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}
.ls-widget__topic input {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.ls-widget__cd {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.97);
    z-index: 6;
}
.ls-widget__cd-num {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.ls-widget__cd-text {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--gray-600, #4b5563);
}
.ls-widget__chip {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 10px;
    border-radius: 8px;
    margin: 0 0 8px;
    border: 1px solid var(--primary-soft);
}
.ls-widget__chat-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.ls-widget__input {
    width: 100%;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
}
.ls-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    max-height: 340px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 35%);
}
.ls-widget__bubble {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 14px 14px 14px 4px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}
.ls-widget__bubble--staff {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    color: var(--gray-800, #1f2937);
}
.ls-widget__bubble--visitor {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}
.ls-widget__bubble time {
    display: block;
    font-size: 10px;
    opacity: 0.72;
    margin-top: 6px;
}
.ls-widget__welcome {
    align-self: center;
    text-align: center;
    font-size: 12px;
    color: var(--gray-500, #6b7280);
    padding: 8px 12px;
    max-width: 95%;
    line-height: 1.4;
}
.ls-widget__closed {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--danger, #dc2626);
    background: #fef2f2;
    border-top: 1px solid #fecaca;
}
.ls-widget__closed--banner {
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #fecaca;
}
.ls-widget__form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--gray-100, #f3f4f6);
    align-items: flex-end;
    background: #fff;
}
.ls-widget__form textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    min-height: 44px;
    max-height: 120px;
}
.ls-widget__form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.ls-widget__send {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s,
        transform 0.15s;
}
.ls-widget__send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}
.ls-widget__rating {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--gray-100, #f3f4f6);
    background: linear-gradient(180deg, var(--primary-light) 0%, #fff 40%);
}
.ls-widget__rating-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800, #1f2937);
}
.ls-widget__stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}
.ls-widget__star {
    flex: 1;
    max-width: 44px;
    height: 40px;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    font-size: 20px;
    line-height: 1;
    color: var(--gray-300, #d1d5db);
    cursor: pointer;
    transition:
        border-color 0.15s,
        color 0.15s,
        transform 0.12s;
}
.ls-widget__star:hover {
    border-color: #fbbf24;
    color: #fbbf24;
}
.ls-widget__star.is-active {
    border-color: #f59e0b;
    color: #f59e0b;
    background: #fffbeb;
}
.ls-widget__rating-field {
    display: block;
    margin-bottom: 10px;
}
.ls-widget__rating-field span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    margin-bottom: 4px;
}
.ls-widget__rating-field textarea {
    width: 100%;
    resize: none;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    min-height: 52px;
}
.ls-widget__rating-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ls-widget__rating-submit {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, #059669 0%, var(--primary) 100%);
    color: #fff;
}
.ls-widget__rating-skip {
    border: none;
    background: transparent;
    color: var(--gray-500, #6b7280);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px 6px;
}
.ls-widget__rating-done {
    text-align: center;
    padding: 16px 8px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700, #374151);
}
.ls-widget__rating-done p {
    margin: 0;
}
@media (prefers-reduced-motion: reduce) {
    .ls-widget__panel {
        animation: none;
    }
    .ls-widget__fab:hover {
        transform: none;
    }
}

@media (max-width: 991.98px) {
    .ls-widget {
        bottom: calc(var(--float-actions-nav-offset, 62px) + var(--float-actions-lift, 16px) + env(safe-area-inset-bottom, 0px));
    }

    body.has-paz-compare-dock .ls-widget {
        bottom: calc(148px + env(safe-area-inset-bottom, 0px));
    }

    .ls-widget__fab {
        width: 44px;
        height: 44px;
        min-height: 44px;
        min-width: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        gap: 0;
        font-size: 13px;
        overflow: visible;
        position: relative;
        z-index: 2;
    }

    .ls-widget__fab::before {
        content: '';
        position: absolute;
        inset: -6px;
        border-radius: 50%;
    }

    .ls-widget__fab-icon {
        font-size: 20px;
        pointer-events: none;
    }

    .ls-widget__fab-label {
        display: none;
    }

    .ls-widget__panel {
        position: fixed;
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: calc(
            var(--float-actions-nav-offset, 62px)
            + var(--float-actions-lift, 16px)
            + 44px
            + 10px
            + env(safe-area-inset-bottom, 0px)
        );
        width: auto;
        max-height: min(calc(100dvh - 200px), 520px);
        z-index: 3;
    }
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .ls-widget__fab:hover .ls-widget__fab-label,
    .ls-widget__fab:focus-visible .ls-widget__fab-label {
        max-width: 110px;
        opacity: 1;
    }

    .ls-widget__fab:hover,
    .ls-widget__fab:focus-visible {
        width: auto;
        padding: 0 14px 0 11px;
        border-radius: 100px;
        gap: 6px;
    }
}

@media (max-width: 991.98px) and (hover: none) {
    .ls-widget__fab:active {
        transform: scale(0.94);
    }
}
