/* ============================================
   VTECH MS - FLOATING BUTTONS & CHATBOT
   Elegant floating UI components
   ============================================ */

/* ============================================
   FLOATING BUTTONS CONTAINER
   ============================================ */

.floating-buttons {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    z-index: 9999;
}

/* ============================================
   WHATSAPP BUTTON
   ============================================ */

.whatsapp-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4),
        0 0 40px rgba(37, 211, 102, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse-whatsapp 2s infinite;
    text-decoration: none;
}

.whatsapp-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.5),
        0 0 60px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn i {
    font-size: 28px;
    color: #fff;
}

.whatsapp-btn .tooltip {
    position: absolute;
    right: 70px;
    background: rgba(11, 18, 32, 0.95);
    backdrop-filter: blur(10px);
    color: #E6EEF7;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(37, 211, 102, 0.3);
    pointer-events: none;
}

.whatsapp-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

@keyframes pulse-whatsapp {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4),
            0 0 40px rgba(37, 211, 102, 0.2);
    }

    50% {
        box-shadow: 0 4px 30px rgba(37, 211, 102, 0.6),
            0 0 60px rgba(37, 211, 102, 0.3);
    }
}

/* ============================================
   CHATBOT BUTTON
   ============================================ */

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E88E5 0%, #E53935 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(30, 136, 229, 0.4),
        0 0 40px rgba(229, 57, 53, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 8px 30px rgba(30, 136, 229, 0.5),
        0 0 60px rgba(229, 57, 53, 0.3);
}

.chatbot-toggle i {
    font-size: 26px;
    color: #fff;
    transition: transform 0.3s ease;
}

.chatbot-toggle.active i.fa-robot {
    display: none;
}

.chatbot-toggle.active i.fa-times {
    display: block;
}

.chatbot-toggle i.fa-times {
    display: none;
}

.chatbot-toggle .notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    background: #FFC107;
    border-radius: 50%;
    border: 2px solid #0B1220;
    animation: notification-pulse 1.5s infinite;
}

@keyframes notification-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* ============================================
   CHATBOT WINDOW
   ============================================ */

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: rgba(11, 18, 32, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(30, 136, 229, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(30, 136, 229, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.15) 0%, rgba(229, 57, 53, 0.15) 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(30, 136, 229, 0.15);
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E88E5 0%, #E53935 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(30, 136, 229, 0.4);
}

.chatbot-avatar i {
    font-size: 22px;
    color: #fff;
}

.chatbot-info {
    flex: 1;
}

.chatbot-name {
    font-size: 16px;
    font-weight: 600;
    color: #E6EEF7;
    margin: 0;
}

.chatbot-status {
    font-size: 12px;
    color: #25D366;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #25D366;
    border-radius: 50%;
    animation: status-blink 1.5s infinite;
}

@keyframes status-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    background: rgba(229, 57, 53, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #E53935;
}

.chatbot-close:hover {
    background: rgba(229, 57, 53, 0.4);
    transform: rotate(90deg);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 320px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(30, 136, 229, 0.05);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(30, 136, 229, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(30, 136, 229, 0.5);
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    background: rgba(30, 136, 229, 0.15);
    border: 1px solid rgba(30, 136, 229, 0.2);
    color: #E6EEF7;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: linear-gradient(135deg, #1E88E5 0%, #E53935 100%);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot .message-time,
.message.user .message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 6px;
    display: block;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply-btn {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #FFC107;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: #FFC107;
    transform: translateY(-2px);
}

/* Chatbot Input */
.chatbot-input {
    padding: 16px 20px;
    background: rgba(30, 136, 229, 0.05);
    border-top: 1px solid rgba(30, 136, 229, 0.15);
    display: flex;
    gap: 12px;
}

.chatbot-input input {
    flex: 1;
    background: rgba(11, 18, 32, 0.8);
    border: 1px solid rgba(30, 136, 229, 0.2);
    border-radius: 25px;
    padding: 12px 20px;
    color: #E6EEF7;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chatbot-input input:focus {
    outline: none;
    border-color: #1E88E5;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.chatbot-input input::placeholder {
    color: #9FB3C8;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E88E5 0%, #E53935 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.4);
}

.chatbot-send i {
    color: #fff;
    font-size: 16px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(30, 136, 229, 0.15);
    border: 1px solid rgba(30, 136, 229, 0.2);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 80px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #1E88E5;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================*/
/* Mobile Responsiveness */
@media (max-width: 480px) {
    .floating-buttons {
        bottom: 30px;
        right: 25px;
        /* Increased margin significantly */
        gap: 15px;
        max-width: 100vw;
        padding-right: 10px;
        z-index: 2147483647;
        /* Maximum possible z-index */
    }

    .whatsapp-btn,
    .chatbot-toggle {
        width: 50px;
        /* Reduced slightly to ensure it fits */
        height: 50px;
        font-size: 24px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    .whatsapp-btn .tooltip {
        display: none;
        /* Hide tooltip on mobile to prevent clutter */
    }

    .chatbot-window {
        position: fixed;
        width: 100% !important;
        /* Force full width */
        height: 100% !important;
        /* Force full height */
        max-width: 100vw !important;
        /* Never exceed viewport width */
        max-height: 100vh !important;
        /* Never exceed viewport height */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        transform: none !important;
        /* Reset transforms */
        display: flex;
        /* Ensure flex layout */
        flex-direction: column;
        z-index: 2147483648;
        /* Higher than buttons */
    }

    /* Hide floating buttons when chat is open */
    body.chatbot-open .floating-buttons {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.2s ease;
    }

    .chatbot-header {
        padding: 12px 15px;
        /* Compact padding */
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .chatbot-messages {
        flex: 1;
        max-height: none;
        /* Let flex handle height */
        padding: 15px;
        /* Less padding */
        padding-bottom: 20px;
    }

    /* Smaller message bubbles on mobile */
    .message {
        padding: 10px 14px;
        font-size: 13.5px;
    }

    .chatbot-input {
        padding: 12px 15px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: #0b1220;
        /* Solid background for input area */
    }
}

@media (max-width: 360px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
    }
}