/* AmalXM AI Chatbot Styles */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    height: 550px;
    max-height: 80vh;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(43, 199, 180, 0.2);
    z-index: 9999 !important;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #2BC7B4 0%, #1ea085 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

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

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    animation: pulse 2s infinite;
}

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

.chatbot-info h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

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

.chatbot-clear,
.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.chatbot-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ff6b6b;
    transform: scale(1.1);
}

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

/* Messages Container */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 0px;
    display: none;
}

.chatbot-messages::-webkit-scrollbar-track {
    display: none;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    display: none;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.4s ease-out;
}

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

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

.bot-message .message-avatar {
    background: linear-gradient(135deg, #2BC7B4, #1ea085);
    color: white;
}

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

.user-message .message-avatar {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
}

.message-content {
    max-width: 260px;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.bot-message .message-content {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #334155;
    border-bottom-left-radius: 6px;
}

.user-message .message-content {
    background: linear-gradient(135deg, #2BC7B4, #1ea085);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

/* Chatbot Link Styles */
.chatbot-link {
    color: #2BC7B4;
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.3s ease;
}

.chatbot-link:hover {
    color: #1ea085;
    text-decoration: none;
    background-color: rgba(43, 199, 180, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.bot-message .chatbot-link {
    color: #2BC7B4;
}

.user-message .chatbot-link {
    color: #ffffff;
    text-decoration: underline;
}

.user-message .chatbot-link:hover {
    color: #f0f9ff;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

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

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

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

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

/* Input Container */
.chatbot-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    border-radius: 25px;
    padding: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: #2BC7B4;
    background: white;
    box-shadow: 0 0 0 4px rgba(43, 199, 180, 0.1);
}

#chatbotInput {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    color: #334155;
}

#chatbotInput::placeholder {
    color: #94a3b8;
}

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

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(43, 199, 180, 0.3);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* Suggestions */
.chatbot-suggestions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.suggestion-btn {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.suggestion-btn:hover {
    background: linear-gradient(135deg, #2BC7B4, #1ea085);
    color: white;
    border-color: #2BC7B4;
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 60px);
        height: calc(100vh - 140px);
        right: 10px;
        bottom: 70px;
        border-radius: 12px;
        max-height: 500px;
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-header h4 {
        font-size: 16px;
    }
    
    .chatbot-status {
        font-size: 11px;
    }
    
    .chatbot-avatar {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 12px;
        gap: 12px;
    }
    
    .chatbot-input-container {
        padding: 12px;
    }
    
    .message-content {
        max-width: calc(100vw - 140px);
        padding: 10px 12px;
        font-size: 13px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .chatbot-input-wrapper {
        padding: 6px;
    }
    
    #chatbotInput {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .chatbot-send-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .suggestion-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        right: 8px;
        bottom: 60px;
        border-radius: 10px;
        max-height: 450px;
    }
    
    .chatbot-header {
        padding: 10px 12px;
    }
    
    .chatbot-header h4 {
        font-size: 15px;
    }
    
    .chatbot-avatar {
        width: 32px;
        height: 32px;
        font-size: 15px;
    }
    
    .chatbot-messages {
        padding: 10px;
        gap: 10px;
    }
    
    .chatbot-input-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: calc(100vw - 120px);
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
    
    #chatbotInput {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .chatbot-send-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .suggestion-btn {
        padding: 5px 8px;
        font-size: 10px;
        margin: 2px;
    }
}

/* Loading Animation */
.chatbot-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2BC7B4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message i {
    color: #ef4444;
}

/* Success Animation */
.message-sent {
    animation: messageSent 0.3s ease-out;
}

@keyframes messageSent {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Chatbot Widget Enhancement */
.chatbot-widget {
    position: relative;
    overflow: hidden;
}

.chatbot-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.chatbot-widget:hover::before {
    transform: translateX(100%);
}

/* Notification Badge */
.chatbot-widget::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}
