/* ===== AI Assistant Floating Button ===== */
.ai-fab-container {
    bottom: 90px;
    right: 20px;
    position: fixed !important;
    z-index: 2147483647 !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    pointer-events: auto !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    transform: translateZ(0); /* Force hardware acceleration */
    will-change: transform;
}

.ai-fab-container:active {
    cursor: grabbing;
}

.ai-fab-container.dragging {
    cursor: grabbing !important;
    user-select: none !important;
}

/* ===== Prevent interference from page styles ===== */
.ai-fab-container *,
.ai-fab-container *::before,
.ai-fab-container *::after {
    pointer-events: auto !important;
}

.ai-fab-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 
                0 0 0 2px rgba(99, 179, 237, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.ai-fab-btn:hover {
    box-shadow: 0 6px 28px rgba(99, 179, 237, 0.5), 
                0 0 0 3px rgba(99, 179, 237, 0.6);
    transform: scale(1.08);
}

.ai-fab-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    pointer-events: none;
}

.ai-fab-label {
    font-size: 11px;
    color: #fff;
    background: rgba(22, 33, 62, 0.85);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.ai-fab-container:hover .ai-fab-label {
    opacity: 1;
    transform: translateY(0);
}

/* Ripple pulse animation */
.ai-fab-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(99, 179, 237, 0.6);
    animation: ai-ripple 2s ease-out infinite;
    pointer-events: none;
}

@keyframes ai-ripple {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ===== AI Chat Popup ===== */
.ai-chat-popup {
    bottom: 160px;
    right: 20px;
    width: 340px;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(10, 144, 150, 0.15);
    display: none;
    position: fixed !important;
    z-index: 2147483646 !important;
    flex-direction: column;
    overflow: hidden;
    animation: ai-chat-slideUp 0.3s ease forwards;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ai-chat-popup.open {
    display: flex;
}

@keyframes ai-chat-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #00d6f0, #005b96);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.ai-chat-header:active {
    cursor: grabbing;
}

.ai-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    object-fit: cover;
}

.ai-chat-header-info {
    flex: 1;
}

.ai-chat-header-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.ai-chat-header-status {
    font-size: 11px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chat-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #4cdf6b;
    border-radius: 50%;
    display: inline-block;
}

.ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.ai-chat-close:hover {
    opacity: 1;
}

.ai-chat-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chat-action-btn {
    border: 1px solid rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.12);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.ai-chat-action-btn:hover {
    background: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}

/* Chat Body */
.ai-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f4f8f9;
    min-height: 280px;
    max-height: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chat Messages */
.ai-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
}


.ai-chat-msg.bot {
    align-self: flex-start;
}

.ai-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.ai-chat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
}

.ai-chat-msg.bot .ai-chat-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #dde8eb;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ai-chat-msg.user .ai-chat-bubble {
    background: linear-gradient(135deg, #0a9096, #18c397);
    color: #fff;
    border-top-right-radius: 4px;
}

.ai-chat-time {
    font-size: 10px;
    color: #9ab;
    margin-top: 4px;
    text-align: right;
}

.ai-chat-msg.bot .ai-chat-time {
    text-align: left;
}

/* Chat Footer / Input */
.ai-chat-footer {
    padding: 10px 12px;
    border-top: 1px solid #e4ecef;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #d0dce0;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    background: #f0f5f7;
    color: #888;
    cursor: not-allowed;
    transition: border-color 0.2s;
}

.ai-chat-send-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a9096, #1f728e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    opacity: 0.5;
    transition: opacity 0.2s;
}

/* Powered by footer */
.ai-chat-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: #aab;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.ai-chat-powered span {
    color: #0a9096;
    font-weight: 600;
}