/* ============================================
   AI CHATBOT - Ultra Premium Enterprise UI
   Smooth Streaming & Premium Design
   ============================================ */

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    border: none;
    cursor: pointer;
    box-shadow:
        0 10px 40px rgba(99, 102, 241, 0.4),
        0 0 0 0 rgba(99, 102, 241, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse-ring 2.5s ease-out infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.5);
    border-radius: 20px;
}

.chatbot-toggle.active {
    animation: none;
    transform: rotate(0deg);
    border-radius: 50%;
}

@keyframes pulse-ring {
    0% {
        box-shadow:
            0 10px 40px rgba(99, 102, 241, 0.4),
            0 0 0 0 rgba(99, 102, 241, 0.3);
    }

    70% {
        box-shadow:
            0 10px 40px rgba(99, 102, 241, 0.4),
            0 0 0 25px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow:
            0 10px 40px rgba(99, 102, 241, 0.4),
            0 0 0 0 rgba(99, 102, 241, 0);
    }
}

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

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

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

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

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 400px;
    height: 580px;
    max-height: calc(100vh - 150px);
    background: #ffffff;
    border-radius: 28px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.12),
        0 10px 30px rgba(99, 102, 241, 0.15);
    overflow: hidden;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2.5px solid white;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

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

.chatbot-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    font-family: 'Space Grotesk', sans-serif;
}

.chatbot-info p {
    display: none;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    opacity: 0.9;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, #fafbff 0%, #f5f7ff 100%);
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 0.6rem;
    max-width: 88%;
    animation: messageSlide 0.35s ease forwards;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.message.bot .message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message-avatar svg {
    width: 17px;
    height: 17px;
    fill: white;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.message-bubble {
    padding: 0.9rem 1.1rem;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.55;
    position: relative;
}

.message-bubble p {
    margin: 0 0 0.5rem 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    color: #4f46e5;
    font-weight: 600;
}

.message-bubble code {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #6366f1;
}

.message-bubble .list-item {
    display: block;
    padding-left: 0.5rem;
    margin: 0.3rem 0;
}

/* Chat List Items - Better Formatting */
.message-bubble .chat-list-item {
    display: block;
    padding: 0.4rem 0;
    padding-left: 0.25rem;
    line-height: 1.5;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
}

.message-bubble .chat-list-item:last-child {
    border-bottom: none;
}

.message-bubble .chat-list-item strong {
    color: #4f46e5;
}

.message.bot .message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.message-time {
    font-size: 0.68rem;
    color: #94a3b8;
    padding: 0 0.4rem;
}

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

/* Typing Cursor */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #6366f1;
    margin-left: 2px;
    animation: cursorBlink 0.8s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes cursorBlink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    max-width: 88%;
}

.typing-indicator .message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-indicator .message-avatar svg {
    width: 17px;
    height: 17px;
    fill: white;
}

.typing-dots {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.08);
    display: flex;
    gap: 5px;
    align-items: center;
}

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

.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%,
    60%,
    100% {
        transform: translateY(0);
        background: #c7d2fe;
    }

    30% {
        transform: translateY(-10px);
        background: #6366f1;
    }
}

/* Quick Suggestions */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1.25rem 0.75rem;
    background: linear-gradient(180deg, transparent 0%, #f5f7ff 100%);
}

.quick-suggestion {
    padding: 0.55rem 0.9rem;
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6366f1;
    cursor: pointer;
    transition: all 0.25s ease;
}

.quick-suggestion:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Input Area */
.chatbot-input-area {
    padding: 0.75rem 1.25rem 1.25rem;
    background: white;
    border-top: 1px solid #f1f5f9;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    transition: all 0.25s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: white;
}

.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.92rem;
    color: #1e293b;
    padding: 0.5rem 0;
    outline: none;
    font-family: inherit;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send {
    width: 42px;
    height: 42px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

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

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

/* Remove Powered By */
.powered-by {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100% - 20px);
        height: calc(100vh - 120px);
        max-height: none;
        bottom: 10px;
        right: 10px;
        left: 10px;
        border-radius: 24px;
        z-index: 10000;
        /* Ensure it's above everything */
    }

    .chatbot-toggle {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
        z-index: 10001;
        /* Above container */
        box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
    }

    .chatbot-messages {
        padding: 1rem;
    }

    .message {
        max-width: 92%;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100% - 16px);
        height: calc(100vh - 100px);
        bottom: 8px;
        right: 8px;
        left: 8px;
    }

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