#pac-chat-root,
#pac-chat-root * {
    box-sizing: border-box;
    font-family: Tahoma, Arial, sans-serif;
}

#pac-chat-root {
    --pac-accent: #2563eb;
    position: fixed;
    z-index: 999999;
    bottom: 22px;
    color: #0f172a;
    direction: rtl;
}

#pac-chat-root.pac-position-left { left: 22px; }
#pac-chat-root.pac-position-right { right: 22px; }

.pac-fab {
    position: relative;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 24px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--pac-accent), #7c3aed);
    color: #fff;
    box-shadow: 0 18px 45px rgba(37, 99, 235, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
}

.pac-fab:hover { transform: translateY(-3px); }
.pac-fab-icon { font-size: 28px; line-height: 1; }
.pac-fab-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 28px;
    border: 2px solid rgba(37, 99, 235, .24);
    animation: pacPulse 1.8s infinite;
}

@keyframes pacPulse {
    0% { transform: scale(.85); opacity: .9; }
    100% { transform: scale(1.25); opacity: 0; }
}

.pac-window {
    position: absolute;
    bottom: 78px;
    width: min(390px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 120px));
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.96);
    transition: opacity .2s ease, transform .2s ease;
    display: flex;
    flex-direction: column;
}

.pac-position-left .pac-window { left: 0; }
.pac-position-right .pac-window { right: 0; }
.pac-open .pac-window {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.pac-header {
    padding: 18px 18px 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--pac-accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pac-header strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
}

.pac-header span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: .88;
}

.pac-close {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.16);
    color: #fff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.pac-body {
    flex: 1;
    min-height: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .10), transparent 28%),
        linear-gradient(180deg, #f8fafc, #eef2ff);
    display: flex;
    flex-direction: column;
}

.pac-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
}

.pac-message {
    display: flex;
    margin: 0 0 12px;
}

.pac-user { justify-content: flex-start; }
.pac-assistant { justify-content: flex-end; }

.pac-bubble {
    max-width: 82%;
    padding: 11px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.pac-user .pac-bubble {
    color: #fff;
    background: var(--pac-accent);
    border-bottom-right-radius: 6px;
}

.pac-assistant .pac-bubble {
    color: #0f172a;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
    border-bottom-left-radius: 6px;
}

.pac-lead-form {
    margin: 18px;
    padding: 18px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .08);
}

.pac-form-note {
    margin: 0 0 14px;
    color: #334155;
    line-height: 1.8;
    font-size: 14px;
}

.pac-lead-form label {
    display: block;
    margin: 0 0 12px;
}

.pac-lead-form span {
    display: block;
    margin: 0 0 6px;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.pac-lead-form input,
.pac-compose textarea {
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    background: #f8fafc;
    color: #0f172a;
    outline: 0;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.pac-lead-form input {
    height: 44px;
    padding: 0 13px;
}

.pac-lead-form input:focus,
.pac-compose textarea:focus {
    border-color: var(--pac-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.pac-primary {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 16px;
    background: var(--pac-accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.pac-loading .pac-primary {
    opacity: .68;
    pointer-events: none;
}

.pac-form-error {
    display: none;
    margin-top: 10px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.7;
}

.pac-compose {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.pac-compose[hidden] { display: none; }

.pac-compose textarea {
    resize: none;
    min-height: 46px;
    max-height: 120px;
    padding: 12px 14px;
    line-height: 1.7;
}

.pac-compose button {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 16px;
    color: #fff;
    background: var(--pac-accent);
    cursor: pointer;
    transform: rotate(180deg);
    font-size: 18px;
}

@media (max-width: 520px) {
    #pac-chat-root {
        left: 14px !important;
        right: 14px !important;
        bottom: 14px;
    }
    .pac-fab {
        width: 58px;
        height: 58px;
        border-radius: 22px;
    }
    .pac-window {
        width: calc(100vw - 28px);
        height: min(650px, calc(100vh - 96px));
    }
}
