/*===== Interactive Spooky Glassmorphism Bubble =====*/
#faq-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 140px;
    /* Increased container size */
    height: 140px;
    border-radius: 50%;
    /* Strips container background and borders */
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    padding: 0;
    overflow: visible;
    /* Combined Floating Animation */
    animation: float 3s ease-in-out infinite;
    transition: transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

#faq-chat-bubble:hover {
    background: transparent !important;
    transform: scale(1.08) rotate(4deg);
}

#faq-chat-bubble:active {
    transform: scale(0.95);
}

/* Pepe Spooky Floating Icon - Supports IMG and WebM Video Containers */
.bubble-icon-img,
#faq-chat-bubble img,
#faq-chat-bubble video {
    width: 120px;
    /* Increased avatar size */
    height: 120px;
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    mix-blend-mode: normal;
    pointer-events: none;
    /* Dynamic Pulsing Shadow Glow around Pepe's PNG/WEBP/WEBM silhouette */
    animation: icon-glow-spooky 2.5s ease-in-out infinite;
    transition: transform 0.2s ease, filter 0.2s ease;
}

#faq-chat-bubble:hover .bubble-icon-img,
#faq-chat-bubble:hover img,
#faq-chat-bubble:hover video {
    transform: scale(1.08);
    /* Intensified glow state on hover */
    filter: drop-shadow(0px 0px 22px rgba(217, 119, 6, 0.95)) drop-shadow(0px 0px 36px rgba(245, 158, 11, 0.75));
}

/* Dynamic Pulsing Icon Glow Animation (Spooky Pumpkin Glow) */
@keyframes icon-glow-spooky {
    0% {
        filter: drop-shadow(0px 0px 8px rgba(217, 119, 6, 0.45)) drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.3));
    }

    50% {
        filter: drop-shadow(0px 0px 20px rgba(217, 119, 6, 0.85)) drop-shadow(0px 0px 28px rgba(245, 158, 11, 0.65));
    }

    100% {
        filter: drop-shadow(0px 0px 8px rgba(217, 119, 6, 0.45)) drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.3));
    }
}

/* Standard Mode Icon Glow Fallback (Blue Theme) */
.standard-theme .bubble-icon-img,
#faq-chat-bubble.standard-theme img,
#faq-chat-bubble.standard-theme video {
    animation: icon-glow-standard 2.5s ease-in-out infinite;
}

@keyframes icon-glow-standard {
    0% {
        filter: drop-shadow(0px 0px 8px rgba(37, 99, 235, 0.45)) drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.25));
    }

    50% {
        filter: drop-shadow(0px 0px 20px rgba(37, 99, 235, 0.85)) drop-shadow(0px 0px 28px rgba(96, 165, 250, 0.65));
    }

    100% {
        filter: drop-shadow(0px 0px 8px rgba(37, 99, 235, 0.45)) drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.25));
    }
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0px);
    }
}

/*===== Spooky Theme Specific Styling =====*/
#faq-chat-header.spooky-theme,
.spooky-theme #faq-chat-header {
    background: #d97706 !important;
    /* Pumpkin Amber Header */
}

/* User Message & Send Button Spooky Accent */
.spooky-theme .faq-msg.user,
#faq-chat-window.spooky-theme #faq-chat-send {
    background: #d97706 !important;
}

#faq-chat-window.spooky-theme #faq-chat-send:hover {
    background: #b45309 !important;
}

#faq-chat-header.standard-theme {
    background: var(--dark-blue, #0f2b5c) !important;
}

#faq-chat-header.festive-theme {
    background: #dc2626 !important;
}

/* Window Container */
#faq-chat-window {
    position: fixed;
    bottom: 160px;
    /* Offset adjusted for larger bubble height */
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 180px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    transition: all 0.25s ease-in-out;
}

#faq-chat-window.open {
    display: flex;
}

/* Header & Avatar Styling */
#faq-chat-header {
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.faq-chat-bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Header Avatar Container Glow & Support for IMG/WEBM */
.faq-chat-avatar-container {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-chat-avatar,
.faq-chat-avatar-container img,
.faq-chat-avatar-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    mix-blend-mode: normal;
    filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.faq-chat-avatar-container:hover img,
.faq-chat-avatar-container:hover video {
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0px 0px 8px rgba(255, 255, 255, 0.8));
}

#faq-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#faq-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

#faq-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
#faq-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #fdf8f3;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* General Message Bubble Base */
.faq-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

/* User Bubble Default */
.faq-msg.user {
    background: var(--dark-blue, #0f2b5c);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

/* Bot Bubble & Formatting */
.faq-msg.bot {
    background: #fff;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.faq-msg.typing {
    background: #fff;
    color: #9ca3af;
    align-self: flex-start;
    font-style: italic;
}

.faq-msg.bot p {
    margin: 0 0 8px 0;
}

.faq-msg.bot p:last-child {
    margin-bottom: 0;
}

.faq-msg.bot ul,
.faq-msg.bot ol {
    margin: 6px 0 8px 18px;
    padding: 0;
}

.faq-msg.bot ul {
    list-style-type: disc;
}

.faq-msg.bot ol {
    list-style-type: decimal;
}

.faq-msg.bot li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.faq-msg.bot li:last-child {
    margin-bottom: 0;
}

.faq-msg.bot strong,
.faq-msg.bot b {
    font-weight: 600;
    color: #111827;
}

.faq-msg.bot a {
    color: #d97706;
    text-decoration: underline;
    font-weight: 500;
    word-break: break-all;
    transition: color 0.15s ease;
}

.faq-msg.bot a:hover {
    color: #b45309;
}

/*===== COLLAPSIBLE SUGGESTIONS SECTION =====*/
#faq-chat-suggestions {
    position: relative;
    padding: 8px 10px;
    background: #fef3c7;
    border-top: 1px solid #fde68a;
    transition: max-height 0.25s ease-in-out;
    flex-shrink: 0;
    max-height: 48px;
    overflow: hidden;
}

#faq-chat-suggestions.expanded {
    max-height: 180px;
    overflow-y: auto;
}

#faq-chat-suggestions.expanded::-webkit-scrollbar {
    width: 4px;
}

#faq-chat-suggestions.expanded::-webkit-scrollbar-thumb {
    background: #fcd34d;
    border-radius: 4px;
}

.faq-suggestions-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 30px;
}

.faq-chip-btn {
    display: block;
    width: 100%;
    background: #fff;
    color: #b45309;
    border: 1px solid #fde68a;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.35;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

#faq-chat-suggestions.expanded .faq-chip-btn {
    white-space: normal;
    word-break: break-word;
}

.faq-chip-btn:hover {
    background: #fef3c7;
    border-color: #fcd34d;
}

.faq-chip-btn:active {
    transform: scale(0.99);
}

#faq-suggestions-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: 50%;
    color: #b45309;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.15s ease;
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#faq-suggestions-toggle:hover {
    background: #fef3c7;
}

#faq-chat-suggestions.expanded #faq-suggestions-toggle {
    transform: rotate(180deg);
}

/*===== DYNAMICALLY AUTO-EXPANDING INPUT FORM =====*/
#faq-chat-form {
    display: flex;
    align-items: flex-end;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fff;
    min-height: 48px;
    max-height: 120px;
    margin: 0;
    padding: 0;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    overflow: hidden;
}

#faq-chat-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 13px 14px;
    font-size: 14px;
    line-height: 1.4;
    height: 48px;
    max-height: 120px;
    background: transparent;
    color: #1f2937;
    margin: 0;
    box-sizing: border-box;
    box-shadow: none !important;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
}

#faq-chat-send {
    background: var(--dark-blue, #0f2b5c);
    color: #fff;
    border: none !important;
    outline: none !important;
    padding: 0 20px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    height: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
    flex-shrink: 0;
    align-self: stretch;
}

#faq-chat-send:hover {
    background: #1d4ed8;
}

#faq-chat-send:disabled,
#faq-chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/*===== RESPONSIVE MEDIA QUERIES =====*/
@media screen and (max-width: 600px) {
    #faq-chat-window {
        right: 16px;
        bottom: 110px;
        width: calc(100vw - 32px);
        height: calc(100vh - 140px);
    }

    #faq-chat-bubble {
        bottom: 16px;
        right: 12px;
        width: 100px;
        height: 100px;
    }

    .bubble-icon-img,
    #faq-chat-bubble img,
    #faq-chat-bubble video {
        width: 84px;
        height: 84px;
    }
}

@media screen and (max-width: 480px) {
    #faq-chat-window {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100dvw;
        height: 100dvh;
        max-width: 100dvw;
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }

    #faq-chat-bubble {
        bottom: 14px;
        right: 10px;
        width: 88px;
        height: 88px;
    }

    .bubble-icon-img,
    #faq-chat-bubble img,
    #faq-chat-bubble video {
        width: 76px;
        height: 76px;
    }

    #faq-chat-form {
        border-radius: 0;
        min-height: 50px;
    }

    #faq-chat-header {
        padding: 14px 16px;
    }

    .faq-chat-avatar-container {
        width: 44px;
        height: 44px;
    }

    #faq-chat-header h3 {
        font-size: 17px;
    }

    .faq-msg {
        max-width: 90%;
        font-size: 14px;
    }

    #faq-chat-input {
        font-size: 16px;
        /* Prevents auto-zoom on iOS inputs */
    }

    #faq-chat-window.open~#faq-chat-bubble {
        display: none;
    }
}