/* Glassmorphism Qynzo AI Chat Widget */
:root {
    --qynzo-chat-primary: #6366f1; /* Overridden by inline style */
    --qynzo-chat-bg: rgba(255, 255, 255, 0.75);
    --qynzo-chat-blur: blur(16px);
    --qynzo-chat-border: rgba(255, 255, 255, 0.4);
    --qynzo-chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --qynzo-chat-text: #1f2937;
    --qynzo-chat-gray: rgba(243, 244, 246, 0.8);
    --qynzo-chat-radius: 20px;
}

/* Premium AI Badge Button */
.qynzo-chat-toggle-btn.qynzo-premium-ai-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    height: 54px;
    border-radius: 27px;
    background: linear-gradient(135deg, #111111 0%, #2a2a2a 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 255, 204, 0.2);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px 0 16px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.qynzo-chat-toggle-btn.qynzo-premium-ai-badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(0, 255, 204, 0.4);
    background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
}

.qynzo-ai-badge-waves {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 27px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 204, 0.2), transparent);
    background-size: 200% 100%;
    animation: waveShimmer 3s infinite linear;
    pointer-events: none;
}

@keyframes waveShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.qynzo-ai-badge-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qynzo-ai-icon {
    font-size: 20px;
    animation: sparkleFloat 2s infinite ease-in-out;
    display: inline-block;
}

@keyframes sparkleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-2px) scale(1.2); opacity: 1; }
}

.qynzo-ai-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(to right, #ffffff, #00ffcc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* Chat Window Container */
.qynzo-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--qynzo-chat-bg);
    backdrop-filter: var(--qynzo-chat-blur);
    -webkit-backdrop-filter: var(--qynzo-chat-blur);
    border: 1px solid var(--qynzo-chat-border);
    border-radius: var(--qynzo-chat-radius);
    box-shadow: var(--qynzo-chat-shadow);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

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

/* Header */
.qynzo-chat-header {
    background: linear-gradient(135deg, var(--qynzo-chat-primary) 0%, rgba(99, 102, 241, 0.9) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.qynzo-chat-header-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--qynzo-chat-primary);
    font-weight: 800;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.qynzo-chat-header-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.qynzo-chat-title {
    flex: 1;
}
.qynzo-chat-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: white;
}
.qynzo-chat-title p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
}

/* Close button inside header */
.qynzo-chat-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.qynzo-chat-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Body / Messages Area */
.qynzo-chat-body {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.qynzo-chat-body::-webkit-scrollbar {
    width: 6px;
}
.qynzo-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

/* Messages */
.qynzo-chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.qynzo-chat-message.bot {
    background: var(--qynzo-chat-gray);
    color: var(--qynzo-chat-text);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.qynzo-chat-message.user {
    background: var(--qynzo-chat-primary);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Footer / Input Area */
.qynzo-chat-footer {
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.qynzo-chat-input {
    flex: 1;
    background: var(--qynzo-chat-gray);
    border: none;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: background 0.2s, box-shadow 0.2s;
}
.qynzo-chat-input:focus {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--qynzo-chat-primary);
}
.qynzo-chat-send-btn {
    background: var(--qynzo-chat-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.qynzo-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.qynzo-chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-left: 2px;
}

/* Typing Indicator */
.qynzo-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--qynzo-chat-gray);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
    display: none;
}
.qynzo-chat-typing.active {
    display: flex;
}
.qynzo-chat-typing span {
    width: 6px;
    height: 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.qynzo-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.qynzo-chat-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.qynzo-chat-icon-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    text-decoration: none;
}
.qynzo-chat-icon-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .qynzo-chat-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 90px;
        height: calc(100vh - 120px);
        max-height: 550px;
    }
}
