.ctp-front-ctpus {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99998;
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #fff;
}

.ctp-front-ctpus *,
.ctp-front-ctpus *::before,
.ctp-front-ctpus *::after {
    box-sizing: border-box;
}

.ctp-front-ctpus__teaser {
    position: absolute;
    right: 66px;
    bottom: 8px;
    width: min(320px, calc(100vw - 112px));
    padding: 14px 16px;
    border: 1px solid rgba(255, 196, 0, 0.28);
    border-radius: 8px;
    background: rgba(22, 22, 22, 0.96);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.ctp-front-ctpus.is-open .ctp-front-ctpus__teaser {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}

.ctp-front-ctpus__teaser-label {
    display: block;
    margin-bottom: 5px;
    color: #ffc400;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.ctp-front-ctpus__teaser p {
    margin: 0;
    color: #f1f1f1;
    font-size: 13px;
    line-height: 1.45;
}

.ctp-front-ctpus__button {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px !important;
    margin: 0 !important;
    overflow: hidden;
    border: 1px solid rgba(255, 196, 0, 0.72);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(255, 196, 0, 0.16), rgba(15, 15, 15, 0.96) 54%, rgba(255, 196, 0, 0.1));
    box-shadow: 0 0 0 7px rgba(255, 196, 0, 0.07), 0 16px 36px rgba(0, 0, 0, 0.42);
    color: #ffc400;
    appearance: none;
    cursor: pointer;
    line-height: 1 !important;
    transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.ctp-front-ctpus__button:hover {
    transform: translateY(-2px);
    border-color: #ffc400;
    box-shadow: 0 0 0 10px rgba(255, 196, 0, 0.1), 0 22px 54px rgba(0, 0, 0, 0.5);
}

.ctp-front-ctpus.is-open .ctp-front-ctpus__button {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.92);
}

.ctp-front-ctpus__robot {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ctp-front-ctpus__avatar-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.ctp-front-ctpus__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(420px, calc(100vw - 48px));
    height: min(660px, calc(100vh - 136px));
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: #171717;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
    transform-origin: right bottom;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.ctp-front-ctpus.is-open .ctp-front-ctpus__panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ctp-front-ctpus__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, #202020 0%, #111 100%);
}

.ctp-front-ctpus__avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 6px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 196, 0, 0.46);
    background: rgba(255, 196, 0, 0.08);
    color: #ffc400;
}

.ctp-front-ctpus__avatar .ctp-front-ctpus__robot {
    width: 27px;
    height: 27px;
}

.ctp-front-ctpus__header strong,
.ctp-front-ctpus__header span {
    display: block;
}

.ctp-front-ctpus__header strong {
    color: #fff;
    font-size: 18px;
    line-height: 1.1;
}

.ctp-front-ctpus__header span {
    margin-top: 4px;
    color: #ffc400;
    font-size: 12px;
    font-weight: 800;
}

.ctp-front-ctpus__close {
    width: 36px;
    height: 36px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    color: #d8d8d8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.ctp-front-ctpus__close:hover {
    border-color: #ffc400;
    color: #ffc400;
}

.ctp-front-ctpus__body {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        #151515;
    background-size: 22px 22px;
}

.ctp-front-ctpus__messages {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 196, 0, 0.5) rgba(255, 255, 255, 0.08);
}

.ctp-front-ctpus__message {
    display: flex;
    margin-bottom: 12px;
}

.ctp-front-ctpus__message.is-user {
    justify-content: flex-end;
}

.ctp-front-ctpus__bubble {
    max-width: 84%;
    padding: 11px 13px;
    border-radius: 8px;
    color: #f4f4f4;
    font-size: 14px;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ctp-front-ctpus__message.is-bot .ctp-front-ctpus__bubble {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
}

.ctp-front-ctpus__message.is-user .ctp-front-ctpus__bubble {
    border: 1px solid rgba(255, 196, 0, 0.45);
    background: rgba(255, 196, 0, 0.17);
    color: #fff8d6;
}

.ctp-front-ctpus__message.is-loading .ctp-front-ctpus__bubble {
    color: #aaa;
}

.ctp-front-ctpus__typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ctp-front-ctpus__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffc400;
    animation: ctpFrontCtpusTyping 0.9s infinite ease-in-out;
}

.ctp-front-ctpus__typing span:nth-child(2) {
    animation-delay: 0.12s;
}

.ctp-front-ctpus__typing span:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes ctpFrontCtpusTyping {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.ctp-front-ctpus__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(18, 18, 18, 0.92);
}

.ctp-front-ctpus__suggestion {
    min-height: 32px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 196, 0, 0.35);
    border-radius: 7px;
    background: rgba(255, 196, 0, 0.08);
    color: #ffc400;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.15;
    cursor: pointer;
}

.ctp-front-ctpus__suggestion:hover {
    background: rgba(255, 196, 0, 0.16);
    color: #ffe071;
}

.ctp-front-ctpus__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #111;
}

.ctp-front-ctpus__composer textarea {
    width: 100%;
    max-width: 100%;
    max-height: 112px;
    min-height: 44px;
    resize: none;
    overflow-y: auto;
    padding: 12px 13px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    outline: none;
    appearance: none;
    background: #090909;
    color: #fff;
    font: inherit;
    font-size: 14px;
    line-height: 1.35;
    scrollbar-width: none;
}

.ctp-front-ctpus__composer textarea::-webkit-resizer {
    display: none;
}

.ctp-front-ctpus__composer textarea::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.ctp-front-ctpus__composer textarea:focus {
    border-color: #ffc400;
    box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.12);
}

.ctp-front-ctpus__composer button {
    position: relative;
    inline-size: 46px !important;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    max-inline-size: 46px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    border: 1px solid #ffc400;
    border-radius: 7px;
    background: #ffc400;
    color: #111;
    appearance: none;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1 !important;
    flex: 0 0 46px;
    text-indent: 0 !important;
}

.ctp-front-ctpus__composer button[type="submit"] {
    padding: 0 !important;
}

.ctp-front-ctpus__composer button svg {
    display: none;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ctp-front-ctpus__composer button::before,
.ctp-front-ctpus__composer button::after {
    content: "";
    position: absolute;
    display: block;
    pointer-events: none;
}

.ctp-front-ctpus__composer button::before {
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-top: 2px solid #111;
    border-right: 2px solid #111;
    transform: translate(-38%, -50%) rotate(45deg);
}

.ctp-front-ctpus__composer button::after {
    left: 50%;
    top: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #111;
    transform: translate(-58%, -50%);
}

.ctp-front-ctpus__composer button:disabled {
    opacity: 0.6;
    cursor: progress;
}

@media (max-width: 640px) {
    .ctp-front-ctpus {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .ctp-front-ctpus__teaser {
        display: none;
    }

    .ctp-front-ctpus__button {
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
        height: 46px !important;
        min-height: 46px !important;
        max-height: 46px !important;
        padding: 6px !important;
        box-shadow: 0 0 0 6px rgba(255, 196, 0, 0.07), 0 14px 32px rgba(0, 0, 0, 0.42);
    }

    .ctp-front-ctpus__button .ctp-front-ctpus__robot {
        width: 22px;
        height: 22px;
    }

    .ctp-front-ctpus__panel {
        position: fixed;
        left: 10px;
        right: 10px;
        top: calc(64px + env(safe-area-inset-top, 0px));
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        width: auto;
        height: auto;
        min-height: 0;
    }

    body.admin-bar .ctp-front-ctpus__panel {
        top: calc(72px + env(safe-area-inset-top, 0px));
    }

    .ctp-front-ctpus__header {
        padding: 12px;
    }

    .ctp-front-ctpus__avatar {
        width: 42px;
        height: 42px;
        padding: 5px;
    }

    .ctp-front-ctpus__header strong {
        font-size: 16px;
    }

    .ctp-front-ctpus__header span {
        font-size: 11px;
    }

    .ctp-front-ctpus__close {
        width: 34px;
        height: 34px;
    }

    .ctp-front-ctpus__messages {
        padding: 12px;
    }

    .ctp-front-ctpus__bubble {
        max-width: 90%;
        font-size: 13px;
    }

    .ctp-front-ctpus__suggestions {
        gap: 6px;
        padding: 8px 12px 10px;
    }

    .ctp-front-ctpus__suggestion {
        flex: 0 1 auto;
        min-height: 30px;
        padding: 6px 8px;
        font-size: 11px;
        line-height: 1.1;
    }

    .ctp-front-ctpus__composer {
        grid-template-columns: minmax(0, 1fr) 40px;
        gap: 7px;
        padding: 10px;
    }

    .ctp-front-ctpus__composer textarea {
        min-height: 42px;
        padding: 10px 11px;
        font-size: 13px;
    }

    .ctp-front-ctpus__composer button {
        inline-size: 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        max-inline-size: 40px !important;
        height: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        padding: 0 !important;
        flex-basis: 40px;
    }
}
