/* Stunnix Chatbot Styles */
:root {
    --stunnix-primary: #00f3ff;
    --stunnix-glass: rgba(20, 20, 20, 0.85);
    --stunnix-border: rgba(255, 255, 255, 0.2);
    --stunnix-text: #fff;
    --stunnix-user-bg: rgba(255, 255, 255, 0.1);
}

/* Chat Widget Container */
#stunnix-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: 'Poppins', sans-serif;
}

/* Avatar Wrapper to hold Icon + Ring */
#stunnix-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* GIS Pulse Effect */
#stunnix-avatar-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: 1px dashed var(--stunnix-primary);
    opacity: 0.5;
    animation: pulse-ring 4s infinite linear;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        width: 75px;
        height: 75px;
        opacity: 0.5;
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        width: 95px;
        height: 95px;
        opacity: 0;
        transform: translate(-50%, -50%) rotate(180deg);
    }
}

/* Rotating Text Ring */
.stunnix-ring-text {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: spin-text 10s linear infinite;
    pointer-events: none;
    /* Let clicks pass through to avatar */
    z-index: 10002;
}

@keyframes spin-text {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Floating Avatar Button */
#stunnix-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--stunnix-primary);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    background: #000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 10001;
}

#stunnix-avatar-wrapper:hover #stunnix-avatar {
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.8);
}

#stunnix-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* X-Axis Rotation on Hover */
#stunnix-avatar-wrapper:hover img {
    transform: rotateX(360deg);
}

/* Chat Window */
#stunnix-window {
    position: fixed;
    bottom: 120px;
    /* Raised slightly to clear the larger ring */
    left: 30px;
    width: 350px;
    height: 500px;
    background: var(--stunnix-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--stunnix-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0);
    transform-origin: bottom left;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    pointer-events: none;
}

#stunnix-window.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.stunnix-header {
    padding: 15px;
    background: rgba(0, 243, 255, 0.1);
    border-bottom: 1px solid var(--stunnix-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--stunnix-primary);
}

.stunnix-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stunnix-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}

.stunnix-close:hover {
    color: var(--stunnix-primary);
}

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

.stunnix-messages::-webkit-scrollbar {
    width: 5px;
}

.stunnix-messages::-webkit-scrollbar-thumb {
    background: var(--stunnix-primary);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background: rgba(0, 243, 255, 0.15);
    color: #fff;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0, 243, 255, 0.1);
}

.message.user {
    align-self: flex-end;
    background: #fff;
    color: #000;
    border-bottom-right-radius: 2px;
}

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

.stunnix-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--stunnix-border);
    border-radius: 20px;
    padding: 10px 15px;
    color: #fff;
    outline: none;
    font-family: inherit;
    transition: 0.2s;
}

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

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

.stunnix-input-area button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px var(--stunnix-primary);
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 15px;
    align-self: flex-start;
    width: fit-content;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--stunnix-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

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

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #stunnix-widget {
        display: none !important;
    }
}