/* ==========================================================================
   DXEL AI — Chat Widget Styles
   Premium glassmorphic design matching DXEL dark theme
   ========================================================================== */

/* Chat Trigger Button */
.dxel-ai-trigger {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(108, 92, 231, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: dxelAiFloat 3s ease-in-out infinite;
}

.dxel-ai-trigger:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 32px rgba(108, 92, 231, 0.6), 0 0 40px rgba(0, 206, 201, 0.4);
    animation-play-state: paused;
}

.dxel-ai-trigger svg {
    width: 36px;
    height: 36px;
    transition: transform 0.3s ease;
}

.dxel-ai-trigger.active svg {
    transform: rotate(90deg);
}

.dxel-ai-trigger .trigger-close {
    display: none;
}

.dxel-ai-trigger.active .trigger-icon { display: none; }
.dxel-ai-trigger.active .trigger-close { display: block; }

@keyframes dxelAiFloat {
    0%, 100% { 
        transform: translateY(0);
        box-shadow: 0 4px 24px rgba(108, 92, 231, 0.4); 
    }
    50% { 
        transform: translateY(-12px);
        box-shadow: 0 16px 36px rgba(108, 92, 231, 0.6), 0 0 60px rgba(0, 206, 201, 0.3); 
    }
}

/* Badge */
.dxel-ai-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #ff6b6b;
    border-radius: 50%;
    border: 2px solid #0a0a1a;
    animation: dxelBadgeBounce 1s ease infinite;
}

@keyframes dxelBadgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Chat Window */
.dxel-ai-window {
    position: fixed;
    bottom: 170px;
    right: 30px;
    width: 400px;
    height: 560px;
    border-radius: 20px;
    background: rgba(12, 12, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(108, 92, 231, 0.25);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(108, 92, 231, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dxel-ai-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.dxel-ai-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.dxel-ai-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(108, 92, 231, 0.15), transparent 60%),
                radial-gradient(circle at 80% 50%, rgba(0, 206, 201, 0.1), transparent 60%);
    pointer-events: none;
}

.dxel-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.dxel-ai-avatar svg {
    width: 26px;
    height: 26px;
}

@keyframes eveBlink {
    0%, 2%, 6%, 100% { transform: scaleY(1); opacity: 1; }
    4% { transform: scaleY(0.1); opacity: 0.6; }
}

.eve-eye {
    transform-origin: center;
    transform-box: fill-box;
    animation: eveBlink 5s infinite ease-in-out;
}

.dxel-ai-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #00e676;
    border-radius: 50%;
    border: 2px solid rgba(12, 12, 30, 0.95);
}

.dxel-ai-header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.dxel-ai-header-info h4 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    margin: 0;
}

.dxel-ai-header-info span {
    color: #00e676;
    font-size: 0.75rem;
    font-weight: 500;
}

.dxel-ai-header-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
}

.dxel-ai-header-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Messages Area */
.dxel-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.dxel-ai-messages::-webkit-scrollbar {
    width: 4px;
}

.dxel-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.dxel-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.3);
    border-radius: 4px;
}

/* Message Bubbles */
.dxel-ai-msg {
    max-width: 85%;
    animation: dxelMsgIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dxel-ai-msg.bot {
    align-self: flex-start;
}

.dxel-ai-msg.user {
    align-self: flex-end;
}

.dxel-ai-msg .bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
    word-wrap: break-word;
}

.dxel-ai-msg.bot .bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    border-top-left-radius: 4px;
}

.dxel-ai-msg.user .bubble {
    background: linear-gradient(135deg, #6c5ce7, #5a4bd1);
    color: #fff;
    border-top-right-radius: 4px;
}

.dxel-ai-msg .bubble strong {
    color: #00cec9;
    font-weight: 600;
}

.dxel-ai-msg .bubble a {
    color: #00cec9;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dxel-ai-msg .bubble a:hover {
    color: #6c5ce7;
}

.dxel-ai-msg .bubble ul {
    margin: 8px 0 4px;
    padding-left: 1.2rem;
}

.dxel-ai-msg .bubble ul li {
    margin-bottom: 4px;
}

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

/* Typing Indicator */
.dxel-ai-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border-top-left-radius: 4px;
}

.dxel-ai-typing span {
    width: 7px;
    height: 7px;
    background: rgba(108, 92, 231, 0.7);
    border-radius: 50%;
    animation: dxelTypingDot 1.4s ease-in-out infinite;
}

.dxel-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.dxel-ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dxelTypingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick Reply Buttons */
.dxel-ai-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.dxel-ai-quick-btn {
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.3);
    color: #b8b0f0;
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dxel-ai-quick-btn:hover {
    background: rgba(108, 92, 231, 0.25);
    color: #fff;
    border-color: rgba(108, 92, 231, 0.5);
    transform: translateY(-1px);
}

/* Input Area */
.dxel-ai-input-area {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(12, 12, 30, 0.6);
}

.dxel-ai-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}

.dxel-ai-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.dxel-ai-input:focus {
    border-color: rgba(108, 92, 231, 0.5);
}

.dxel-ai-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dxel-ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(108, 92, 231, 0.4);
}

.dxel-ai-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Powered By */
.dxel-ai-footer {
    text-align: center;
    padding: 6px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Inter', sans-serif;
    border-top: 1px solid rgba(255,255,255,0.03);
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
    .dxel-ai-window {
        top: auto;
        bottom: 150px;
        right: 15px;
        left: 15px;
        width: auto;
        height: 65vh;
        max-height: 500px;
        border-radius: 20px;
        border: 1px solid rgba(108, 92, 231, 0.25);
        transform: translateY(20px) scale(0.95);
        z-index: 10000;
    }

    .dxel-ai-window.open {
        transform: translateY(0) scale(1);
    }

    .dxel-ai-trigger {
        bottom: 85px; /* Keeps it above mobile navigation */
        right: 20px;
        width: 54px;
        height: 54px;
    }
    
    .dxel-ai-header {
        padding: 15px 20px;
        padding-top: max(15px, env(safe-area-inset-top)); /* iOS Notch support */
    }
    
    .dxel-ai-messages {
        padding: 15px 20px;
    }
    
    .dxel-ai-input-area {
        padding: 12px 20px;
        padding-bottom: max(12px, env(safe-area-inset-bottom)); /* iOS Home bar support */
    }

    .dxel-ai-input {
        font-size: 16px; /* Crucial: Prevents iOS Safari auto-zoom on input focus */
        padding: 12px 16px;
    }

    .dxel-ai-send {
        width: 44px;
        height: 44px;
    }
}
