:root {
    --primary-gradient-start: #43a047;
    --primary-gradient-end: #7cb342;
    --primary-gradient: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    --bg-color: #ffffff;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 20px rgba(76,175,80,0.4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    background-color: var(--bg-color);
    height: 100vh;
    overflow-x: hidden;
}

#chatButton {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all .3s cubic-bezier(.34,1.56,.64,1);
    animation: pulse 2s infinite;
}

#chatButton:hover { transform: scale(1.1) rotate(5deg); }
#chatButton svg { width: 32px; height: 32px; fill: white; }

.chat-active svg.icon-chat { display: none; }
.chat-active svg.icon-close { display: block; }
.chat-inactive svg.icon-chat { display: block; }
.chat-inactive svg.icon-close { display: none; }

#chatBox {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    height: 620px;
    max-height: 80vh;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    border: 1px solid rgba(255,255,255,.5);
    opacity: 0;
    transform: translateY(20px) scale(.95);
    transition: opacity .3s ease, transform .3s ease;
}

#chatBox.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

#chatHeader {
    background: var(--primary-gradient);
    color: white;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-content { display: flex; align-items: center; gap: 12px; }

.header-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.header-info h2 { margin: 0; font-size: 18px; font-weight: 600; }
.header-info p { margin: 2px 0 0; font-size: 12px; opacity: .9; }

#closeChat {
    background: rgba(255,255,255,.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatMessages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

#chatMessages::-webkit-scrollbar { width: 5px; }
#chatMessages::-webkit-scrollbar-track { background: transparent; }
#chatMessages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

.msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    animation: popIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(15px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-bubble.bot {
    background: #f0f2f5;
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg-bubble.user {
    background: var(--primary-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-bubble.redirect {
    background: #f0fdf4;
    color: #2e7d32;
    align-self: center;
    text-align: center;
    border: 1.5px solid #a5d6a7;
    font-size: 13px;
    max-width: 90%;
    padding: 10px 14px;
}

.msg-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    max-width: 85%;
    animation: popIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
}

.msg-options .opt-btn {
    border: 1.5px solid #e5e7eb;
    padding: 11px 16px;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .2s ease;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
}

.msg-options .opt-btn:hover {
    background: #f0fdf4;
    border-color: #43a047;
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(76,175,80,0.12);
}

.msg-options .opt-btn:active { transform: scale(.97); }
.msg-options .opt-btn .emoji { font-size: 18px; }

.typing-dots {
    display: flex;
    gap: 5px;
    padding: 14px 20px;
    align-self: flex-start;
    max-width: 85%;
    background: #f0f2f5;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    animation: popIn .3s ease forwards;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.3s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .35; }
    30% { transform: translateY(-7px); opacity: 1; }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(76,175,80,.6); }
    70% { box-shadow: 0 0 0 14px rgba(76,175,80,0); }
    100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

#menuPanel {
    padding: 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 0 0 2px 4px;
}

.menu-btn {
    border: 1.5px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 14px;
    background: white;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    transition: all .2s ease;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 1.3;
}

.menu-btn:hover {
    background: #f0fdf4;
    border-color: #43a047;
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(76,175,80,0.12);
}

.menu-btn .emoji { font-size: 18px; flex-shrink: 0; }

@media(max-width:600px) {
    #chatBox {
        bottom: 0; right: 0;
        width: 100%; height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
