/* AI Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Admin Dashboard specific positioning */
.dashboard-body .chatbot-container {
    z-index: 999;
}

@media (max-width: 991.98px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }
}

.chatbot-widget {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-widget.chatbot-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.chatbot-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message-user {
    flex-direction: row-reverse;
}

.chatbot-message-content {
    max-width: 75%;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
}

.chatbot-message-bot .chatbot-message-content {
    background: white;
    color: #333;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-message-text {
    line-height: 1.5;
    font-size: 14px;
}

.chatbot-message-text a {
    color: #667eea;
    text-decoration: underline;
}

.chatbot-message-user .chatbot-message-text a {
    color: rgba(255, 255, 255, 0.9);
}

.chatbot-learning-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chatbot-warning-message {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    border-left: 4px solid #ef4444;
}

.chatbot-warning-message .chatbot-message-text {
    color: #991b1b;
}

.chatbot-input-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.chatbot-avatar-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chatbot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.chatbot-toggle-btn:active {
    transform: scale(0.95);
}

.chatbot-toggle-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-widget {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        right: 10px;
        bottom: 80px;
        overflow: hidden;
    }
    
    .chatbot-container {
        bottom: max(10px, env(safe-area-inset-bottom));
        right: max(10px, env(safe-area-inset-right));
    }
    
    .chatbot-toggle-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .chatbot-messages {
        padding: 1rem;
    }
    
    .chatbot-message-content {
        max-width: 85%;
    }
}

/* Very small mobile (320px - 374px) */
@media (max-width: 374px) {
    .chatbot-widget {
        width: calc(100vw - 10px);
        right: 5px;
        bottom: 70px;
    }
    
    .chatbot-container {
        bottom: 5px;
        right: 5px;
    }
    
    .chatbot-toggle-btn {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-messages {
        padding: 0.75rem;
    }
    
    .chatbot-input-container {
        padding: 12px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot-widget {
        background: #1e1e1e;
    }
    
    .chatbot-messages {
        background: #2d2d2d;
    }
    
    .chatbot-message-bot .chatbot-message-content {
        background: #3a3a3a;
        color: #e0e0e0;
    }
    
    .chatbot-input {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .chatbot-input-container {
        background: #1e1e1e;
        border-top-color: #404040;
    }
}
