/* Chatbot Styles */

/* Chat Container Styles */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.chat-header {
    text-align: center;
    margin-bottom: 2rem;
}

.chat-header h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.chat-header p {
    color: #7f8c8d;
    font-size: 1rem;
}

/* Chat Messages Container */
.chat-messages-container {
    height: 400px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background: #f8f9fa;
    margin-bottom: 1rem;
    width: 100%;
    min-width: 300px;
    max-width: 100%;
}

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

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

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

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styles */
.chat-message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.chat-message-user {
    align-items: flex-end;
    max-width: 80%;
    margin-left: auto;
}

.chat-message-bot {
    align-items: flex-start;
    max-width: 80%;
    margin-right: auto;
}

.chat-message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    max-width: 100%;
    word-wrap: break-word;
    position: relative;
}

.chat-message-bubble-user {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-bubble-bot {
    background: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 0.25rem;
}

.chat-message-bubble-kid-user {
    background: #28a745;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-bubble-teen-user {
    background: #17a2b8;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-bubble-adult-user {
    background: #6f42c1;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-bubble-teacher-user {
    background: #fd7e14;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
    text-align: center;
}

.chat-message-time-user {
    text-align: right;
}

.chat-message-time-bot {
    text-align: left;
}

/* Chat Input Styles */
.chat-input-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.chat-input:focus {
    border-color: #86b7fe;
    outline: 0;
}

.chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.15s ease-in-out;
}

.chat-send-btn:hover {
    background: #0056b3;
}

.chat-send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Chat Widget Styles */
.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget-header {
    background: #007bff;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chat-widget-close:hover {
    opacity: 0.8;
}

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.chat-widget-input-container {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    background: white;
}

.chat-widget-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.chat-widget-send-btn {
    width: 100%;
    padding: 0.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.chat-widget-send-btn:hover {
    background: #0056b3;
}

.chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 999;
    transition: transform 0.3s ease;
}

.chat-widget-button:hover {
    transform: scale(1.1);
}

/* Chat History Styles */
.chat-history-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.chat-history-header {
    text-align: center;
    margin-bottom: 2rem;
}

.chat-history-header h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.chat-history-list {
    list-style: none;
    padding: 0;
}

.chat-history-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.15s ease-in-out;
}

.chat-history-date {
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.5rem;
}

.chat-history-preview {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.chat-history-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
}

.chat-history-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }
    
    .chat-messages-container {
        height: 300px;
        width: 100%;
        min-width: 250px;
        max-width: 100%;
    }
    
    .chat-widget-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-widget-button {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .chat-message-user,
    .chat-message-bot {
        max-width: 90%;
    }
}

/* Loading Animation */
.chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.chat-loading-dots {
    display: flex;
    gap: 0.25rem;
}

.chat-loading-dot {
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    animation: chat-loading-bounce 1.4s ease-in-out infinite both;
}

.chat-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes chat-loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Typing Indicator */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.chat-typing-dots {
    display: flex;
    gap: 0.125rem;
}

.chat-typing-dot {
    width: 4px;
    height: 4px;
    background: #6c757d;
    border-radius: 50%;
    animation: chat-typing-bounce 1.4s ease-in-out infinite both;
}

.chat-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes chat-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}
