/* Chatbot Feedback Styles */
.chat-feedback {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 13px;
}

.feedback-text {
    margin-bottom: 5px;
    color: #666;
}

.feedback-btn {
    margin-right: 5px;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px; /* spacing between icon and text */
}

/* Move icons up slightly */
.feedback-btn i,
.feedback-btn svg {
    position: relative;
    top: -2px; /* adjust this for higher/lower */
}

/* Teaching interface */
.teaching-interface {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.teaching-interface .form-control-sm {
    font-size: 13px;
    padding: 4px 8px;
    height: auto;
}

.teaching-interface .btn-sm {
    padding: 2px 10px;
    font-size: 12px;
}

/* Typing indicator */
.typing {
    display: inline-block;
    padding: 8px 0;
}

.typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    margin: 0 2px;
    opacity: 0.4;
}

.typing span:nth-child(1) {
    animation: typing 1s infinite;
}

.typing span:nth-child(2) {
    animation: typing 1s 0.2s infinite;
}

.typing span:nth-child(3) {
    animation: typing 1s 0.4s infinite;
}

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

/* Message styles */
.message {
    margin-bottom: 15px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message-content {
    padding: 10px 15px;
    border-radius: 18px;
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
}

.user-message {
    margin-left: auto;
}

.user-message .message-content {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    margin-right: auto;
}

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

.bot-message .message-text a.chat-link {
    color: #007bff;
}

.bot-message .message-text a.chat-link:hover {
    color: #0056b3;
    background-color: rgba(0, 123, 255, 0.1);
}

.message-sender {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 3px;
    opacity: 0.8;
}

.user-message .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.bot-message .message-sender {
    color: #6c757d;
}

.message-text {
    line-height: 1.4;
}

.message-text em {
    font-style: italic;
}

.message-text a {
    color: #007bff;
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-text a.chat-link {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.message-text a.chat-link:hover {
    color: #004499;
    text-decoration: none;
    background-color: rgba(0, 102, 204, 0.1);
    
    border-radius: 3px;
}

.message-text a.chat-link:active {
    color: #003366;
}

.message-timestamp {
    font-size: 10px;
    color: #6c757d;
    margin-top: 4px;
    text-align: right;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    outline: none;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.quick-reply-btn:active {
    transform: translateY(0);
}

/* Chat Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 100px; /* Position above WhatsApp icon */
    right: 20px;
    z-index: 9998;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #3b3b6b;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
    
.chatbot-toggle:hover {
    transform: scale(1.05);
}
    
/* Chat Container */
.chatbot-container {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 30px;
    z-index: 9999;
    width: 380px;
    max-width: 90vw;
    height: 65vh;
    min-height: 400px;
    max-height: 700px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    transform: translateZ(0);
}
    
.chatbot-container.visible {
    opacity: 1;
    visibility: visible;
    display: flex;
}
    
/* Chat Header */
.chatbot-header {
    background: #3b3b6b;
    color: #fff;
    padding: 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
    
.header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}
    
.chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
    
.header-text {
    line-height: 1.2;
}
    
.chatbot-title {
    font-weight: 600;
    font-size: 15px;
}
    
.chatbot-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}
    
.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    padding: 4px;
    line-height: 1;
    transition: opacity 0.2s;
}
    
.chatbot-close:hover {
    opacity: 1;
}
    
/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
    
/* Chat Input */
.chatbot-input-container {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}
    
.input-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}
    
.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
    
.chatbot-input:focus {
    border-color: #3b3b6b;
}
    
.chatbot-send-btn {
    background: #3b3b6b;
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}
    
.chatbot-send-btn:hover {
    background: #1ebe57;
}
    
.chatbot-send-btn:active {
    transform: scale(0.95);
}

.message {
    max-width: 80%;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease-out;
}

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

.message-content {
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #666;
}

.message-text {
    font-size: 14px;
}

.user-message {
    margin-left: auto;
}

.user-message .message-content {
    background: #3b3b6b;
    color: white;
    border-top-right-radius: 4px;
}

.user-message .message-sender {
    color: rgba(255, 255, 255, 0.8);
}

.bot-message {
    margin-right: auto;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator {
    display: flex;
    align-items: center;
    height: 20px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.5s infinite ease-in-out;
}

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

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

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

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

#chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.error .message-content {
    background: #ffebee;
    color: #c62828;
}

@media (max-width: 480px) {
    #chatbot-box {
        right: 5%;
        bottom: 80px;
        width: 90%;
        height: 70vh;
        min-height: 300px;
    }
    
    .message {
        max-width: 90%;
    }
}
