/* Chatbot Bubble Styles */
#chatbot-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

/* Mobile adjustments for bubble */
@media (max-width: 768px) {
    #chatbot-bubble {
        bottom: 20px;
        right: 20px;
    }

    #chatbot-bubble.chat-open {
        bottom: calc(70vh + 25px);  /* Move above the open chatbox on mobile */
    }
}

/* Android-specific adjustments for bubble */
@media screen and (max-device-width: 768px) and (-webkit-device-pixel-ratio: 2.0) {
    #chatbot-bubble {
        bottom: 15px;
        right: 15px;
        width: 50px;  /* Smaller size on Android */
        height: 50px;  /* Smaller size on Android */
    }

    #chatbot-bubble.chat-open {
        bottom: calc(60vh + 20px);  /* Move above the open chatbox on Android */
    }

    .chatbot-icon {
        width: 50px;  /* Smaller size on Android */
        height: 50px;  /* Smaller size on Android */
    }
}

/* Move bubble up when chat is open */
#chatbot-bubble.chat-open {
    bottom: calc(70vh + 30px);  /* Move above the open chatbox */
}

/* Android-specific positioning when chat is open */
@media screen and (max-device-width: 768px) and (-webkit-device-pixel-ratio: 2.0) {
    #chatbot-bubble.chat-open {
        bottom: calc(60vh + 25px);  /* Move above the open chatbox on Android */
    }
}

.chatbot-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #33C8DA 0%, #2BA9B8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(51, 200, 218, 0.4);
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20px;
    height: 200%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(25deg);
    transition: all 0.5s;
}

.chatbot-icon:hover::before {
    left: 120%;
}

.chatbot-icon:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 25px rgba(51, 200, 218, 0.6);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(51, 200, 218, 0.4);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(51, 200, 218, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(51, 200, 218, 0);
    }
}

/* Chatbox Styles */
#chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;  /* Changed from none to flex */
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    visibility: hidden;  /* Added visibility control */
}

#chatbot-container.open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;  /* Changed visibility when open */
}

/* Closing animation */
#chatbot-container.closing {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: visible;  /* Keep visible during closing animation */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #chatbot-container {
        width: 90vw;
        height: 70vh;  /* Reduced height for mobile */
        max-width: 380px;  /* Slightly smaller max-width */
        bottom: 20px;
        right: 5vw;
        left: 5vw;
    }

    #chatbot-container.open {
        position: fixed;
        height: 70vh;  /* Reduced height for mobile */
    }
}

@media (max-width: 480px) {
    #chatbot-container {
        width: 95vw;
        height: 65vh;  /* Further reduced height for smaller screens */
        max-width: 360px;  /* Smaller size on very small screens */
        right: 2.5vw;
        left: 2.5vw;
        border-radius: 18px;  /* Slightly smaller border radius */
        bottom: 15px;  /* Adjusted bottom position */
    }
}

/* Android-specific adjustments */
@media screen and (max-device-width: 768px) and (-webkit-device-pixel-ratio: 2.0) {
    #chatbot-container {
        width: 88vw;
        height: 60vh;
        max-width: 360px;
        bottom: 15px;
    }
}

/* iPhone specific adjustments */
@media screen and (max-device-width: 768px) and (-webkit-device-pixel-ratio: 3.0) {
    #chatbot-container {
        width: 90vw;
        height: 65vh;
        bottom: 20px;
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #33C8DA 0%, #2BA9B8 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chatbot-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-title-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

.chatbot-quick-actions {
    padding: 15px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto;
}

.quick-action-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-action-btn:hover {
    background: #e2e8f0;
    color: #33C8DA;
    border-color: #cbd5e1;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: white;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 16px 16px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

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

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #33C8DA 0%, #2BA9B8 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message {
    align-self: flex-start;
    background: #f9fafb;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 5px;
}

.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-input:focus {
    border-color: #33C8DA;
    box-shadow: 0 0 0 3px rgba(51, 200, 218, 0.2);
}

.chatbot-send-btn {
    width: 46px;
    height: 46px;
    border: none;
    background: linear-gradient(135deg, #33C8DA 0%, #2BA9B8 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(51, 200, 218, 0.3);
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(51, 200, 218, 0.4);
}

.typing-indicator {
    align-self: flex-start;
    background: #f9fafb;
    color: #6b7280;
    padding: 12px 16px;
    border-radius: 18px;
    font-style: italic;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}