/* Chatbot Widget Styles */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 10000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle i {
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
}

.chatbot-toggle.open i.fa-comments {
    transform: scale(0);
    opacity: 0;
}

.chatbot-toggle.open i.fa-times {
    transform: scale(1);
    opacity: 1;
}

.chatbot-toggle i.fa-times {
    position: absolute;
    transform: scale(0);
    opacity: 0;
}

.chatbot-window {
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    position: absolute;
    bottom: 75px;
    right: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.chatbot-window.open {
    display: flex;
    animation: chatbotSlideIn 0.3s ease-out;
}

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

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    position: relative;
}

.chatbot-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-header p {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
}

.chatbot-messages {
    flex: 1;
    padding: 25px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #f1f3f4 100%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    position: relative;
}

.message.user::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 15px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #667eea;
}

.message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e8eaed;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.bot::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 15px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid white;
}

.message.bot.typing {
    background: #f0f0f0;
    color: #666;
    font-style: italic;
}

.chatbot-input {
    padding: 25px 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-input textarea {
    flex: 1;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    padding: 14px 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: all 0.3s ease;
    max-height: 120px;
    min-height: 48px;
    background: #fafbfc;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow-y: hidden;
}

.chatbot-input textarea:focus {
    border-color: #667eea;
    background: white;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-input textarea::placeholder {
    color: #a0a0a0;
    font-style: italic;
}

.send-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.send-button i {
    color: white;
    font-size: 16px;
}

.error-message {
    background: #fee;
    color: #d63384;
    border: 1px solid #f5c2c7;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    align-self: flex-start;
    max-width: 80%;
}

/* Add pulsing animation for initial attention */
.chatbot-toggle.pulse {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.4);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 140px);
        bottom: 75px;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        max-width: 380px;
        position: fixed !important;
        margin: 0 auto;
    }
    
    .chatbot-container {
        right: 20px;
        bottom: 90px;
    }
    
    .chatbot-messages {
        padding: 20px 15px;
        gap: 15px;
    }
    
    .message {
        max-width: 90%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .chatbot-input {
        padding: 20px 15px;
    }
    
    .chatbot-input textarea {
        padding: 12px 16px;
        border-radius: 20px;
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Move back-to-top button on mobile */
    body .back-to-top {
        right: 20px !important;
        bottom: 160px !important;
    }
}

/* Loading animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}