/* ============================================
   SynetraOne AI Chatbot Widget
   Premium glassmorphism floating chat widget
   ============================================ */

/* Chat Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(13, 110, 253, 0.4),
                0 0 0 0 rgba(13, 110, 253, 0.3);
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: chatbotPulse 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(13, 110, 253, 0.5);
    animation: none;
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active svg.chat-icon {
    display: none;
}

.chatbot-toggle.active svg.close-icon {
    display: block;
}

.chatbot-toggle svg.close-icon {
    display: none;
}

/* Pulse animation for the toggle button */
@keyframes chatbotPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(13, 110, 253, 0.4), 0 0 0 0 rgba(13, 110, 253, 0.3); }
    50% { box-shadow: 0 8px 32px rgba(13, 110, 253, 0.4), 0 0 0 12px rgba(13, 110, 253, 0); }
}

/* Notification dot */
.chatbot-toggle .notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ff4757;
    border-radius: 50%;
    border: 3px solid white;
    animation: dotPulse 2s ease-in-out infinite;
}

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

.chatbot-toggle.active .notification-dot {
    display: none;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 400px;
    height: 560px;
    max-height: calc(100vh - 140px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(255, 255, 255, 0.3);
    z-index: 1049;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #121117 0%, #1a1a2e 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.5), transparent);
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.chatbot-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chatbot-avatar .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #2ed573;
    border-radius: 50%;
    border: 2px solid #121117;
}

.chatbot-header-info {
    flex-grow: 1;
}

.chatbot-header-title {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.chatbot-header-subtitle {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    margin: 2px 0 0 0;
    font-weight: 500;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-close-btn svg {
    width: 16px;
    height: 16px;
    fill: rgba(255, 255, 255, 0.7);
}

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

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease-out;
}

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

.chatbot-message.user {
    flex-direction: row-reverse;
}

.chatbot-message .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-message.bot .msg-avatar {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
}

.chatbot-message.bot .msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.chatbot-message.user .msg-avatar {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.chatbot-message.user .msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.chatbot-message .msg-bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.chatbot-message.bot .msg-bubble {
    background: #f0f2f5;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.chatbot-message.user .msg-bubble {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Markdown-like styling in bot messages */
.chatbot-message.bot .msg-bubble strong {
    font-weight: 700;
    color: #121117;
}

.chatbot-message.bot .msg-bubble a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.chatbot-message.bot .msg-bubble a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-indicator .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.typing-indicator .msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.typing-dots {
    background: #f0f2f5;
    padding: 14px 20px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #adb5bd;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* Chat Input Area */
.chatbot-input-area {
    padding: 14px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid #e9ecef;
    border-radius: 14px;
    padding: 11px 16px;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s ease;
    background: #f8f9fa;
    color: #1a1a2e;
}

.chatbot-input:focus {
    border-color: #0d6efd;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.chatbot-input::placeholder {
    color: #adb5bd;
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 14px;
}

.quick-action-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #e9ecef;
    background: white;
    color: #495057;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.quick-action-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.05);
}

/* Welcome message timestamp */
.msg-time {
    font-size: 0.68rem;
    color: #adb5bd;
    margin-top: 4px;
    display: block;
}

.chatbot-message.user .msg-time {
    text-align: right;
}

/* Powered by footer */
.chatbot-powered {
    text-align: center;
    padding: 6px 0;
    font-size: 0.68rem;
    color: #ced4da;
    background: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 90px);
        max-height: calc(100vh - 90px);
        bottom: 80px;
        right: 8px;
        border-radius: 16px;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chatbot-message .msg-bubble {
        max-width: 88%;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-window {
        width: 380px;
        height: 520px;
    }
}

/* Dark mode support (if user prefers) */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: rgba(26, 26, 46, 0.95);
    }

    .chatbot-message.bot .msg-bubble {
        background: rgba(255, 255, 255, 0.08);
        color: #e0e0e0;
    }

    .chatbot-message.bot .msg-bubble strong {
        color: #ffffff;
    }

    .chatbot-input-area {
        background: rgba(26, 26, 46, 0.8);
        border-top-color: rgba(255, 255, 255, 0.08);
    }

    .chatbot-input {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
    }

    .chatbot-input:focus {
        background: rgba(255, 255, 255, 0.1);
        border-color: #0d6efd;
    }

    .quick-action-btn {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.1);
        color: #adb5bd;
    }

    .quick-action-btn:hover {
        border-color: #0d6efd;
        color: #0d6efd;
        background: rgba(13, 110, 253, 0.1);
    }

    .typing-dots {
        background: rgba(255, 255, 255, 0.08);
    }
}
