/* ===================================
   AI Chatbot Widget
   =================================== */

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1976d2, #00acc1);
    border: none;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 1.5rem;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(25, 118, 210, 0.6);
}

.chatbot-button i {
    transition: all 0.3s ease;
}

.chatbot-button.active i.fa-comments {
    display: none;
}

.chatbot-button.active i.fa-times {
    display: block;
}

.chatbot-button i.fa-times {
    display: none;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

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

.chatbot-header {
    background: linear-gradient(135deg, #1976d2, #00acc1);
    color: white;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #1976d2;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chatbot-title p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f5f9ff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

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

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

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

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

.message.bot {
    flex-direction: row;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #1976d2, #00acc1);
    color: white;
}

.message.user .message-avatar {
    background: #4caf50;
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: linear-gradient(135deg, #1976d2, #00acc1);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
    display: block;
}

.typing-indicator {
    display: none;
    gap: 0.75rem;
    padding: 1rem 0;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1976d2, #00acc1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.typing-dots {
    background: white;
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1976d2;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

.chatbot-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    padding: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.chatbot-input::placeholder {
    color: #999;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1976d2, #00acc1);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.4);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
    background: #f5f9ff;
}

.quick-action-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #1976d2;
    background: white;
    color: #1976d2;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: #1976d2;
    color: white;
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 15px;
        right: 15px;
    }

    .chatbot-button {
        width: 55px;
        height: 55px;
        font-size: 1.35rem;
    }

    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 140px);
        bottom: 75px;
        right: -7.5px;
    }

    .message-content {
        max-width: 85%;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: -20px;
        border-radius: 0;
    }

    .chatbot-header {
        padding: 1rem;
    }

    .quick-actions {
        padding: 0 0.75rem 0.75rem;
    }
}
