/* ==========================================================================
   NEXT AI CHAT ROBOT - ULTRA FAST IOS STYLE OPTIMIZED
   ========================================================================== */

:root {
    --ai-primary: #0fff00; 
    --ai-primary-rgb: 15, 255, 0;
    --ai-bg: rgba(35, 35, 35, 0.88);
    --ai-glass: blur(15px) saturate(160%);
    --ai-border: rgba(255, 255, 255, 0.1);
    --ai-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    --ai-font: 'Urbanist', sans-serif;
    --ai-white-block: rgba(255, 255, 255, 0.98);
}

/* Floating Trigger Button */
.ai-chat-trigger {
    position: fixed;
    bottom: 30px; 
    right: 30px;
    width: 65px;
    height: 65px;
    background: #000;
    border: 2px solid var(--ai-primary); /* FIXED: GREEN BORDER */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-primary); /* ICON COLOR GREEN */
    font-size: 26px;
    cursor: pointer;
    z-index: 10005; 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease, border-color 0.3s;
    box-shadow: 0 0 20px rgba(15, 255, 0, 0.3);
    will-change: transform, opacity;
}

.ai-chat-trigger.active {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6) rotate(90deg);
}

.ai-chat-trigger.attention {
    animation: ai-shake 2s infinite;
}

@keyframes ai-shake {
    0%, 100% { transform: scale(1); }
    10%, 20% { transform: scale(1.1) rotate(-5deg); }
    30%, 50%, 70%, 90% { transform: scale(1.1) rotate(5deg); }
    40%, 60%, 80% { transform: scale(1.1) rotate(-5deg); }
}

/* Tooltip Bubble */
.ai-chat-tooltip {
    position: fixed;
    bottom: 45px;
    right: 110px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid var(--ai-primary);
    box-shadow: 0 10px 20px rgba(15, 255, 0, 0.2);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10004;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ai-chat-tooltip.show {
    opacity: 1;
    transform: translateX(0);
}

.ai-chat-trigger.attention + .ai-chat-tooltip {
    animation: tooltip-shake 2s infinite;
}

@keyframes tooltip-shake {
    0%, 100% { transform: translateX(0); }
    40% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
}

/* Chat Window Container */
.ai-chat-window {
    position: fixed;
    bottom: 30px; 
    right: 30px;  
    width: 380px;
    max-height: 600px;
    height: calc(100vh - 120px);
    background: var(--ai-bg);
    backdrop-filter: var(--ai-glass);
    -webkit-backdrop-filter: var(--ai-glass);
    border: 1px solid var(--ai-border);
    border-radius: 30px; 
    display: flex;
    flex-direction: column;
    z-index: 10004;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.1) translateY(40px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    box-shadow: var(--ai-shadow);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.ai-chat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* Subtle Background Pattern */
.ai-chat-window::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Header */
.ai-chat-header {
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--ai-border);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.ai-avatar {
    width: 42px;
    height: 42px;
    background: #000;
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-primary);
    font-size: 18px;
    position: relative;
}

.ai-avatar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--ai-primary);
    border: 2px solid #222;
    border-radius: 50%;
    box-shadow: 0 0 8px var(--ai-primary);
}

.ai-status h4 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: 800;
}

.ai-status p {
    margin: 0;
    font-size: 10px;
    color: var(--ai-primary);
    font-weight: 700;
    text-transform: uppercase;
}

.ai-chat-close {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-chat-close:hover {
    background: #ff3b3b;
    transform: translateY(-50%) rotate(90deg);
}

/* Message List */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.ai-chat-messages::-webkit-scrollbar { width: 6px; }
.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.message-ai {
    align-self: flex-start;
    background: var(--ai-white-block);
    color: #000;
    border-bottom-left-radius: 4px;
}

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--ai-primary), #0bcc00);
    color: #000;
    border-bottom-right-radius: 4px;
    font-weight: 700;
}

/* Quick Replies */
.ai-quick-links {
    padding: 10px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-btn {
    background: var(--ai-white-block);
    border: none;
    color: #000;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: left;
}

.quick-btn:hover {
    background: var(--ai-primary);
    transform: translateX(5px) scale(1.02);
}

/* Input Area */
.ai-chat-footer {
    padding: 15px 15px 35px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--ai-border);
}

.ai-input-wrap {
    flex: 1;
    display: flex;
}

#ai-chat-input {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--ai-border) !important;
    border-radius: 12px !important;
    padding: 12px 18px !important;
    color: #fff !important;
    font-size: 14px !important;
    outline: none !important;
}

.ai-send-btn {
    width: 45px;
    height: 45px;
    background: var(--ai-primary);
    border: none;
    border-radius: 12px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-send-btn:hover {
    transform: scale(1.1) rotate(-10deg);
}

/* Animations */
@keyframes ai-pop-in {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.message {
    animation: ai-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100% - 30px);
        right: 15px;
        bottom: 15px;
        height: calc(100vh - 100px);
    }
}
