/* =======================================================
   LWD MODERN CHATBOT STYLES - PREMIUM GLASSMORPHISM THEME
   ======================================================= */

:root {
    --chat-width: 380px;
    --chat-height: 580px;
    --chat-bg: rgba(255, 255, 255, 0.85);
    --bot-msg-bg: rgba(241, 245, 249, 0.9);
    --user-msg-bg: linear-gradient(135deg, #00509d, #00296b);
    --user-msg-text: #ffffff;
    --primary-blue: #00509d;
    --secondary-blue: #00296b;
    --accent-cyan: #00b4d8;
    --border-light: rgba(0, 80, 157, 0.15);
    --shadow-premium: 0 20px 40px rgba(0, 41, 107, 0.15);
}

/* --- Floating Chat Bubble --- */
#chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-cyan));
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(0, 80, 157, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#chat-bubble:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 80, 157, 0.45);
}

.bubble-icon-bg {
    font-size: 24px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#chat-bubble:hover .bubble-icon-bg {
    transform: rotate(5deg) scale(1.05);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    opacity: 0;
    animation: pulse 2s infinite;
    pointer-events: none;
}

/* --- Chat Window --- */
#chat-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: var(--chat-width);
    height: var(--chat-height);
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    display: none; /* Controlled by .active class */
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
}

#chat-window.active {
    display: flex;
}

/* --- Header --- */
.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.bot-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    background: white;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.online-indicator {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.bot-info {
    display: flex;
    flex-direction: column;
}

.bot-info .bot-name {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
    margin: 0;
}

.bot-info .bot-status {
    font-size: 0.72rem;
    opacity: 0.85;
    margin: 2px 0 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* --- Chat Body --- */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(248, 250, 252, 0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 80, 157, 0.2) transparent;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 80, 157, 0.2);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 80, 157, 0.4);
}

/* --- Messages --- */
.msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
    box-shadow: 0 2px 6px rgba(0, 41, 107, 0.03);
    animation: msgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.msg.bot {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 80, 157, 0.05);
}

.msg.user {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 80, 157, 0.15);
}

/* --- Suggestions --- */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    align-self: flex-start;
    width: 100%;
}

.suggestions button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-light);
    color: var(--primary-blue);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.suggestions button:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 80, 157, 0.2);
}

/* --- Footer --- */
.chat-footer {
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 80, 157, 0.08);
}

.input-container {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 4px 6px 4px 16px;
    transition: all 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 80, 157, 0.12);
    background: white;
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding: 8px 0;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
    color: #1e293b;
    line-height: 1.4;
}

#chat-input::placeholder {
    color: #94a3b8;
}

.send-btn {
    width: 36px;
    height: 36px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 80, 157, 0.2);
}

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

.typing {
    font-size: 0.76rem;
    color: #64748b;
    margin-bottom: 4px;
    font-style: italic;
    align-self: flex-start;
    animation: pulseText 1.5s infinite ease-in-out;
}

/* --- Animations --- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Quick Actions (Legacy compatibility) --- */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-actions button {
    background: #ffffff;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-actions button:hover {
    background: var(--primary-blue);
    color: white;
}

/* --- Interactive Chat Cards --- */
.chat-card {
    background: #ffffff;
    border: 1px solid rgba(0, 80, 157, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.chat-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary-blue);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-card-detail {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.chat-card-detail strong {
    color: var(--secondary-blue);
}

.chat-card-divider {
    border-top: 1px dashed rgba(0, 80, 157, 0.1);
    margin: 8px 0;
}

.chat-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 180, 216, 0.1);
    color: #0077b6;
    text-transform: uppercase;
}

.chat-btn-link {
    display: inline-block;
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-cyan));
    color: white !important;
    padding: 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 8px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.chat-btn-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.3);
}

/* --- Responsive Adjustments --- */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100% - 40px);
        height: 60vh;
        bottom: 95px;
        right: 20px;
        left: 20px;
        border-radius: 20px;
    }
    
    #chat-bubble {
        bottom: 20px;
        right: 20px;
    }
}