﻿:root {
    --pcw-primary: #2563eb;
    --pcw-primary-dark: #1d4ed8;
    --pcw-bg: #ffffff;
    --pcw-muted: #6b7280;
    --pcw-border: #e5e7eb;
    --pcw-soft: #f8fafc;
    --pcw-user-bg: #2563eb;
    --pcw-user-text: #ffffff;
    --pcw-bot-bg: #f1f5f9;
    --pcw-bot-text: #111827;
    --pcw-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    --pcw-radius: 18px;
    --pcw-font: Arial, sans-serif;
}

.pcw {
    position: fixed;
    right: 0;
    bottom: 82px;
    z-index: 99999;
    font-family: var(--pcw-font);
}

.pcw-launcher {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pcw-primary), var(--pcw-primary-dark));
    color: #fff;
    cursor: pointer;
    box-shadow: var(--pcw-shadow);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease;
}

    .pcw-launcher:hover {
        transform: translateY(-2px);
    }

.pcw-launcher-icon {
    font-size: 28px;
    line-height: 1;
}

.pcw-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
}

.pcw-panel {
    width: 380px;
    height: 620px;
    background: var(--pcw-bg);
    border-radius: var(--pcw-radius);
    box-shadow: var(--pcw-shadow);
    overflow: hidden;
    border: 1px solid var(--pcw-border);
    display: none;
    flex-direction: column;
    margin-bottom: 14px;
}

    .pcw-panel.open {
        display: flex;
        animation: pcwFadeUp .2s ease;
    }

@keyframes pcwFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pcw-header {
    background: linear-gradient(135deg, var(--pcw-primary), var(--pcw-primary-dark));
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pcw-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pcw-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.pcw-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.pcw-subtitle {
    font-size: 12px;
    opacity: .9;
    margin-top: 2px;
}

.pcw-header-actions {
    display: flex;
    gap: 6px;
}

.pcw-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.pcw-body {
    flex: 1;
    overflow: hidden;
    background: var(--pcw-soft);
}

.pcw-messages {
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.pcw-message {
    display: flex;
    margin-bottom: 14px;
}

    .pcw-message.user {
        justify-content: flex-end;
    }

    .pcw-message.bot {
        justify-content: flex-start;
    }

.pcw-bubble {
    max-width: 82%;
    padding: 11px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.pcw-message.user .pcw-bubble {
    background: var(--pcw-user-bg);
    color: var(--pcw-user-text);
    border-bottom-right-radius: 5px;
}

.pcw-message.bot .pcw-bubble {
    background: var(--pcw-bot-bg);
    color: var(--pcw-bot-text);
    border-bottom-left-radius: 5px;
}

.pcw-time {
    font-size: 11px;
    color: var(--pcw-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.pcw-message.user .pcw-time {
    text-align: right;
}

.pcw-message.bot .pcw-time {
    text-align: left;
}

.pcw-typing {
    display: flex;
    gap: 5px;
    padding: 0 16px 12px 16px;
    background: var(--pcw-soft);
}

    .pcw-typing span {
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: #94a3b8;
        display: inline-block;
        animation: pcwBlink 1.2s infinite ease-in-out;
    }

        .pcw-typing span:nth-child(2) {
            animation-delay: .2s;
        }

        .pcw-typing span:nth-child(3) {
            animation-delay: .4s;
        }

@keyframes pcwBlink {
    0%, 80%, 100% {
        opacity: .25;
        transform: scale(.9);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.pcw-footer {
    padding: 12px;
    background: #fff;
    border-top: 1px solid var(--pcw-border);
}

.pcw-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1px solid var(--pcw-border);
    border-radius: 14px;
    padding: 8px;
    background: #fff;
}

.pcw-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    max-height: 120px;
    min-height: 38px;
    font-size: 14px;
    line-height: 1.4;
    padding: 6px 4px;
    background: transparent;
    font-family: inherit;
}

.pcw-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: var(--pcw-primary);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

    .pcw-send:disabled {
        opacity: .7;
        cursor: not-allowed;
    }

.pcw-footer-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--pcw-muted);
    text-align: center;
}

@media (max-width: 640px) {
    .pcw {
        right: 0;
        bottom: 76px;
        left: 12px;
    }

    .pcw-panel {
        width: 100%;
        height: 72vh;
    }

    .pcw-launcher {
        margin-left: auto;
        display: flex;
    }
}
