/* --- FLOATING LAUNCHER TOGGLE BUTTON --- */
.chat-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: #108040a6;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(16, 128, 64, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    user-select: none;
}

.chat-launcher:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 128, 64, 0.5);
}


.chat-launcher:active {
    transform: scale(0.95);
}

.chat-launcher::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #108040;
    animation: pulseWave 2s infinite ease-out;
    top: 0;
    left: 0;
    opacity: 0.6;
    pointer-events: none;
}
/* --- LAUNCHER TOOLTIP EFFECTS --- */
.chat-launcher::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 80px; /* Positions it to the left of the button */
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #108040; /* Sleek dark slate background */
    color: #ffffff;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
}

 

/* Reveal tooltip elements on hover */
.chat-launcher:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Hide the tooltip entirely when the chat panel is open */
.chat-launcher.active::before,
.chat-launcher.active:hover::before,
.chat-launcher.active::after,
.chat-launcher.active:hover::after {
    display: none;
    opacity: 0;
}
@keyframes pulseWave {
    to { transform: scale(1.5); opacity: 0; }
}

/* --- CHAT CONTAINER FRAME --- */
.chat-container {
    position: fixed;
    bottom: 92px;
    right: 30px;
    width: 420px;
    max-width: 95%;
    height: 550px;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(16, 128, 64, 0.15);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    opacity: 0;
    transform: scale(0.85) translateY(40px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (max-width: 480px) {
.chat-container { 
    right: 20px;
    width: 420px;
	max-width: 90%;
	max-height: 80vh;
}
}

.chat-container.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.chat-launcher.active::after {
    display: none;
}
/* --- HEADER & AVATAR CONTAINER --- */
.chat-header {
    padding: 16px 20px;
    background: #108040;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.avatar-container {
    width: 60px;
    height: 60px;
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

/* Live SVG Avatar Styling & Keyframes */
.bot-avatar-svg {
    width: 100%;
    height: 100%;
    transform-origin: bottom center;
    animation: idleBreathe 3s ease-in-out infinite;
}

#avatar-head {
    transform-origin: 32px 38px;
    animation: headMove 6s ease-in-out infinite;
}

#avatar-eye-l, #avatar-eye-r {
    transform-origin: 24px 30px;
    animation: blink 4s infinite;
}
#avatar-eye-r { transform-origin: 40px 30px; }

#avatar-mouth {
    transform-origin: 32px 42px;
}

.speaking #avatar-mouth {
    animation: lipSync 0.25s infinite alternate;
}

.thinking #avatar-head {
    animation: headTiltThinking 2s ease-in-out infinite alternate;
}

@keyframes idleBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03) translateY(-1px); }
}

@keyframes headMove {
    0%, 100% { transform: rotate(0deg); }
    30% { transform: rotate(-3deg); }
    70% { transform: rotate(3deg); }
}

@keyframes headTiltThinking {
    0% { transform: rotate(-5deg) translateY(2px); }
    100% { transform: rotate(5deg) translateY(-1px); }
}

@keyframes blink {
    0%, 96%, 100% { transform: scaleY(1); }
    98% { transform: scaleY(0.1); }
}

@keyframes lipSync {
    0% { transform: scaleY(0.3) scaleX(0.8); }
    100% { transform: scaleY(1.3) scaleX(1.1); }
}

.bot-info {
    flex: 1;
}

.bot-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.status-badge {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    transition: all 0.3s;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.close-chat-btn {
    background: #ffffff2b;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background 0.2s;
    opacity: 0.8;
	padding-bottom: 13px;
}

.close-chat-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* --- CHAT AREA --- */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(16, 128, 64, 0.15);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 12px; 
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInSlide {
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}

.user .msg-bubble {
    background: #108040;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(16, 128, 64, 0.2);
}

.bot .msg-bubble {
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background-color: #108040;
    margin-left: 2px;
    animation: blink-cursor 0.7s infinite;
    vertical-align: middle;
}
@keyframes blink-cursor {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* --- STATE BASED ANIMATIONS & SYSTEM BOX --- */
.state-container {
    display: none;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    margin-left: 65px;
    margin-bottom: 10px;
    color: #475569;
}

/* 1. Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #108040;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

/* 2. Searching Spinner */
.search-ring {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(16, 128, 64, 0.2);
    border-top-color: #108040;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 3. Processing Radar Pulse */
.processing-pulse {
    width: 12px;
    height: 12px;
    background-color: #f59e0b;
    border-radius: 50%;
    position: relative;
}
.processing-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse 1.2s infinite ease-out;
    top: 0; left: 0;
}

/* 4. Success Indicator */
.success-icon {
    color: #10b981;
    font-weight: bold;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 5. Error Indicator */
.error-icon {
    color: #ef4444;
    font-weight: bold;
    animation: shake 0.4s ease-in-out;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { transform: scale(2.5); opacity: 0; } }
@keyframes scaleIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.msg-avatar-mini {
    min-width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid #e2e8f0;
}

/* --- FOOTER INPUT PANEL --- */
.chat-footer {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 14px;
    color: #1e293b;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.chat-input:focus {
    border-color: #499e6d30!important;
    background: #ffffff;
    box-shadow: 0px 0px 5px rgb(16 128 64 / 62%);
	outline:none
}

.send-btn {
    background: #108040;
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover,.send-btn:focus {
    background: #0c6331;
    transform: translateY(-1px);
}

.send-btn:active {
    transform: translateY(1px);
}