:root {
    --ig-chatbot-z: 2140;
}

.ig-chatbot-root {
    position: fixed;
    inset-inline-end: 18px;
    bottom: 18px;
    z-index: var(--ig-chatbot-z);
    font-family: inherit;
}

.ig-chatbot-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(140deg, #2f467f 0%, #3f5da8 52%, #567bd4 100%);
    box-shadow: 0 14px 28px rgba(28, 49, 102, 0.32);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: ig-chatbot-nudge 4.8s ease-in-out infinite;
}

.ig-chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(28, 49, 102, 0.38);
}

.ig-chatbot-root.open .ig-chatbot-toggle {
    animation: none;
}

.ig-chatbot-presence-note {
    position: absolute;
    inset-inline-end: 70px;
    bottom: 10px;
    max-width: 220px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #d5e1f7;
    background: #ffffff;
    color: #2f467f;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 10px 22px rgba(23, 41, 81, 0.18);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.ig-chatbot-presence-note.show {
    opacity: 1;
    transform: translateY(0);
}

.ig-chatbot-panel {
    position: absolute;
    inset-inline-end: 0;
    bottom: 72px;
    width: min(390px, calc(100vw - 24px));
    max-height: min(78vh, 720px);
    border-radius: 22px;
    border: 1px solid #dbe5f7;
    background: #ffffff;
    box-shadow: 0 24px 45px rgba(16, 31, 66, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ig-chatbot-root.open .ig-chatbot-panel {
    display: flex;
}

.ig-chatbot-head {
    padding: 14px 14px 12px;
    border-bottom: 1px solid #e3eaf8;
    background: linear-gradient(160deg, #f4f8ff 0%, #edf3ff 100%);
}

.ig-chatbot-title {
    margin: 0 !important;
    color: #059669 !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    text-align: center !important;
    width: 100% !important;
}

.ig-chatbot-sub {
    margin: 4px 0 0;
    color: #5c6f95;
    font-size: 12px;
    line-height: 1.45;
}

.ig-chatbot-tools {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
}

.ig-chatbot-suggest-toggle {
    border: 1px solid #d2def6;
    background: #fff;
    color: #334f83;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    display: none;
}

.ig-chatbot-root.suggestions-collapsed .ig-chatbot-suggest-toggle {
    display: inline-flex;
}

.ig-chatbot-messages {
    padding: 12px;
    overflow: auto;
    display: grid;
    gap: 9px;
    background:
        radial-gradient(circle at 90% 4%, rgba(235, 243, 255, 0.68), transparent 34%),
        #fcfdff;
}

.ig-chatbot-msg {
    max-width: 92%;
    border-radius: 14px;
    padding: 10px 11px;
    line-height: 1.7;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ig-chatbot-msg.bot {
    justify-self: start;
    color: #233a67;
    border: 1px solid #dce6fb;
    background: #f3f7ff;
}

.ig-chatbot-msg.user {
    justify-self: end !important;
    color: #000000 !important;
    border: 1px solid #cbd5e1 !important;
    background: #eef2f7 !important;
}

.ig-chatbot-typing {
    justify-self: start;
    color: #607197;
    font-size: 12px;
    padding: 2px 6px;
}

.ig-chatbot-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 10px;
    border-top: 1px solid #edf2fb;
    background: #fcfdff;
}

.ig-chatbot-root.suggestions-collapsed .ig-chatbot-quick {
    display: none;
}

.ig-chatbot-chip {
    border: 1px solid #d5e1f7;
    background: #fff;
    color: #304976;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}

.ig-chatbot-chip:hover {
    background: #eef4ff;
}

.ig-chatbot-input-wrap {
    border-top: 1px solid #e4ebfa;
    background: #fff;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.ig-chatbot-input {
    border: 1px solid #cfdbf3;
    border-radius: 12px;
    min-height: 42px;
    max-height: 105px;
    resize: none;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    color: #000000 !important;
    outline: none !important;
}

.ig-chatbot-input:focus {
    border-color: #6f84d2;
    box-shadow: 0 0 0 4px rgba(111, 132, 210, 0.15);
}

.ig-chatbot-input::placeholder {
    color: #94a3b8;
}

.ig-chatbot-send {
    border: 0;
    border-radius: 12px;
    min-width: 46px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #304a88, #4363b5);
}

.ig-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes ig-chatbot-nudge {
    0%, 70%, 100% {
        transform: translateX(0) translateY(0);
    }
    73% {
        transform: translateX(-2px) translateY(-1px) scale(1.02);
    }
    76% {
        transform: translateX(2px) translateY(0) scale(1.03);
    }
    79% {
        transform: translateX(-2px) translateY(0) scale(1.02);
    }
    82% {
        transform: translateX(2px) translateY(0) scale(1.02);
    }
    86% {
        transform: translateX(0) translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ig-chatbot-toggle {
        animation: none;
    }
}

@media (max-width: 640px) {
    .ig-chatbot-root {
        inset-inline-end: 10px;
        bottom: 10px;
    }

    .ig-chatbot-panel {
        width: min(390px, calc(100vw - 14px));
        bottom: 68px;
        border-radius: 16px;
        max-height: 75vh;
    }

    .ig-chatbot-toggle {
        width: 54px;
        height: 54px;
        border-radius: 15px;
    }

    .ig-chatbot-presence-note {
        inset-inline-end: 64px;
        max-width: 180px;
        font-size: 11px;
    }
}
