/* ==========================================================================
   CHATBOT WIDGET STYLES
   ========================================================================== */

/* Toggle Button */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00aeff, #0077ff);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 174, 255, 0.4);
    z-index: 99999;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    /* Defensive Visibility */
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-toggler:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 174, 255, 0.6);
}

.chatbot-toggler span {
    color: #fff;
    position: absolute;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.chatbot-toggler span:last-child,
.show-chatbot .chatbot-toggler span:first-child {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.show-chatbot .chatbot-toggler span:last-child {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    right: 30px;
    bottom: 100px;
    width: 380px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 174, 255, 0.3);
    border-radius: 20px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: bottom right;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 99998;
}

.show-chatbot .chatbot-window {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #0d1b2a, #1a2332);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header h2 {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
    font-weight: 600;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Chat Box (Messages) */
.chatbox {
    height: 350px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbox::-webkit-scrollbar {
    width: 6px;
}

.chatbox::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 85%;
}

.chat-incoming {
    align-self: flex-start;
}

.chat-outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 174, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00aeff;
    border: 1px solid rgba(0, 174, 255, 0.3);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message p {
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px 12px 12px 2px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-outgoing p {
    background: linear-gradient(135deg, #00aeff, #0077ff);
    border-radius: 12px 12px 2px 12px;
    box-shadow: 0 4px 15px rgba(0, 174, 255, 0.2);
}

/* Chat Input */
.chat-input {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    background: rgba(10, 22, 40, 0.5);
}

.chat-input textarea {
    width: 100%;
    height: 45px;
    border: none;
    outline: none;
    resize: none;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding: 12px 15px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.chat-input textarea:focus {
    background: rgba(255, 255, 255, 0.1);
}

.chat-input textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#send-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #00aeff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#send-btn:hover {
    background: rgba(0, 174, 255, 0.1);
    transform: translateX(3px);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .chatbot-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .chatbot-window .chatbox {
        height: calc(100% - 140px);
        /* Fill available space minus header/input */
        padding-bottom: 20px;
    }

    .chatbot-input {
        padding: 10px 15px;
    }

    .chatbot-toggler {
        bottom: 20px;
        right: 20px;
    }
}