/* Chat Bubble */
#chat-bubble {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    background-color: #FF00C8 !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    z-index: 1000 !important;
}

#chat-bubble.clicked {
    transform: scale(0.95) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

#chat-bubble:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

#chat-bubble svg {
    width: 30px !important;
    height: 30px !important;
    color: white !important;
    transition: transform 0.3s ease !important;
}

#chat-bubble:hover svg {
    transform: rotate(15deg) !important;
}

/* Chat Container */
#chat-container {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    width: 420px !important;
    height: 650px !important;
    background: white !important;
    border: 2px solid #FF00C8 !important;
    border-radius: 24px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.3s ease !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) !important;
    z-index: 999 !important;
}

#chat-container.open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Chat Header */
#chat-header {
    padding: 15px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #FF00C8 !important;
    color: #ffffff !important;
    border-top-left-radius: 22px !important;
    border-top-right-radius: 22px !important;
}

#chat-bubble-help-text {
    display: flex !important;
}

.displayNone {
    display: none !important;
}

#chat-header-avatar {
    display: flex !important;
    align-items: center !important;
}

#chat-header-avatar img {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 2px solid #ffffff !important;
}

#chat-header-text {
    flex-grow: 1 !important;
    text-align: center !important;
    font-weight: 600 !important;
    font-size: 18px !important;
    margin: 0 10px !important;
}

#close-chat {
    cursor: pointer !important;
    font-size: 24px !important;
    opacity: 0.8 !important;
    transition: opacity 0.2s ease !important;
}

#close-chat:hover {
    opacity: 1 !important;
}

/* Chat Box */
#chat-box {
    flex-grow: 1 !important;
    overflow-y: auto !important;
    padding: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    background-color: #ffffff !important;
    scroll-behavior: smooth !important;
}

/* Scrollbar Styling */
#chat-box::-webkit-scrollbar {
    width: 8px !important;
}

#chat-box::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 4px !important;
}

#chat-box::-webkit-scrollbar-thumb {
    background: #FF00C8 !important;
    border-radius: 4px !important;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background: #0056b3 !important;
}

/* Messages */
.message {
    margin: 10px 0 !important;
    display: flex !important;
    clear: both !important;
}

.user-message {
    justify-content: flex-end !important;
}

.assistant-message {
    justify-content: flex-start !important;
}

.business-message {
    justify-content: center !important;
}

.business-bubble {
    background-color: #34C759 !important;
    color: white !important;
    border-radius: 20px !important;
    border-bottom-left-radius: 5px !important;
    margin-right: auto !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

/* Message Bubbles */
.message-bubble {
    max-width: 80% !important;
    padding: 12px !important;
    word-wrap: break-word !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    position: relative !important;
}

.user-bubble {
    background-color: #FF00C8 !important;
    color: white !important;
    border-radius: 20px !important;
    border-bottom-right-radius: 5px !important;
    margin-left: auto !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.assistant-bubble {
    background-color: #f0f0f0 !important;
    color: black !important;
    border: 1px solid #dddddd !important;
    border-radius: 20px !important;
    border-bottom-left-radius: 5px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

/* Chat Footer */
#message-input-container {
    padding: 15px !important;
    background: #f5f5f5 !important;
    border-top: 1px solid #dddddd !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

#message-input {
    flex-grow: 1 !important;
    padding: 12px !important;
    border: 1px solid #dddddd !important;
    border-radius: 18px !important;
    outline: none !important;
    font-size: 14px !important;
    background: #ffffff !important;
    color: #000000 !important;
    transition: border-color 0.2s ease !important;
}

#message-input:focus {
    border-color: #FF00C8 !important;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5) !important;
}

/* Send Button */
#send-button {
    width: 50px !important;
    height: 50px !important;
    padding: 0 !important;
    background-color: #FF00C8 !important;
    border: none !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, transform 0.2s ease !important;
}

#send-button:hover {
    background-color: #0056b3 !important;
    transform: scale(1.1) !important;
}

#send-button:active {
    transform: scale(0.95) !important;
}

#send-button svg {
    fill: white;
    color: white;
}

/* Footer Branding */
#chat-footer-branding {
    text-align: center !important;
    font-size: 12px !important;
    color: #888 !important;
    padding: 10px !important;
    background: #f5f5f5 !important;
    border-bottom-left-radius: 22px !important;
    border-bottom-right-radius: 22px !important;
}

#chat-footer-branding a {
    color: #FF00C8 !important;
    text-decoration: none !important;
}

#chat-footer-branding a:hover {
    text-decoration: underline !important;
}

/* Typing Indicator */
.typing-indicator {
    display: flex !important;
    align-items: center !important;
    margin: 10px 0 !important;
}

.typing-bubble {
    background-color: #f0f0f0 !important;
    padding: 12px !important;
    border-radius: 20px !important;
    border-bottom-left-radius: 5px !important;
}

.typing-dots {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.dot {
    width: 6px !important;
    height: 6px !important;
    background-color: #666 !important;
    border-radius: 50% !important;
    animation: typingDots 1.4s infinite ease-in-out !important;
}

.dot:nth-child(2) {
    animation-delay: 0.2s !important;
}

.dot:nth-child(3) {
    animation-delay: 0.4s !important;
}

@keyframes typingDots {
    0%, 80%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Customer Information Form */
.customer-information {
    display: none !important;
    position: relative !important;
    flex-direction: column !important;
    background: white !important;
    max-width: 90% !important;
    padding: 20px !important;
    border: 2px solid #FF00C8 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    margin-top: 10px !important;
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.customer-information.show {
    display: flex !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Input Container */
.insider {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

.input-container {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.input-container input {
    flex-grow: 1 !important;
    padding: 10px !important;
    border: 1px solid #FF00C8 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.input-container input:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3) !important;
}

/* Edit Icon */
.edit-icon {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    fill: #FF00C8 !important;
    transition: fill 0.2s ease !important;
}

.edit-icon:hover {
    fill: #007bff !important;
}

/* Save Button */
#save-info-button {
    background-color: #FF00C8 !important;
    margin-top: 16px !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    transition: background-color 0.2s ease, transform 0.2s ease !important;
}

#save-info-button:hover {
    background-color: #0056b3 !important;
    transform: scale(1.05) !important;
}

#save-info-button:active {
    transform: scale(0.95) !important;
}

.save-icon {
    width: 18px !important;
    height: 18px !important;
    fill: white !important;
}

/* Error Message Styling */
.error-message {
    color: #ff6b6b !important;
    font-size: 12px !important;
    margin-top: 5px !important;
    text-align: center !important;
}

/* First Message Container */
.first-message {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-direction: column !important;
    width: 90% !important;
    max-width: 300px !important;
    padding: 20px !important;
    background-color: #f9f9f9 !important;
    border: 1px solid #FF00C8 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    margin: 10px auto !important;
    transition: all 0.3s ease !important;
}

.first-message h5 {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 5px !important;
}

/* Dropdown Button Styling */
.dropdown-button {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    color: #FF00C8 !important;
    font-size: 14px !important;
    transition: color 0.2s ease !important;
}

.dropdown-button:hover {
    color: #007bff !important;
}

/* Arrow Icons */
.down-arrow, .up-arrow {
    width: 16px !important;
    height: 16px !important;
    fill: #FF00C8 !important;
    transition: fill 0.2s ease !important;
}

.down-arrow:hover, .up-arrow:hover {
    fill: #007bff !important;
}

/* Tooltip Styling */
.tooltip {
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background-color: #333 !important;
    color: white !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease !important;
}

.dropdown-button:hover .tooltip {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure the arrows are properly aligned */
.dropdown-button {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

/* Hide the appropriate arrow based on state */
.hidden {
    display: none !important;
}


/* Responsive Styles for Mobile Devices */
@media screen and (max-width: 768px) {
    /* Chat Container */
    #chat-container {
        width: 90% !important;
        height: 80vh !important;
        right: 5% !important;
        left: 5% !important;
        bottom: 80px !important;
        border-radius: 16px !important;
    }
    
    /* Chat Header */
    #chat-header {
        padding: 10px !important;
        border-top-left-radius: 14px !important;
        border-top-right-radius: 14px !important;
    }
    
    #chat-header-text {
        font-size: 16px !important;
    }
    
    #chat-header-avatar img {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Message Bubbles */
    .message-bubble {
        max-width: 85% !important;
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    /* Chat Footer */
    #message-input-container {
        padding: 10px !important;
    }
    
    #message-input {
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    #send-button {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Customer Information Form */
    .customer-information {
        padding: 15px !important;
    }
    
    .input-container input {
        padding: 8px !important;
        font-size: 13px !important;
    }
    
    #save-info-button {
        padding: 8px 15px !important;
        font-size: 13px !important;
    }
    
    /* First Message */
    .first-message {
        padding: 15px !important;
        max-width: 85% !important;
    }
    
    .first-message h5 {
        font-size: 14px !important;
    }
    
    /* For very small screens (iPhone SE, etc.) */
    @media screen and (max-width: 375px) {
        #chat-container {
            width: 95% !important;
            height: 75vh !important;
            right: 2.5% !important;
            left: 2.5% !important;
        }
        
        .message-bubble {
            max-width: 90% !important;
            font-size: 12px !important;
        }
        
        #chat-header-text {
            font-size: 14px !important;
        }
        
        #message-input {
            font-size: 12px !important;
        }
    }
    
    /* Make sure chat bubble stays accessible */
    #chat-bubble {
        width: 50px !important;
        height: 50px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
    
    #chat-bubble svg {
        width: 25px !important;
        height: 25px !important;
    }
    
    /* Fix footer branding */
    #chat-footer-branding {
        font-size: 10px !important;
        padding: 8px !important;
    }
    
    /* Improve scrollbar for mobile touch */
    #chat-box::-webkit-scrollbar {
        width: 5px !important;
    }
}

/* Landscape mode for mobile devices */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #chat-container {
        height: 85vh !important;
        bottom: 60px !important;
    }
    
    #chat-box {
        flex-grow: 3 !important;
    }
    
    #chat-header {
        padding: 8px !important;
    }
    
    #message-input-container {
        padding: 8px !important;
    }
    
    #chat-footer-branding {
        padding: 5px !important;
    }
}