/* ============================================
   HYPER-GLASS CHATBOT - The Future of Support
   ============================================ */

:root {
    --hg-gold: #c5a028;
    --hg-gold-light: #e6c14d;
    --hg-glass: rgba(15, 15, 20, 0.7);
    --hg-blur: blur(50px) saturate(220%);
    --hg-border: 1px solid rgba(255, 255, 255, 0.15);
    --hg-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    --hg-glow: 0 0 20px rgba(197, 160, 40, 0.2);
}

/* Launcher Button - Multi-Layer Floating */
.chatbot-launcher-wrapper {
    position: fixed !important;
    bottom: 200px;
    /* Higher to avoid conflict with bottom nav */
    right: 20px;
    z-index: 20005 !important;
    pointer-events: none;
}

.chatbot-container {
    bottom: 280px !important;
    /* Higher position */
    right: 25px !important;
}

.chatbot-launcher-btn {
    position: relative !important;
    width: 76px;
    height: 76px;
    background: linear-gradient(135deg, var(--hg-gold), #8a6d10);
    color: white;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), var(--hg-glow);
    z-index: 20001;
    pointer-events: auto;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    animation: hgFloat 4s infinite ease-in-out, hgGlowPulse 3s infinite alternate;
}

@keyframes hgGlowPulse {
    from {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 10px rgba(197, 160, 40, 0.2);
    }

    to {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 30px rgba(197, 160, 40, 0.6);
    }
}

@keyframes hgFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.chatbot-launcher-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent, rgba(255, 255, 255, 0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.chatbot-launcher-btn:hover {
    transform: scale(1.1) rotate(8deg);
    box-shadow: 0 20px 45px rgba(197, 160, 40, 0.4);
}

/* Scroll Effect - Dynamic Reaction */
.chatbot-launcher-wrapper.is-scrolling .chatbot-launcher-btn {
    transform: scale(0.85) rotate(-5deg);
    opacity: 0.7;
    filter: saturate(1.5) brightness(1.2);
    box-shadow: 0 0 20px var(--hg-gold);
}

.chatbot-launcher-wrapper.is-scrolling .floating-badge {
    opacity: 0;
    transform: translateY(10px);
}

/* Hyper-Glass Window - Now Centered for Maximum Impact */
.chatbot-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%) scale(0.95);
    width: 450px;
    height: 700px;
    max-height: 85vh;
    background: var(--hg-glass);
    backdrop-filter: var(--hg-blur);
    -webkit-backdrop-filter: var(--hg-blur);
    border: var(--hg-border);
    border-radius: 40px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    z-index: 20000;
    overflow: hidden;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-container.active {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Organic Header */
.chatbot-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.whatsapp-btn-header {
    width: 44px;
    height: 44px;
    background: #25D366;
    color: white !important;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn-header:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5);
}

.chatbot-header .title {
    color: white;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, var(--hg-gold-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chatbot-header .status {
    font-size: 12px;
    color: var(--hg-gold);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chatbot-header .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--hg-gold);
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(197, 160, 40, 0.7);
    }

    70% {
        transform: scale(1.2);
        box-shadow: 0 0 0 10px rgba(197, 160, 40, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(197, 160, 40, 0);
    }
}

/* Hyper-Fluid Messages */
.chatbot-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: none;
}

.chatbot-messages::-webkit-scrollbar {
    display: none;
}

.message {
    max-width: 82%;
    padding: 16px 22px;
    border-radius: 28px;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 400;
    position: relative;
    animation: hgMessageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes hgMessageIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95) skewX(-2deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1) skewX(0);
    }
}

.bot-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    border-bottom-left-radius: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bot-message::after {
    content: 'K';
    position: absolute;
    left: -12px;
    bottom: 0;
    width: 24px;
    height: 24px;
    background: var(--hg-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--hg-gold), #8a6d10);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 8px 25px rgba(197, 160, 40, 0.25);
}

/* Interactive Input */
.chatbot-input-area {
    padding: 24px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    gap: 15px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chatbot-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
    border-radius: 999px;
    color: white;
    outline: none;
    font-size: 15px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-input-area input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--hg-gold);
    padding-left: 30px;
    box-shadow: 0 0 20px rgba(197, 160, 40, 0.15);
}

.chatbot-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--hg-gold);
    border: none;
    color: #000;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-send-btn:hover {
    transform: scale(1.1) rotate(-15deg);
    background: var(--hg-gold-light);
    box-shadow: 0 0 15px var(--hg-gold);
}

/* RTL Support - Maintain Centering */
[dir="rtl"] .chatbot-container {
    right: auto;
    left: auto;
    transform: translate(-50%, -40%) scale(0.95);
}

[dir="rtl"] .chatbot-container.active {
    transform: translate(-50%, -50%) scale(1);
}

[dir="rtl"] .chatbot-launcher-btn {
    right: auto;
    left: 40px;
}

[dir="rtl"] .bot-message {
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 6px;
}

[dir="rtl"] .bot-message::after {
    left: auto;
    right: -12px;
}

[dir="rtl"] .user-message {
    border-bottom-right-radius: 28px;
    border-bottom-left-radius: 6px;
}

/* Mobile Optimization */
@media (max-width: 500px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 110px;
        height: 70vh;
        border-radius: 32px;
    }

    .chatbot-launcher-btn {
        width: 64px;
        height: 64px;
        bottom: 30px;
        right: 30px;
    }
}