/* Glassmorphism Chat Widget */
:root {
    --chat-primary: #1595b6;
    --chat-bg: rgba(20, 20, 20, 0.6);
    --chat-blur: 15px;
    --chat-border: rgba(255, 255, 255, 0.1);
    --chat-text: #ffffff;
    --chat-user-bg: rgba(21, 149, 182, 0.3);
    --chat-ai-bg: rgba(255, 255, 255, 0.05);
}

/* Floating Toggle Button - Glowing Neon Effect with Animated Character */
.chat-toggle {
    --glow-color: #1595b6;
    --glow-spread-color: rgba(21, 149, 182, 0.4);
    --enhanced-glow-color: #61dafb;
    --btn-color: #0a3d4d;
    --support-size: 60px;
    --tooltip-radius: 10px 10px 10px 0;

    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 1.2em 2.5em;
    background-color: var(--btn-color);
    border-radius: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;

    /* Glowing border and shadows - reduced intensity */
    border: 2px solid var(--glow-color);
    box-shadow: 0 0 0.5em 0.1em var(--glow-color),
        0 0 1.5em 0.3em var(--glow-spread-color),
        inset 0 0 0.3em 0.1em var(--glow-color);
    transition: all 0.3s ease;
}

/* Button text styling */
.chat-toggle .chat-text {
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 0.3em var(--glow-color);
    transition: all 0.3s ease;
}

.chat-toggle:hover .chat-text {
    color: var(--btn-color);
    text-shadow: none;
}

/* Floor reflection glow - reduced */
.chat-toggle::after {
    pointer-events: none;
    content: "";
    position: absolute;
    top: 120%;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: var(--glow-spread-color);
    filter: blur(1em);
    opacity: 0.4;
    transform: perspective(1.5em) rotateX(35deg) scale(1, 0.6);
}

.chat-toggle:hover {
    background-color: var(--glow-color);
    box-shadow: 0 0 0.8em 0.2em var(--glow-color),
        0 0 2em 0.5em var(--glow-spread-color),
        inset 0 0 0.5em 0.15em var(--glow-color);
}

.chat-toggle:active {
    box-shadow: 0 0 0.4em 0.1em var(--glow-color),
        0 0 1em 0.3em var(--glow-spread-color),
        inset 0 0 0.3em 0.1em var(--glow-color);
}

/* Tooltip that says "Hi!" */
.chat-toggle .chat-tooltip {
    position: absolute;
    display: inline-block;
    top: 0;
    left: 50%;
    transform: translateX(-5%);
    padding: 0.4em 0.8em;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    background: var(--btn-color);
    border-radius: var(--tooltip-radius);
    color: var(--glow-color);
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 0 10px var(--glow-spread-color), 3px 3px 0px var(--glow-color);
    border: 2px solid var(--glow-color);
}

.chat-toggle .chat-tooltip::before {
    position: absolute;
    content: "";
    bottom: -8px;
    border-style: solid;
    border-width: 8px;
    left: 0;
    transform: translateX(-50%);
    border-color: transparent var(--glow-color) var(--glow-color) transparent;
}

.chat-toggle:hover .chat-tooltip {
    top: calc(-100% - 15px);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: chat-shake 0.5s 0.3s linear;
    transition: all 0.3s 0.2s;
}

/* Animated support character SVG */
.chat-toggle .support-character {
    display: inline-block;
    height: var(--support-size);
    position: absolute;
    opacity: 0;
    transition: all 0.5s;
    z-index: -1;
    left: 0;
    top: 0;
    pointer-events: none;
}

.chat-toggle:hover .support-character {
    top: calc(var(--support-size) * -1);
    opacity: 1;
}

/* SVG character colors */
.chat-toggle .st1 {
    fill: #2d1b4e;
}

.chat-toggle .st2 {
    fill: #f9c8a7;
}

.chat-toggle .st3 {
    fill: #ff9e97;
}

.chat-toggle .st5 {
    fill: #2d1b4e;
}

.chat-toggle .st6 {
    fill: #d72e48;
}

.chat-toggle .st7 {
    fill: #ffffff;
}

.chat-toggle .st8 {
    fill: #ff8d7f;
}

.chat-toggle .st10 {
    fill: #3d3d3b;
}

.chat-toggle .st11 {
    fill: var(--glow-color);
}

.chat-toggle .st15 {
    fill: #ead9cf;
}

#left_x5F_arm_2_ {
    transform: translateX(2px);
}

/* Shake animation for tooltip */
@keyframes chat-shake {

    0%,
    40%,
    80% {
        transform: translateX(-10%);
    }

    20%,
    60%,
    100% {
        transform: translateX(0);
    }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: var(--chat-bg);
    backdrop-filter: blur(var(--chat-blur));
    -webkit-backdrop-filter: blur(var(--chat-blur));
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Header */
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px 20px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--chat-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header h3 i {
    color: var(--chat-primary);
}

.close-chat {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.close-chat:hover {
    color: white;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: var(--chat-user-bg);
    color: white;
    border-bottom-right-radius: 5px;
    border: 1px solid rgba(21, 149, 182, 0.2);
}

.message.ai {
    align-self: flex-start;
    background: var(--chat-ai-bg);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 5px;
    border: 1px solid var(--chat-border);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background: var(--chat-ai-bg);
    padding: 10px 15px;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
    gap: 5px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 20px 20px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    outline: none;
    transition: all 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--chat-primary);
    background: rgba(255, 255, 255, 0.1);
}

.chat-input-area button {
    background: var(--chat-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-input-area button:hover {
    transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-window {
        width: 90%;
        right: 5%;
        bottom: 100px;
        height: 60vh;
    }
}