/* ===============================
   AI Chat Bot Component
================================*/

/* Wrapper */
.ai-chat-bot-wrapper {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100000;
    font-family: 'Inter', sans-serif;
    pointer-events: auto !important;
}

/* Ensure children have pointer-events */
.ai-chat-bot-wrapper > * {
    pointer-events: auto !important;
}

/* Floating Trigger Button */
.ai-chat-bot-trigger {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 100001 !important;
    pointer-events: auto !important;
    padding: 0;
    outline: none;
    top: auto;
    left: auto;
    border: 3px solid yellow !important; /* Debug border to make it super visible */
}

.ai-chat-bot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.5);
}

.ai-chat-bot-trigger i {
    font-size: 28px;
    color: #ffffff;
    pointer-events: none; /* Prevent icon from intercepting clicks */
}

.ai-chat-bot-trigger-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #dc2626;
    opacity: 0;
    animation: pulse-animation 2s infinite;
    pointer-events: none; /* Prevent pulse from intercepting clicks */
}

@keyframes pulse-animation {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Interface Window */
.ai-chat-bot-interface {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 100001;
    overflow: hidden;
    flex-direction: column;
    animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.05);
    pointer-events: auto !important;
}

.ai-chat-bot-interface.active {
    display: flex;
}

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

/* Header */
.ai-chat-bot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    position: relative;
}

.ai-chat-bot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-bot-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    backdrop-filter: blur(4px);
}

.ai-chat-bot-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.ai-chat-bot-header-text h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.ai-chat-bot-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 4px #4ade80;
}

.ai-chat-bot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-chat-bot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Messages Area */
.ai-chat-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-bot-message {
    display: flex;
    max-width: 100%;
    animation: fade-in 0.3s ease;
}

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

.ai-chat-bot-message.bot-message {
    justify-content: flex-start;
}

.ai-chat-bot-message.user-message {
    justify-content: flex-end;
}

.ai-chat-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    flex-shrink: 0;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.ai-chat-bot-message.user-message .ai-chat-bot-avatar {
    margin-right: 0;
    margin-left: 12px;
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
}

.ai-chat-bot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ai-chat-bot-message.bot-message .ai-chat-bot-message-content {
    background: #ffffff;
    color: #334155;
    border-top-left-radius: 4px;
}

.ai-chat-bot-message.user-message .ai-chat-bot-message-content {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-top-right-radius: 4px;
}

.ai-chat-bot-message-content p {
    margin: 0;
}

/* Quick Questions */
.ai-chat-bot-quick-questions {
    padding: 12px 20px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    max-height: 140px;
    overflow-y: auto;
}

.ai-chat-bot-quick-questions-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.ai-chat-bot-quick-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-chat-bot-quick-btn {
    padding: 8px 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.ai-chat-bot-quick-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

/* Input Area */
.ai-chat-bot-input-area {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-bot-input {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    color: #334155;
    outline: none;
    transition: all 0.2s;
}

.ai-chat-bot-input:focus {
    background: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.ai-chat-bot-send-btn {
    width: 44px;
    height: 44px;
    background: #dc2626;
    border: none;
    border-radius: 50%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

.ai-chat-bot-send-btn:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.ai-chat-bot-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Floating Options Menu */
.ai-chat-bot-options {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100001;

    transform-origin: bottom right;
    transition: all 0.25s ease;

    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);

    border: 2px solid red; /* Debug border */
}

.ai-chat-bot-options.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.ai-chat-bot-option-btn {
    background: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #333;
    cursor: pointer !important;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    pointer-events: auto !important;
    z-index: 99998;
}

.ai-chat-bot-option-btn:hover {
    transform: translateX(-5px);
    color: #dc2626;
}

.ai-chat-bot-option-btn i {
    color: #dc2626;
    font-size: 18px;
}

/* ===============================
   Voice Agent Popup Panel
================================*/

.voice-agent-popup-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 100001 !important;
    display: none;
    animation: voice-agent-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.voice-agent-popup-panel.active {
    display: block;
}

@keyframes voice-agent-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.voice-agent-popup-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 340px;
    max-width: calc(100vw - 40px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.voice-agent-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
}

.voice-agent-popup-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.voice-agent-popup-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.voice-agent-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.voice-agent-popup-body {
    padding: 20px;
}

.voice-agents-list {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.voice-agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.voice-agent-item:hover {
    background: #f1f5f9;
    border-color: #dc2626;
    transform: translateX(-3px);
}

.voice-agent-item.selected {
    background: #fef2f2;
    border-color: #dc2626;
}

.voice-agent-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 24px;
    flex-shrink: 0;
}

.voice-agent-info {
    flex: 1;
}

.voice-agent-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

.voice-agent-desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: #6b7280;
}

.voice-agent-action {
    color: #9ca3af;
    font-size: 14px;
    transition: all 0.2s;
}

.voice-agent-item:hover .voice-agent-action {
    color: #dc2626;
    transform: translateX(3px);
}

.voice-agent-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.voice-agent-btn {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
}

.voice-agent-btn-primary {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.voice-agent-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.voice-agent-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.voice-agent-btn-secondary:hover {
    background: #e5e7eb;
    color: #dc2626;
    border-color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .voice-agent-popup-container {
        width: calc(100vw - 40px);
    }
    
    .ai-chat-bot-interface {
        width: calc(100vw - 40px);
        height: 70vh;
    }
}
