/* ============================================
   AI Chatbot Widget - Base Styles
   ============================================ */

.unlockafe-ai-chatbot-wrapper {
    width: 100%;
}

.unlockafe-ai-chatbot-container {
    width: 100%;
    height: 500px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.unlockafe-ai-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.unlockafe-ai-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.unlockafe-ai-chatbot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.unlockafe-ai-chatbot-icon-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.unlockafe-ai-chatbot-title {
    font-size: 18px;
    font-weight: 600;
}

/* Messages Area */
.unlockafe-ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f9fafb;
}

.unlockafe-ai-chatbot-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
    margin-bottom: 12px !important;
    margin-top: 0 !important;
    clear: both;
    display: flex !important;
    flex-direction: column;
    position: relative;
    min-height: auto;
}

.unlockafe-ai-chatbot-message.user {
    align-self: flex-end !important;
    border-bottom-right-radius: 4px;
    margin-left: auto !important;
    margin-right: 0 !important;
}

.unlockafe-ai-chatbot-message.ai {
    align-self: flex-start !important;
    border-bottom-left-radius: 4px;
    margin-left: 0 !important;
    margin-right: auto !important;
}

.unlockafe-ai-chatbot-message.welcome {
    align-self: center;
    text-align: center;
    max-width: 90%;
    background: #e0e7ff;
    color: #4338ca;
}

.unlockafe-ai-chatbot-message-content {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.unlockafe-ai-chatbot-message-content p {
    margin: 0 0 8px 0;
}

.unlockafe-ai-chatbot-message-content p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.unlockafe-ai-chatbot-typing {
    padding: 0 20px 10px;
    flex-shrink: 0;
}

.unlockafe-ai-chatbot-typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.unlockafe-ai-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingDot 1.4s infinite ease-in-out;
}

.unlockafe-ai-chatbot-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.unlockafe-ai-chatbot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.unlockafe-ai-chatbot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Area */
.unlockafe-ai-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.unlockafe-ai-chatbot-input {
    flex: 1;
    outline: none;
    transition: all 0.3s ease;
}

.unlockafe-ai-chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.unlockafe-ai-chatbot-send-button {
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.unlockafe-ai-chatbot-send-button:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.unlockafe-ai-chatbot-send-button:active {
    transform: scale(0.95);
}

.unlockafe-ai-chatbot-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.unlockafe-ai-chatbot-send-button i {
    font-size: 16px;
}

/* Scrollbar Styling */
.unlockafe-ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.unlockafe-ai-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.unlockafe-ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.unlockafe-ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Error Message */
.unlockafe-ai-chatbot-error {
    background: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 13px;
    border: 1px solid #fcc;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .unlockafe-ai-chatbot-container {
        height: 400px;
    }

    .unlockafe-ai-chatbot-message {
        max-width: 85%;
    }

    .unlockafe-ai-chatbot-header {
        padding: 16px;
    }

    .unlockafe-ai-chatbot-messages {
        padding: 16px;
    }

    .unlockafe-ai-chatbot-input-area {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .unlockafe-ai-chatbot-container {
        height: 350px;
    }

    .unlockafe-ai-chatbot-message {
        max-width: 90%;
        padding: 10px 14px;
    }

    .unlockafe-ai-chatbot-message-content {
        font-size: 13px;
    }
}
