/* ==========================================================================
   Obsidian Glassmorphism Chatbot Widget Stylesheet
   ========================================================================== */

/* Variables and Transitions */
:root {
    --wamb-bg-dark: rgba(15, 23, 42, 0.85); /* Slate 900 with opacity */
    --wamb-bg-card: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --wamb-accent: #10b981; /* Neon Emerald */
    --wamb-accent-hover: #059669;
    --wamb-accent-glow: rgba(16, 185, 129, 0.3);
    --wamb-text-main: #f8fafc;
    --wamb-text-muted: #94a3b8;
    --wamb-border: rgba(255, 255, 255, 0.08);
    --wamb-border-glow: rgba(16, 185, 129, 0.25);
    --wamb-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --wamb-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Chatbot Floating Trigger Button */
.wamb-chat-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #047857);
    box-shadow: 0 4px 20px var(--wamb-accent-glow), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 999999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    outline: none;
}

.wamb-chat-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
}

.wamb-chat-trigger svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    transition: transform 0.3s ease;
}

.wamb-chat-trigger.active svg {
    transform: rotate(90deg);
}

/* Pulsing Notification Dot on Trigger */
.wamb-chat-trigger::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: wamb-pulse 2s infinite;
}

@keyframes wamb-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Chat Widget Main Window */
.wamb-chat-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    border-radius: 20px;
    background: var(--wamb-bg-dark);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--wamb-border);
    box-shadow: var(--wamb-glass-shadow);
    display: flex;
    flex-direction: column;
    z-index: 999998;
    overflow: hidden;
    font-family: var(--wamb-font);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.wamb-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    border-color: var(--wamb-border-glow);
}

/* Header Section */
.wamb-chat-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid var(--wamb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.wamb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wamb-avatar svg {
    width: 20px;
    height: 20px;
    fill: var(--wamb-accent);
}

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

.wamb-chat-title {
    color: var(--wamb-text-main);
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.wamb-chat-status {
    color: var(--wamb-text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.wamb-status-dot {
    width: 7px;
    height: 7px;
    background-color: var(--wamb-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--wamb-accent);
    animation: wamb-blink 1.5s infinite;
}

@keyframes wamb-blink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.wamb-close-btn {
    background: transparent;
    border: none;
    color: var(--wamb-text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.wamb-close-btn:hover {
    color: #ef4444;
    background: rgba(255, 255, 255, 0.05);
}

/* Chat Body (Message Container) */
.wamb-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Body */
.wamb-chat-body::-webkit-scrollbar {
    width: 5px;
}

.wamb-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.wamb-chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.wamb-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages styling */
.wamb-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: wamb-message-in 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    white-space: pre-wrap; /* Preserve linebreaks */
}

@keyframes wamb-message-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot Message */
.wamb-message.bot {
    align-self: flex-start;
    background: var(--wamb-bg-card);
    color: var(--wamb-text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--wamb-border);
}

/* User Message */
.wamb-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

/* Typing Indicator */
.wamb-typing-indicator {
    align-self: flex-start;
    background: var(--wamb-bg-card);
    border: 1px solid var(--wamb-border);
    padding: 12px 20px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wamb-typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--wamb-accent);
    border-radius: 50%;
    animation: wamb-bounce 1.4s infinite ease-in-out both;
}

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

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

/* Interactive Options Area (Dynamic Menu Buttons) */
.wamb-options-container {
    padding: 0 20px 15px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: transparent;
}

.wamb-option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--wamb-text-main);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.wamb-option-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--wamb-accent);
    color: var(--wamb-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.1);
}

.wamb-option-btn.nav-back {
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.wamb-option-btn.nav-back:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.wamb-option-btn.nav-exit {
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.wamb-option-btn.nav-exit:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.wamb-option-trigger {
    background: var(--wamb-accent);
    color: #0f172a;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
}

.wamb-option-btn.nav-back .wamb-option-trigger {
    background: #f59e0b;
}

.wamb-option-btn.nav-exit .wamb-option-trigger {
    background: #ef4444;
}

/* Chat Footer (Input Area) */
.wamb-chat-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--wamb-border);
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.5);
}

.wamb-input-wrapper {
    flex: 1;
    position: relative;
}

.wamb-chat-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--wamb-border);
    border-radius: 24px;
    padding: 11px 18px;
    color: var(--wamb-text-main);
    font-size: 13.5px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.wamb-chat-input:focus {
    border-color: var(--wamb-accent);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.wamb-chat-input::placeholder {
    color: var(--wamb-text-muted);
}

.wamb-send-btn {
    background: var(--wamb-accent);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--wamb-accent-glow);
    padding: 0;
    align-self: center;
}

.wamb-send-btn:hover {
    background: var(--wamb-accent-hover);
    transform: scale(1.05);
}

.wamb-send-btn svg {
    width: 16px;
    height: 16px;
    fill: #0f172a;
    margin-left: 2px;
}

/* Mobile Responsiveness styling */
@media screen and (max-width: 480px) {
    .wamb-chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        right: 15px;
        bottom: 85px;
    }
    
    .wamb-chat-trigger {
        right: 15px;
        bottom: 15px;
        width: 54px;
        height: 54px;
    }
}

.wamb-reset-btn:hover {
    color: #f59e0b !important;
    background: rgba(255, 255, 255, 0.08) !important;
    transform: scale(1.08);
}
