/* Chatbot Container */
.chatbot-container {
    position: fixed !important;
    bottom: 30px !important;
    left: 20px !important;
    right: auto !important;
    z-index: 9999 !important;
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none; /* Critical: Prevent the invisible container bounds from blocking clicks behind it */
}

/* Chat Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00296b, #001845);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 41, 107, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    position: relative;
    overflow: hidden;
    pointer-events: auto; /* Re-enable clicks for the toggle button */
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(0, 41, 107, 0.4);
}

.chatbot-toggle i {
    transition: all 0.4s ease;
}

.chatbot-toggle.active i {
    transform: rotate(90deg) scale(0);
    opacity: 0;
}

.chatbot-toggle .close-icon {
    position: absolute;
    transform: rotate(-90deg) scale(0);
    opacity: 0;
}

.chatbot-toggle.active .close-icon {
    transform: rotate(0) scale(1);
    opacity: 1;
}

/* Chat Window */
.chatbot-window {
    width: 380px;
    height: 550px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 41, 107, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom left;
    pointer-events: none; /* Prevent invisible window from capturing clicks */
}

.chatbot-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Re-enable clicks when window is open */
}

/* Header */
.chatbot-header {
    padding: 20px;
    background: linear-gradient(135deg, #00296b, #001845);
    border-radius: 20px 20px 0 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chatbot-header .bot-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00296b;
    font-size: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.chatbot-header .bot-info h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chatbot-header .bot-info p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 41, 107, 0.1) transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 41, 107, 0.1);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: messageIn 0.3s ease-out forwards;
}

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

.message.bot {
    align-self: flex-start;
    background: rgba(0, 41, 107, 0.05);
    border: 1px solid rgba(0, 41, 107, 0.1);
    color: #2b2d42;
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00296b, #001845);
    color: white;
    border-bottom-right-radius: 2px;
}

/* Suggestions */
.chatbot-suggestions {
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid rgba(0, 41, 107, 0.1);
}

.suggestion-btn {
    padding: 6px 12px;
    background: rgba(0, 41, 107, 0.1);
    color: #00296b;
    border: 1px solid rgba(0, 41, 107, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: #00296b;
    color: white;
}

/* Input Area */
.chatbot-input {
    padding: 20px;
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(0, 41, 107, 0.1);
}

.chatbot-input input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 41, 107, 0.2);
    background: rgba(0, 41, 107, 0.03);
    outline: none;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chatbot-input input:focus {
    border-color: #00296b;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 41, 107, 0.1);
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: linear-gradient(135deg, #00296b, #001845);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Popup Bubble */
.chatbot-popup-bubble {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    font-weight: 500;
    color: #2b2d42;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.4s ease;
    border: 1px solid rgba(0, 41, 107, 0.1);
    z-index: 9998;
    pointer-events: none; /* Do not block clicks beneath */
}

.chatbot-popup-bubble.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chatbot-popup-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.popup-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #00296b;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: auto; /* Allow clicking the close button */
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 20px;
        left: 20px;
        right: auto;
    }
}