/* ============================================
   Chatbot Styles
   ============================================ */

/* Chatbot Toggle Button - Positioned below WhatsApp */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
    z-index: 9997;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    animation: floatChatbot 3s ease-in-out infinite;
}

.chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.chatbot-toggle svg,
.chatbot-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
    animation: pulseBadge 2s ease-in-out infinite;
}

.chatbot-badge.hidden {
    display: none;
}

@keyframes floatChatbot {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulseBadge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 480px;
    height: 680px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease-out;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@keyframes slideUpChatbot {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar svg {
    width: 20px;
    height: 20px;
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulseStatus 2s ease-in-out infinite;
}

@keyframes pulseStatus {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chatbot-message {
    display: flex;
    gap: 12px;
    animation: fadeInMessage 0.3s ease-out;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-bot {
    align-items: flex-start;
}

.chatbot-message-user {
    align-items: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-message-bot .message-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
}

.chatbot-message-user .message-avatar {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.chatbot-message-bot .message-content {
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-message-user .message-content {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-message-user .message-content p {
    color: white;
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 8px 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.quick-action-btn:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 18px 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
}

.chatbot-input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

.chatbot-input::placeholder {
    color: #94a3b8;
    font-size: 13px;
    opacity: 0.8;
}

.chatbot-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    outline: none;
}

.chatbot-input:hover:not(:focus) {
    border-color: #cbd5e1;
    background: #ffffff;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingAnimation 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-toggle {
        bottom: 30px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .chatbot-toggle svg,
    .chatbot-icon-img {
        width: 28px;
        height: 28px;
    }

    .chatbot-container {
        bottom: 100px;
        right: 15px;
        left: 15px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: 680px;
    }
}

@media (max-width: 576px) {
    .chatbot-toggle {
        bottom: 30px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    .chatbot-container {
        bottom: 90px;
        right: 10px;
        left: 10px;
        height: calc(100vh - 110px);
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-messages {
        padding: 16px;
    }
}

/* Adjust WhatsApp button position when chatbot is active */
.floating-whatsapp {
    transition: all 0.3s ease;
}

body.chatbot-active .floating-whatsapp {
    right: 420px;
}

@media (max-width: 768px) {
    body.chatbot-active .floating-whatsapp {
        right: 20px;
    }
    
    body.chatbot-active .chatbot-toggle {
        right: 20px;
    }
}

