#hypex-chatbot-widget {
    --hcb-color: #D92332;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /*
     * Hidden until .hcb-ready is added by chat-widget.js, which waits for
     * the host theme's own page-load preloader (if any) to clear first —
     * otherwise our high z-index floats the bubble on top of the theme's
     * full-screen loading overlay for the second or two it's visible.
     * The animation is a pure-CSS backstop: if JS never runs for any
     * reason, the bubble still reveals itself after 4.5s rather than
     * staying invisible forever (a real bug we've chased before on this
     * widget — never make visibility depend solely on JS executing).
     */
    opacity: 0;
    visibility: hidden;
    animation: hypex-chatbot-reveal-fallback 0s 4.5s forwards;
}

#hypex-chatbot-widget.hcb-ready {
    opacity: 1;
    visibility: visible;
    animation: none;
}

@keyframes hypex-chatbot-reveal-fallback {
    to {
        opacity: 1;
        visibility: visible;
    }
}

.hypex-chatbot-bubble,
.hypex-chatbot-bubble:hover,
.hypex-chatbot-bubble:focus,
.hypex-chatbot-bubble:active,
.hypex-chatbot-bubble:visited {
    /*
     * Defensive reset: this is a real <button> element sitting on an
     * arbitrary host theme, and many WP themes apply global hover/focus
     * box-shadow, outline, or border color to every button on the page.
     * Force all of that off explicitly rather than relying on our own
     * rules simply not setting it — "not setting" a property doesn't
     * override a more specific theme selector, this does.
     */
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50% !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.hypex-chatbot-bubble-icon {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    object-fit: contain;
    border-radius: 50% !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.hypex-chatbot-bubble:hover .hypex-chatbot-bubble-icon {
    animation: hypex-chatbot-wiggle 0.6s ease-in-out;
}

@keyframes hypex-chatbot-wiggle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25%      { transform: scale(1.1) rotate(-8deg); }
    50%      { transform: scale(1.1) rotate(8deg); }
    75%      { transform: scale(1.05) rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .hypex-chatbot-bubble:hover .hypex-chatbot-bubble-icon {
        animation: none;
    }
}

.hypex-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hypex-chatbot-panel[hidden] {
    display: none;
}

.hypex-chatbot-header {
    background: var(--hcb-color);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    flex-shrink: 0;
}

.hypex-chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hypex-chatbot-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.hypex-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.hypex-chatbot-clear {
    background: none;
    border: none;
    color: #fff;
    opacity: 0.85;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.hypex-chatbot-clear:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.hypex-chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.hypex-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: transparent;
}

.hypex-chatbot-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.hypex-chatbot-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #1d1d1d;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.hypex-chatbot-message.user {
    align-self: flex-end;
    background: var(--hcb-color);
    color: #fff;
}

.hypex-chatbot-message.error {
    align-self: flex-start;
    background: rgba(253, 232, 232, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #9b1c1c;
    border: 1px solid rgba(245, 181, 181, 0.6);
}

.hypex-chatbot-form {
    display: flex;
    border-top: 1px solid #e5e5e5;
    padding: 8px;
    gap: 8px;
    flex-shrink: 0;
}

.hypex-chatbot-form input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.hypex-chatbot-form input:focus {
    border-color: var(--hcb-color);
}

.hypex-chatbot-send {
    border: none;
    background: var(--hcb-color);
    color: #fff;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.hypex-chatbot-send:disabled {
    opacity: 0.6;
    cursor: default;
}

.hypex-chatbot-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    color: #999;
    padding: 6px 0 8px;
    background: #fff;
    flex-shrink: 0;
}

.hypex-chatbot-footer a {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.hypex-chatbot-footer-logo {
    height: 14px;
    width: auto;
}

@media (max-width: 480px) {
    #hypex-chatbot-widget {
        right: 12px;
        bottom: 12px;
    }

    .hypex-chatbot-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        bottom: 68px;
    }
}
