/* AI Chatbot - Aurora Glass Design */
#aiwp-chatbot-container {
    position: fixed;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: rgba(15, 23, 42, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(56, 189, 248, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

#aiwp-chatbot-container.aiwp-chatbot-closed {
    display: none;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
}

#aiwp-chatbot-launcher {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--color-primary, #0066CC);
    color: #fff;
    border: none;
    font-size: 0;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(0, 102, 204, 0.28);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#aiwp-chatbot-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(0, 102, 204, 0.32);
}

.aiwp-chatbot-header {
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    color: #f8fafc;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

.aiwp-chatbot-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aiwp-chatbot-header span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aiwp-chatbot-header span::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    background: var(--color-primary, #0066CC);
    display: inline-block;
}

.aiwp-chatbot-header button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 20px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aiwp-chatbot-header button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
}

/* In-chat status banner (shown only when needed) */
.aiwp-chatbot-status {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: rgba(56, 189, 248, 0.12);
    border-bottom: 1px solid rgba(56, 189, 248, 0.18);
    color: #e2e8f0;
}

#aiwp-chatbot-container.aiwp-chatbot-closed .aiwp-chatbot-status {
    display: none;
}

/* In-chat theme panel (no extra floating triggers) */
.aiwp-chatbot-theme-panel {
    position: absolute;
    top: 56px;
    left: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 14px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55);
    padding: 12px;
    z-index: 2;
}

.aiwp-chatbot-theme-panel[hidden] {
    display: none;
}

.aiwp-chatbot-theme-panel__section {
    margin-bottom: 12px;
}

.aiwp-chatbot-theme-panel__section:last-child {
    margin-bottom: 0;
}

.aiwp-chatbot-theme-panel__heading {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.aiwp-chatbot-theme-panel__segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.aiwp-chatbot-theme-panel__option {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #cbd5e1;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.aiwp-chatbot-theme-panel__option[aria-checked="true"] {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.35);
    color: #f8fafc;
}

.aiwp-chatbot-theme-panel__presets {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
}

.aiwp-chatbot-theme-panel__preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    background-color: transparent;
    background-clip: padding-box;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.aiwp-chatbot-theme-panel__preset.is-active {
    border-color: rgba(56, 189, 248, 0.9);
}

.aiwp-chatbot-theme-panel__preset:hover {
    transform: translateY(-1px);
}

.aiwp-chatbot-theme-panel__picker {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.aiwp-chatbot-theme-panel__color {
    width: 44px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    padding: 0;
}

.aiwp-chatbot-theme-panel__value {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    padding: 0 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    text-transform: uppercase;
}

.aiwp-chatbot-theme-panel__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.aiwp-chatbot-theme-panel__reset {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
}

.aiwp-chatbot-theme-panel__reset:hover {
    background: rgba(255, 69, 58, 0.12);
    border-color: rgba(255, 69, 58, 0.45);
}

.aiwp-chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aiwp-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.aiwp-chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.aiwp-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

/* Quick reply suggestions */
.aiwp-chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(56, 189, 248, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.aiwp-chatbot-quick-replies[hidden] {
    display: none;
}

.aiwp-chatbot-quick-reply {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #94a3b8;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.aiwp-chatbot-quick-reply:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
    color: #e2e8f0;
    transform: translateY(-1px);
}

.aiwp-chatbot-quick-reply:active {
    transform: translateY(0);
}

.aiwp-message {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aiwp-message.bot {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.aiwp-message.user {
    background: var(--color-primary, #0066CC);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.aiwp-message.typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.aiwp-message.typing span {
    width: 8px;
    height: 8px;
    background: #38bdf8;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.aiwp-message.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.aiwp-message.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.aiwp-chatbot-input {
    padding: 16px;
    border-top: 1px solid rgba(56, 189, 248, 0.15);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.aiwp-chatbot-input input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 12px;
    color: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.aiwp-chatbot-input input::placeholder {
    color: #64748b;
}

.aiwp-chatbot-input input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.aiwp-chatbot-input button {
    padding: 12px;
    background: var(--color-primary, #0066CC);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aiwp-chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(56, 189, 248, 0.3);
}

.aiwp-chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #aiwp-chatbot-container {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        height: calc(100vh - 100px);
        max-height: 500px;
        border-radius: 12px;
    }

    #aiwp-chatbot-launcher {
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        right: calc(14px + env(safe-area-inset-right, 0px));
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
}

/* Desktop: when the theme provides a header chat toggle, avoid a redundant floating launcher */
@media (min-width: 960px) {
    html.aiwp-chatbot-has-header-toggle #aiwp-chatbot-launcher {
        display: none !important;
    }

    html.aiwp-chatbot-has-header-toggle #aiwp-chatbot-container {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}
