/* ============================================
   ENHANCED CHATBOT STYLES
   Impressive, Modern, Interactive
   ============================================ */

/* Chatbot Container */
/* ============================================
   ENHANCED CHATBOT STYLES
   Impressive, Modern, Interactive
   ============================================ */

   .chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.chatbot-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0F5CB8 100%);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(26, 77, 143, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.chatbot-btn::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--primary-blue);
    opacity: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.15); opacity: 0.3; }
}

.chatbot-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(26, 77, 143, 0.5);
    background: linear-gradient(135deg, #0F5CB8 0%, var(--primary-blue) 100%);
}

.chatbot-btn svg { width: 32px; height: 32px; stroke-width: 2.5; }

/* === THIS IS THE FIX FOR THE GIANT WINDOW === */
.chatbot-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;         
    height: 550px;        
    max-height: 70vh;     
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active { display: flex; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0F5CB8 100%);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0; /* Prevents header from shrinking */
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-header-text h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 2px;
    font-family: var(--font-primary);
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    opacity: 0.95;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.9); }
}

.chatbot-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* === PROPER SCROLLING FOR MESSAGES === */
.chatbot-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--gray-50);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.chatbot-messages::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.chat-message {
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 85%;
    word-wrap: break-word;
    animation: messageSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-message.bot {
    background: var(--white);
    color: var(--gray-800);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-200);
}

.chat-message.user {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0F5CB8 100%);
    color: var(--white);
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(26, 77, 143, 0.3);
}

.typing-indicator { display: inline-flex; gap: 4px; }
.typing-indicator::before,
.typing-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator::before { animation-delay: 0s; }
.typing-indicator::after { animation-delay: 0.2s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-10px); opacity: 1; }
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    animation: fadeIn 0.4s ease;
}

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

.quick-action-btn {
    padding: 10px 16px;
    background: var(--white);
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    box-shadow: 0 2px 6px rgba(26, 77, 143, 0.1);
}

.quick-action-btn:hover {
    background: var(--primary-blue);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 77, 143, 0.25);
}

.chatbot-input {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    background: var(--white);
    flex-shrink: 0; /* Prevents input area from shrinking */
}

.chatbot-input input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: 24px;
    font-size: 0.9375rem;
    font-family: var(--font-primary);
    transition: all 0.3s ease;
    outline: none;
}

.chatbot-input input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(26, 77, 143, 0.1);
}

.chatbot-input button {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0F5CB8 100%);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(26, 77, 143, 0.3);
}

.chatbot-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 77, 143, 0.4);
}

/* === FIXED RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    /* Anchors the window perfectly to the screen edges */
    .chatbot-window {
        position: fixed;
        bottom: 90px;
        left: 20px;
        right: 20px;
        width: auto; /* Replaces the calc() that was breaking it */
        height: 65vh;
        max-height: 500px;
    }
    
    .chatbot-container { 
        right: 20px; 
        bottom: 20px; 
    }
    
    .chatbot-btn { 
        width: 60px; 
        height: 60px; 
    }
    
    /* Shrinks the input area so the Send button stays on screen */
    .chatbot-input {
        padding: 12px;
        gap: 8px;
    }
    
    .chatbot-input input {
        padding: 12px 14px;
        font-size: 0.875rem;
    }
    
    .chatbot-input button {
        padding: 12px 18px;
        font-size: 0.875rem;
    }
    
    /* Shrink the header a tiny bit for small screens */
    .chatbot-header {
        padding: 16px;
    }
}