/* ================================================================
   XS INFOSOL CHATBOT — PREMIUM GLASSMORPHISM THEME
   ================================================================ */

:root {
    --chat-primary: #ff9069;
    --chat-primary-hover: #ff7c4d;
    --chat-primary-dim: #fe5e1e;
    --chat-bg: rgba(14, 14, 14, 0.88);
    --chat-surface: rgba(25, 25, 25, 0.95);
    --chat-border: rgba(255, 255, 255, 0.08);
    --chat-text: #ffffff;
    --chat-text-muted: #ababab;
    --chat-font-headline: 'Manrope', sans-serif;
    --chat-font-body: 'Inter', sans-serif;
}

/* Chat wrapper classes */
.xs-chat-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: var(--chat-font-body);
}

/* Floating Action Button */
.xs-chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dim));
    box-shadow: 0 8px 32px rgba(255, 144, 105, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.xs-chat-fab:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 40px rgba(255, 144, 105, 0.5);
}

.xs-chat-fab:active {
    transform: scale(0.95);
}

.xs-chat-fab .xs-chat-icon-open,
.xs-chat-fab .xs-chat-icon-close {
    color: #000000;
    font-size: 28px;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: absolute;
}

.xs-chat-fab .xs-chat-icon-close {
    opacity: 0;
    transform: rotate(-90deg);
}

.xs-chat-fab.active .xs-chat-icon-open {
    opacity: 0;
    transform: rotate(90deg);
}

.xs-chat-fab.active .xs-chat-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Green Dot on FAB indicating assistant online */
.xs-chat-fab::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background-color: #4ade80;
    border: 2.5px solid #000000;
    border-radius: 50%;
    animation: xs-chat-pulse 2s infinite;
}

.xs-chat-fab.active::after {
    display: none;
}

/* Proactive Welcome Callout Bubble */
.xs-chat-welcome-toast {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 280px;
    background: var(--chat-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--chat-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--chat-text);
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 9998;
}

.xs-chat-welcome-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.xs-chat-welcome-toast::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 24px;
    width: 16px;
    height: 16px;
    background: var(--chat-surface);
    border-right: 1px solid var(--chat-border);
    border-bottom: 1px solid var(--chat-border);
    transform: rotate(45deg);
}

.xs-chat-toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--chat-text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.xs-chat-toast-close:hover {
    color: var(--chat-primary);
}

.xs-chat-welcome-toast p {
    margin: 0;
    padding-right: 12px;
}

/* Chat Window */
.xs-chat-window {
    position: absolute;
    bottom: -12px;
    right: 73px;
    width: 380px;
    height: 580px;
    background: var(--chat-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.85) translateY(20px);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 9997;
}

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

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

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

.xs-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.xs-chat-avatar img {
    width: 75%;
    height: auto;
    object-fit: contain;
}

.xs-chat-details h4 {
    margin: 0;
    font-family: var(--chat-font-headline);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--chat-text);
    letter-spacing: -0.01em;
}

.xs-chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--chat-text-muted);
    margin-top: 2px;
}

.xs-chat-status-dot {
    width: 6px;
    height: 6px;
    background-color: #4ade80;
    border-radius: 50%;
    animation: xs-chat-pulse 2s infinite;
}

.xs-chat-close-btn {
    color: var(--chat-text-muted);
    cursor: pointer;
    font-size: 20px;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xs-chat-close-btn:hover {
    color: var(--chat-primary);
    transform: rotate(90deg);
}

/* Chat Messages */
.xs-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

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

.xs-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.xs-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.xs-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: xs-chat-fade-in-up 0.3s ease forwards;
}

.xs-chat-msg.bot {
    align-self: flex-start;
}

.xs-chat-msg.user {
    align-self: flex-end;
}

.xs-chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.xs-chat-msg.bot .xs-chat-msg-bubble {
    background: rgba(255, 255, 255, 0.04);
    color: var(--chat-text);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-top-left-radius: 4px;
}

.xs-chat-msg.user .xs-chat-msg-bubble {
    background: linear-gradient(135deg, rgba(255, 144, 105, 0.15), rgba(254, 94, 30, 0.15));
    border: 1px solid rgba(255, 144, 105, 0.3);
    color: var(--chat-text);
    border-top-right-radius: 4px;
}

/* Chat Timestamp */
.xs-chat-msg-time {
    font-size: 0.68rem;
    color: var(--chat-text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.xs-chat-msg.bot .xs-chat-msg-time {
    align-self: flex-start;
}

.xs-chat-msg.user .xs-chat-msg-time {
    align-self: flex-end;
}

/* Suggestions / Chips */
.xs-chat-suggestions-container {
    padding: 8px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.xs-chat-chip {
    padding: 6px 12px;
    background: rgba(255, 144, 105, 0.05);
    border: 1px solid rgba(255, 144, 105, 0.25);
    border-radius: 20px;
    color: var(--chat-primary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.xs-chat-chip:hover {
    background: var(--chat-primary);
    color: #000000;
    border-color: var(--chat-primary);
    transform: translateY(-1px);
}

/* Chat Input Area */
.xs-chat-input-wrapper {
    padding: 16px 20px;
    border-top: 1px solid var(--chat-border);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.xs-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 16px;
    color: #ffffff;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.xs-chat-input::placeholder {
    color: var(--chat-text-muted);
}

.xs-chat-input:focus {
    border-color: rgba(255, 144, 105, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(255, 144, 105, 0.05);
}

.xs-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 144, 105, 0.1);
    border: 1px solid rgba(255, 144, 105, 0.2);
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.xs-chat-send-btn:hover {
    background: var(--chat-primary);
    color: #000000;
    border-color: var(--chat-primary);
    transform: scale(1.05);
}

.xs-chat-send-btn:active {
    transform: scale(0.95);
}

.xs-chat-send-btn .material-symbols-outlined {
    font-size: 20px;
    font-variation-settings: 'FILL' 1, 'wght' 500;
}

/* Typing Indicator */
.xs-chat-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 8px;
}

.xs-chat-typing span {
    width: 6px;
    height: 6px;
    background-color: var(--chat-text-muted);
    border-radius: 50%;
    animation: xs-chat-bounce 1.4s infinite ease-in-out both;
}

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

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

/* Animations */
@keyframes xs-chat-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

@keyframes xs-chat-bounce {

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

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

@keyframes xs-chat-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Styles */
@media (max-width: 767px) {
    .xs-chat-wrapper {
        bottom: 20px;
        right: 20px;
    }

    .xs-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        transform-origin: bottom center;
    }

    .xs-chat-window.active {
        transform: scale(1) translateY(0);
    }

    .xs-chat-welcome-toast {
        width: calc(100vw - 40px);
        max-width: 320px;
        bottom: 70px;
        right: 0;
    }
}

/* Inline Support Ticket Form */
.xs-chat-form-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.xs-chat-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xs-chat-form-group label {
    font-size: 0.72rem;
    color: var(--chat-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xs-chat-form-group input,
.xs-chat-form-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.xs-chat-form-group textarea {
    resize: none;
    height: 70px;
}

.xs-chat-form-group input:focus,
.xs-chat-form-group textarea:focus {
    border-color: rgba(255, 144, 105, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.xs-chat-form-submit {
    background: var(--chat-primary);
    color: #000000;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    border: none;
    transition: all 0.2s ease;
    margin-top: 4px;
    font-family: var(--chat-font-headline);
}

.xs-chat-form-submit:hover {
    background: var(--chat-primary-hover);
    transform: translateY(-1px);
}

.xs-chat-form-submit:active {
    transform: translateY(0);
}

.xs-chat-form-success {
    text-align: center;
    padding: 12px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 8px;
    font-weight: 500;
    animation: xs-chat-fade-in-up 0.3s ease;
}