/* XiVA - Stylesheet */

:root {
    --xiva-primary: #212121;
    --xiva-bg-light: #ffffff;
    --xiva-bot-bubble: #212121;
    --xiva-user-bubble: #ffffff;
    --xiva-text-dark: #212121;
    --xiva-text-white: #ffffff;
    --xiva-text-gray: #71717a;
    --xiva-border-color: rgba(0, 0, 0, 0.1);
}

#xiva-widget-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999999;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Floating Toggle Button */
.xiva-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--xiva-primary);
    color: var(--xiva-text-white);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.xiva-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

.xiva-toggle:active {
    transform: scale(0.95);
}

/* Chat Window - MxChat Appearance */
.xiva-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 375px;
    height: min(600px, calc(100vh - 100px));
    background: var(--xiva-bg-light);
    border: 1px solid var(--xiva-border-color);
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: xivaFadeInUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    transform-origin: bottom right;
}

@keyframes xivaFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header - Dark theme like MxChat top bar */
.xiva-header {
    background: var(--xiva-primary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--xiva-text-white);
}

.xiva-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xiva-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: var(--xiva-text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.xiva-title {
    margin: 0;
    color: var(--xiva-text-white);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.xiva-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.xiva-close,
.xiva-reset {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xiva-close {
    font-size: 20px;
}

.xiva-reset {
    font-size: 14px;
    margin-right: 2px;
}

.xiva-close:hover,
.xiva-reset:hover {
    color: var(--xiva-text-white);
}

.xiva-reset:hover {
    transform: rotate(-90deg);
}

/* Chat Messages Content */
.xiva-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
}

.xiva-msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: bubbleSlideIn 0.25s ease forwards;
}

@keyframes bubbleSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xiva-bot {
    align-self: flex-start;
    background: var(--xiva-bot-bubble);
    color: var(--xiva-text-white);
    border-radius: 0 18px 18px 18px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.xiva-user {
    align-self: flex-end;
    background: var(--xiva-user-bubble);
    color: var(--xiva-text-dark);
    border-radius: 18px 0 18px 18px;
    border: 1px solid var(--xiva-border-color);
}

/* Choice Buttons - Stylized like popular questions */
.xiva-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.xiva-choice-btn {
    width: 100%;
    padding: 10px 16px;
    background: #f5f5f5;
    border: 1px solid #bbb;
    border-radius: 8px;
    color: var(--xiva-text-dark);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.xiva-choice-btn:hover {
    background-color: #eaeaea;
    border-color: #999;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* User Input Area */
.xiva-input-area {
    padding: 12px 15px;
    border-top: 1px solid var(--xiva-border-color);
    display: flex;
    gap: 8px;
    background: #ffffff;
    align-items: center;
}

.xiva-input-area input {
    flex: 1;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--xiva-text-dark);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.xiva-input-area input:focus:not(:disabled) {
    border-color: var(--xiva-primary);
}

.xiva-send {
    background: var(--xiva-primary);
    border: none;
    color: var(--xiva-text-white);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.xiva-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.xiva-send:hover:not(:disabled) {
    opacity: 0.9;
}

.xiva-send:active:not(:disabled) {
    transform: scale(0.95);
}

/* Scrollbar Style */
.xiva-messages::-webkit-scrollbar {
    width: 5px;
}
.xiva-messages::-webkit-scrollbar-track {
    background: transparent;
}
.xiva-messages::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 10px;
}

/* Teaser Greeting Popup Bubble */
#xiva-teaser {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 220px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--xiva-border-color);
    border-radius: 12px;
    color: var(--xiva-text-dark);
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: teaserSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    z-index: 99999;
}

@keyframes teaserSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.teaser-text {
    flex: 1;
    font-weight: 500;
}

.teaser-close {
    background: transparent;
    border: none;
    color: var(--xiva-text-gray);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.teaser-close:hover {
    color: var(--xiva-text-dark);
}

/* GDPR Consent Layout */
.xiva-gdpr-container {
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: bubbleSlideIn 0.25s ease forwards;
}

.xiva-gdpr-container input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
    width: 13px;
    height: 13px;
}

.xiva-gdpr-label {
    font-size: 12px;
    color: var(--xiva-text-gray);
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
.xiva-gdpr-label:hover {
    color: var(--xiva-text-dark);
}

/* Bot Typing Indicator Animation */
.xiva-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--xiva-bot-bubble);
    color: var(--xiva-text-white);
    border-radius: 0 18px 18px 18px;
    align-self: flex-start;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-top: 4px;
    margin-bottom: 4px;
    animation: bubbleSlideIn 0.25s ease forwards;
}

.xiva-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: xivaBounce 1.4s infinite ease-in-out both;
    opacity: 0.6;
}

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

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

@keyframes xivaBounce {
    0%, 80%, 100% { 
        transform: scale(0.3);
        opacity: 0.3;
    } 
    40% { 
        transform: scale(1.0);
        opacity: 0.9;
    }
}
