.chat-widget {
    position: fixed;
    right: 28px;
    bottom: 104px;
    z-index: 80;
}

.chat-toggle-button {
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 999px;
    background: radial-gradient(circle at 34% 28%, #ffffff 0%, #ffffff 46%, #eef8fb 100%);
    border: 1px solid rgba(107, 182, 207, 0.5);
    box-shadow: 0 18px 48px rgba(22, 48, 71, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: ip-chat-breathe 3.2s ease-in-out infinite;
}

.chat-toggle-button::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    border: 1px solid rgba(107, 182, 207, 0.36);
    animation: ip-chat-ring 2.6s ease-out infinite;
}

.chat-toggle-button.is-speaking {
    animation: ip-chat-speaking 0.95s ease-in-out infinite;
}

.chat-toggle-button:hover {
    transform: translateY(-3px) scale(1.04);
    border-color: rgba(224, 31, 38, 0.35);
    box-shadow: 0 22px 58px rgba(22, 48, 71, 0.28);
}

.chat-toggle-button img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    display: block;
}

.ip-chat-panel {
    position: absolute;
    right: 0;
    bottom: 88px;
    width: min(380px, calc(100vw - 36px));
    border: 1px solid #dcecf2;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 25px 80px rgba(22, 48, 71, 0.22);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(0.98);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.ip-chat-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ip-chat-header {
    display: flex;
    gap: 14px;
    align-items: center;
    background: linear-gradient(135deg, #163047, #265d76);
    color: #ffffff;
    padding: 18px;
}

.ip-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(107, 182, 207, 0.28);
}

.ip-chat-avatar img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.ip-chat-header strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
}

.ip-chat-header span {
    display: block;
    color: #c7e4ee;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    margin-top: 3px;
}

.ip-chat-body {
    max-height: 430px;
    display: grid;
    grid-template-rows: minmax(180px, 1fr) auto;
}

.ip-chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 18px;
    display: grid;
    gap: 10px;
    background: #f8fcfe;
}

.ip-chat-message {
    max-width: 92%;
    border-radius: 18px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
}

.ip-chat-message.bot {
    justify-self: start;
    background: #ffffff;
    color: #163047;
    border: 1px solid #dcecf2;
}

.ip-chat-message.user {
    justify-self: end;
    background: #163047;
    color: #ffffff;
}

.ip-chat-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.ip-chat-typing i {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #6bb6cf;
    animation: ip-chat-dot 0.9s ease-in-out infinite;
}

.ip-chat-typing i:nth-child(2) {
    animation-delay: 0.12s;
}

.ip-chat-typing i:nth-child(3) {
    animation-delay: 0.24s;
}

.ip-chat-options {
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    background: #ffffff;
    border-top: 1px solid #dcecf2;
}

.ip-chat-option,
.ip-chat-link {
    min-height: 42px;
    border-radius: 13px;
    border: 1px solid #dcecf2;
    background: #ffffff;
    color: #163047;
    font-weight: 900;
    font-size: 13px;
    padding: 0 12px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ip-chat-option:hover,
.ip-chat-link:hover {
    transform: translateY(-1px);
    background: #e8f6fa;
    border-color: #b9e1ed;
}

.ip-chat-link.primary {
    grid-column: 1 / -1;
    background: #25d366;
    color: #ffffff;
    border-color: #25d366;
}

.ip-chat-disclaimer {
    grid-column: 1 / -1;
    color: #6d8290;
    font-size: 11px;
    line-height: 1.45;
    padding: 2px 4px 0;
}

@keyframes ip-chat-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.035); }
}

@keyframes ip-chat-speaking {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    25% { transform: translateY(-2px) rotate(-2deg) scale(1.035); }
    50% { transform: translateY(0) rotate(2deg) scale(1.02); }
    75% { transform: translateY(-1px) rotate(-1deg) scale(1.04); }
}

@keyframes ip-chat-ring {
    0% { opacity: 0.65; transform: scale(0.92); }
    100% { opacity: 0; transform: scale(1.22); }
}

@keyframes ip-chat-dot {
    0%, 100% { transform: translateY(0); opacity: 0.45; }
    50% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 640px) {
    .chat-widget {
        right: 18px;
        bottom: 92px;
    }

    .chat-toggle-button {
        width: 64px;
        height: 64px;
    }

    .chat-toggle-button img {
        width: 48px;
        height: 48px;
    }

    .ip-chat-panel {
        right: 0;
        bottom: 78px;
    }
}
