/**
 * AI Student Helper Chat Widget Styles
 */

/* Widget Container */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border: 1px solid #e1e8ed;
    overflow: hidden;
}

.ai-chat-widget.minimized .ai-chat-body {
    display: none;
}

/* Inline Chat */
.ai-chat-inline {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
    overflow: hidden;
    font-family: inherit;
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #5a75ea 0%, #3a57d5 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.ai-chat-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
	color: white;
}

.ai-chat-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.ai-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-chat-icon {
    font-size: 16px;
}

.ai-chat-close {
    display: none;
    font-size: 18px;
    font-weight: bold;
}

.ai-chat-widget.minimized .ai-chat-icon {
    display: none;
}

.ai-chat-widget.minimized .ai-chat-close {
    display: inline;
}

/* Body */
.ai-chat-body {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.ai-chat-inline .ai-chat-body {
    height: 500px;
}

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

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

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Individual Messages */
.ai-chat-message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
}

.ai-chat-message-content {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* User Messages */
.ai-chat-user-message {
    justify-content: flex-end;
}

.ai-chat-user-message .ai-chat-message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Bot Messages */
.ai-chat-bot-message {
    justify-content: flex-start;
}

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

/* Typing Indicator */
.ai-chat-typing {
    padding: 8px 16px;
    background: #f1f3f4;
    border-top: 1px solid #e1e8ed;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.ai-chat-typing span::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Input Container */
.ai-chat-input-container {
    border-top: 1px solid #e1e8ed;
    background: white;
}

.ai-chat-form {
    display: flex;
    padding: 12px;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: #667eea;
}

.ai-chat-send-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.ai-chat-send-btn:hover {
    background: #5a6fd8;
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Error Message */
.ai-chat-error {
    background: #fee;
    color: #c33;
    padding: 8px 12px;
    margin: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    border-left: 3px solid #c33;
}

/* Loading State */
.ai-chat-loading .ai-chat-message-content {
    background: #f1f3f4;
    color: #666;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-chat-widget {
        width: calc(100vw - 40px);
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .ai-chat-body {
        height: 350px;
    }
    
    .ai-chat-inline .ai-chat-body {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .ai-chat-widget {
        width: calc(100vw - 20px);
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .ai-chat-body {
        height: 300px;
    }
    
    .ai-chat-message-content {
        max-width: 90%;
        font-size: 13px;
    }
}

/* Animation for new messages */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message {
    animation: slideInUp 0.3s ease-out;
}

/* Focus states for accessibility */
.ai-chat-toggle:focus,
.ai-chat-input:focus,
.ai-chat-send-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-chat-widget,
    .ai-chat-inline {
        border: 2px solid #000;
    }
    
    .ai-chat-bot-message .ai-chat-message-content {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ai-chat-message {
        animation: none;
    }
    
    .ai-chat-typing span::after {
        animation: none;
        content: '...';
    }
}