/* Base Styles */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: 650px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 0px;
    transition: all 0.3s ease;
}

#chatbot-container.active {
    display: flex !important;
}

/* Header Styles */
#chatbot-header {
    background: linear-gradient(135deg, #fac5e2, #cf9bb5);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    position: relative;
    overflow: hidden;
    min-height: 80px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1;
}

#bot-avatar-logo {
    width: 100px;
    height: 50px;
    object-fit: cover;
    flex-shrink: 0;
    max-width: 100%;
    max-height: 100%;
}

.chat-title {
    font-weight: bold;
    font-size: 18px;
}

.chat-status {
    font-size: 14px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 8px;
}

.online-dot {
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Close Button */
#chatbot-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 1;
    flex-shrink: 0;
}

#chatbot-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Chat Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fff5fb 0%, #ffffff 100%);
    max-height: 400px;
    min-height: 300px;
    -webkit-overflow-scrolling: touch;
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-message {
    background: linear-gradient(135deg, #ff1493, #ff69b4);
    color: white;
    padding: 15px 20px;
    border-radius: 25px 25px 8px 25px;
    margin-left: auto;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 15px;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.3);
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-direction: row-reverse;
}

.bot-message {
    background: white;
    color: #333;
    padding: 15px 20px;
    border-radius: 25px 25px 25px 8px;
    margin-right: auto;
    max-width: 85%;
    word-wrap: break-word;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #ff69b4;
    font-size: 15px;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bot-avatar{
    width: 48px;
    height: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img{
    width: 35px;
    height: 35px;
    object-fit: cover;
}
.bot-avatar img {
    height: auto;
    width: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.user-text, .bot-text {
    display: block;
    max-width: 100%;
    word-break: break-word;
    line-height: 1.4;
}

/* Quick Reply Buttons */
.chat-footer-buttons-row {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #ffe0f0;
    gap: 10px;
}

.chat-footer-buttons-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    padding: 5px 0;
}

.chat-footer-buttons-scroll::-webkit-scrollbar {
    display: none;
}

.chat-footer-buttons-scroll button {
    white-space: nowrap;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #ff1493, #ff69b4);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.3);
    margin: 0;
}

.chat-footer-buttons-scroll button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 20, 147, 0.5);
}

.scroll-arrow {
    background: #fff;
    border: 1px solid #ff69b4;
    color: #ff69b4;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.scroll-arrow:hover {
    background: #ff69b4;
    color: #fff;
    transform: scale(1.1);
}

/* Input Bar */
.chat-input-bar {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #ffe0f0;
    gap: 15px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ff69b4;
    border-radius: 30px;
    outline: none;
    font-size: 16px;
    background: #fff5fb;
    transition: all 0.3s ease;
    min-height: 20px;
}

#chat-input:focus {
    border-color: #ff1493;
    box-shadow: 0 0 0 3px rgba(255, 20, 147, 0.1);
    background: white;
}

#chat-send-btn {
    background: linear-gradient(135deg, #ff1493, #ff69b4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.3);
    flex-shrink: 0;
}

#chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 20, 147, 0.5);
}

/* Floating Button */
#chatbot-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 0;
    background: linear-gradient(135deg, #ff1493, #ff69b4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    box-shadow: 0 8px 30px rgba(255, 20, 147, 0.4);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

#chatbot-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(255, 20, 147, 0.6);
}

#chatbot-float-btn.hide {
    display: none !important;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    #chatbot-container {
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    #chatbot-header {
        padding: 15px 20px;
        min-height: 70px;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    .chat-status {
        font-size: 13px;
    }
    
    
    .chat-body {
        padding: 15px;
        max-height: calc(100dvh - 200px) !important;
        flex: 1;
    }
    
    .user-message, .bot-message {
        max-width: 90%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .user-avatar img {
        width: 28px;
        height: 28px;
    }
    
    .bot-avatar img {
        width: 38px;
        height: auto;
        object-fit: contain;
        flex-shrink: 0;
    }
    
    .chat-footer-buttons-row {
        padding: 10px 15px;
    }
    
    .chat-footer-buttons-scroll button {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .scroll-arrow {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .chat-input-bar {
        padding: 15px;
        gap: 10px;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #ffe0f0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 10;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    #chat-input {
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid #ff69b4;
        border-radius: 30px;
        background: #fff5fb;
        outline: none;
        transition: all 0.3s ease;
        width: 100%;
        box-sizing: border-box;
    }
    
    #chat-send-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    #chatbot-float-btn {
        width: 60px;
        height: 60px;
        font-size: 28px;
        bottom: 15px;
        right: 15px;
    }
    
    body.chatbot-open {
        overflow: hidden;
        touch-action: none;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-body {
        max-height: calc(100dvh - 180px) !important;
    }
}

/* Additional mobile fixes */
@supports (height: 100dvh) {
    @media (max-width: 768px) {
        #chatbot-container {
            height: 100dvh;
            max-height: 100dvh;
        }
    }
}