/* BEGSYSTEM AI Chatbot Stylesheet */

/* Chat Launcher Button */
.beg-chatbot-launcher {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 30px;
    right: 105px; /* Positioned to the left of the WhatsApp button (30px + 60px + 15px) */
    background: linear-gradient(135deg, #1fb6c9 0%, #128290 100%);
    color: #071a2f !important;
    border-radius: 50%;
    font-size: 26px;
    box-shadow: 0px 4px 20px rgba(31, 182, 201, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    outline: none;
}

.beg-chatbot-launcher:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0px 8px 25px rgba(31, 182, 201, 0.6);
    background: linear-gradient(135deg, #25cbe0 0%, #1798a8 100%);
}

.beg-chatbot-launcher i {
    transition: transform 0.3s ease;
}

.beg-chatbot-launcher.active i {
    transform: rotate(90deg);
}

/* Chat Window */
.beg-chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 580px;
    max-height: calc(100vh - 150px);
    background: rgba(7, 26, 47, 0.92);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.075, 0.82, 0.165, 1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.beg-chatbot-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Chat Header */
.beg-chat-header {
    background: linear-gradient(90deg, #0b2340 0%, #071a2f 100%);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.beg-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.beg-chat-logo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(31, 182, 201, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.beg-chat-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.beg-chat-title-container {
    display: flex;
    flex-direction: column;
}

.beg-chat-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin: 0;
}

.beg-chat-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.beg-chat-status::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #25d366;
    border-radius: 50%;
    box-shadow: 0 0 8px #25d366;
    animation: status-pulse 1.8s infinite;
}

.beg-chat-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.beg-chat-close:hover {
    color: #fff;
}

/* Chat Messages */
.beg-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.beg-message {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msg-fade-in 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.beg-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e9eef6;
    border-top-left-radius: 4px;
}

.beg-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1fb6c9 0%, #128290 100%);
    color: #071a2f;
    font-weight: 500;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(31, 182, 201, 0.15);
}

.beg-message p {
    margin: 0 0 8px 0;
}

.beg-message p:last-child {
    margin-bottom: 0;
}

.beg-message ul, .beg-message ol {
    margin: 6px 0;
    padding-left: 20px;
}

.beg-message li {
    margin-bottom: 4px;
}

.beg-message b, .beg-message strong {
    font-weight: bold;
    color: #fff;
}

.beg-message.user b, .beg-message.user strong {
    color: #071a2f;
}

/* Suggestions Pilled Buttons */
.beg-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.beg-suggest-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(233, 238, 246, 0.85);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.beg-suggest-pill:hover {
    background: rgba(31, 182, 201, 0.12);
    border-color: #1fb6c9;
    color: #1fb6c9;
    transform: translateY(-1px);
}

/* Chat Input Area */
.beg-chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 35, 64, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
}

.beg-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 10px 18px;
    color: #fff;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

.beg-chat-input:focus {
    border-color: rgba(31, 182, 201, 0.5);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 10px rgba(31, 182, 201, 0.1);
}

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

.beg-chat-submit {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #1fb6c9;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.beg-chat-submit:hover {
    background: rgba(31, 182, 201, 0.1);
    color: #25cbe0;
    transform: scale(1.05);
}

.beg-chat-submit:disabled {
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    background: transparent !important;
    transform: none !important;
}

/* Typing Indicator Animation */
.beg-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 0;
}

.beg-typing-dot {
    width: 7px;
    height: 7px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.beg-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.beg-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* Keyframes */
@keyframes status-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

@keyframes msg-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .beg-chatbot-launcher {
        bottom: 105px; /* Positioned above WhatsApp on mobile (which is at bottom: 30px) */
        right: 30px;
    }
    
    .beg-chatbot-window {
        bottom: 180px;
        right: 20px;
        left: 20px;
        width: auto;
        height: 60vh;
        max-height: calc(100vh - 240px);
    }
}

/* Tooltip / Notification Bubble */
.beg-chatbot-tooltip {
    position: fixed;
    bottom: 98px; /* sits right above the launcher (30px bottom + 60px height + 8px gap) */
    right: 90px;  /* aligned with launcher */
    background: rgba(7, 26, 47, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(31, 182, 201, 0.3);
    color: #e9eef6;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
    font-size: 13px;
    line-height: 1.4;
    z-index: 9998;
    max-width: 250px;
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    cursor: pointer;
}

.beg-chatbot-tooltip.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Tooltip Arrow */
.beg-chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 32px; /* aligns with launcher center */
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: rgba(7, 26, 47, 0.95) transparent;
    display: block;
    width: 0;
}

.beg-chatbot-tooltip::before {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 31px;
    border-width: 7px 7px 0;
    border-style: solid;
    border-color: rgba(31, 182, 201, 0.3) transparent;
    display: block;
    width: 0;
    z-index: -1;
}

.beg-chatbot-tooltip-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-right: 12px;
}

.beg-chatbot-tooltip-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(233, 238, 246, 0.5);
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    transition: color 0.2s ease;
    z-index: 10;
}

.beg-chatbot-tooltip-close:hover {
    color: #1fb6c9;
}

/* Mobile adjustments for tooltip */
@media (max-width: 768px) {
    .beg-chatbot-tooltip {
        bottom: 173px; /* sits above mobile launcher (105px bottom + 60px height + 8px gap) */
        right: 25px; /* aligns with launcher on mobile */
    }
    
    .beg-chatbot-tooltip::after {
        right: 18px;
    }
    .beg-chatbot-tooltip::before {
        right: 17px;
    }
}
