#live-chat-root {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 70;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.live-chat-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 9999px;
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff;
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.live-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(124, 58, 237, 0.42);
}

.live-chat-launcher svg {
    width: 1.5rem;
    height: 1.5rem;
}

.live-chat-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    display: flex;
    flex-direction: column;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(32rem, calc(100vh - 6rem));
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.dark .live-chat-panel {
    border-color: #334155;
    background: #0f172a;
}

.live-chat-panel.hidden {
    display: none;
}

.live-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff;
}

.live-chat-header-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.live-chat-header-subtitle {
    margin-top: 0.125rem;
    font-size: 0.75rem;
    opacity: 0.9;
}

.live-chat-header-actions {
    display: flex;
    gap: 0.25rem;
}

.live-chat-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
}

.live-chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.live-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8fafc;
}

.live-chat-messages.hidden,
.live-chat-links.hidden,
.live-chat-form.hidden {
    display: none;
}

.live-chat-intro {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.dark .live-chat-intro {
    background: #020617;
    border-color: #334155;
}

.live-chat-intro.hidden {
    display: none;
}

.live-chat-intro-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.dark .live-chat-intro-title {
    color: #f8fafc;
}

.live-chat-intro-text {
    margin-top: 0.375rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #64748b;
}

.live-chat-required {
    color: #dc2626;
}

.live-chat-intro-error {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    color: #dc2626;
}

.live-chat-intro-error.hidden {
    display: none;
}

.live-chat-intro-label {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

.live-chat-intro-input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    font-size: 0.85rem;
    background: #fff;
    color: #0f172a;
}

.dark .live-chat-intro-input {
    border-color: #475569;
    background: #1e293b;
    color: #f1f5f9;
}

.live-chat-intro-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.875rem;
}

.live-chat-intro-btn {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff;
    color: #334155;
    cursor: pointer;
}

.live-chat-intro-btn.primary {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #fff;
}

.live-chat-intro-btn:hover {
    filter: brightness(0.98);
}

.dark .live-chat-messages {
    background: #020617;
}

.live-chat-message {
    max-width: 90%;
    padding: 0.625rem 0.875rem;
    border-radius: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.live-chat-message.user {
    align-self: flex-end;
    background: #7c3aed;
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.live-chat-message.assistant {
    align-self: flex-start;
    background: #fff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 0.25rem;
}

.live-chat-message.staff {
    align-self: flex-start;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-bottom-left-radius: 0.25rem;
}

.dark .live-chat-message.staff {
    background: #064e3b;
    color: #d1fae5;
    border-color: #047857;
}

.live-chat-message.staff::before {
    content: "Destek ekibi · ";
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.dark .live-chat-message.assistant {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

.live-chat-message.typing {
    align-self: flex-start;
    color: #64748b;
    background: transparent;
    border: none;
    padding-left: 0;
}

.live-chat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0 1rem 0.75rem;
}

.live-chat-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.625rem;
    border-radius: 9999px;
    border: 1px solid #ddd6fe;
    background: #f5f3ff;
    color: #6d28d9;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.dark .live-chat-link {
    border-color: #5b21b6;
    background: #2e1065;
    color: #ddd6fe;
}

.live-chat-link:hover {
    background: #ede9fe;
}

.dark .live-chat-link:hover {
    background: #4c1d95;
}

.live-chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.dark .live-chat-form {
    border-color: #334155;
    background: #0f172a;
}

.live-chat-input {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    outline: none;
    background: #fff;
    color: #0f172a;
}

.dark .live-chat-input {
    border-color: #475569;
    background: #1e293b;
    color: #f1f5f9;
}

.live-chat-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

.live-chat-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 0.75rem;
    background: #7c3aed;
    color: #fff;
    cursor: pointer;
}

.live-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    #live-chat-root {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .live-chat-panel {
        width: min(22rem, calc(100vw - 1.5rem));
    }
}

/* AI summarize rail (sales pages) */
.ai-summarize {
    position: fixed;
    right: 0;
    left: auto;
    top: 50%;
    z-index: 75;
    transform: translateY(-50%);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    pointer-events: none;
}

.ai-summarize-rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    width: 5.25rem;
    padding: 0.95rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-right: none;
    border-radius: 1rem 0 0 1rem;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.98) 0%, rgba(76, 29, 149, 0.98) 100%);
    color: #fff;
    box-shadow: -8px 0 36px rgba(109, 40, 217, 0.45);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: ai-summarize-glow 2.5s ease-in-out infinite;
}

@keyframes ai-summarize-glow {
    0%, 100% { box-shadow: -8px 0 36px rgba(109, 40, 217, 0.45); }
    50% { box-shadow: -8px 0 36px rgba(109, 40, 217, 0.45), 0 0 0 0.3rem rgba(124, 58, 237, 0.2); }
}

.ai-summarize-title {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    letter-spacing: 0.02em;
}

.ai-summarize-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-summarize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.25rem;
    padding: 0.5rem 0.4rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ai-summarize-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-3px);
}

.ai-summarize-btn-chatgpt { background: rgba(16, 163, 127, 0.28); }
.ai-summarize-btn-grok { background: rgba(15, 23, 42, 0.5); }
.ai-summarize-btn-perplexity { background: rgba(32, 128, 141, 0.32); }
.ai-summarize-btn-claude { background: rgba(217, 119, 6, 0.28); }

@media (max-width: 768px) {
    .ai-summarize {
        top: auto;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 5.25rem;
        transform: none;
    }

    .ai-summarize-rail {
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.7rem;
        border-right: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 1rem;
        animation: none;
    }

    .ai-summarize-title {
        flex: 0 0 3.25rem;
        font-size: 0.58rem;
        text-align: left;
    }

    .ai-summarize-buttons {
        flex: 1;
        flex-direction: row;
        gap: 0.35rem;
    }

    .ai-summarize-btn {
        flex: 1;
        min-height: 2.5rem;
        padding: 0.35rem 0.25rem;
        font-size: 0.58rem;
    }

    .ai-summarize-btn:hover {
        transform: translateY(-1px);
    }
}
