/**
 * SucceedLearn Chatbot Styles
 * Responsive and accessible chat widget styling
 */

/* Chat Widget Container */
.succeedlearn-chatbot-widget {
    position: fixed;
    bottom: 90px; /* Positioned above WhatsApp icon */
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Chat Toggle Button (Icon) */
.succeedlearn-chatbot-toggle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    border: none;
}

.succeedlearn-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.succeedlearn-chatbot-toggle:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 3px;
}

.succeedlearn-chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* Chat Window */
.succeedlearn-chatbot-window {
    position: absolute;
    bottom: 84px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.succeedlearn-chatbot-window.active {
    display: flex;
}

/* Chat Header */
.succeedlearn-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.succeedlearn-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.succeedlearn-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    line-height: 1;
}

.succeedlearn-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.succeedlearn-chatbot-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Messages Area */
.succeedlearn-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* Scrollbar Styling */
.succeedlearn-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.succeedlearn-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.succeedlearn-chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.succeedlearn-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Bubbles */
.succeedlearn-chatbot-message {
    display: flex;
    margin-bottom: 4px;
    animation: fadeInMessage 0.3s ease;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    box-sizing: border-box;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: #ffffff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

/* Quick Questions */
.succeedlearn-chatbot-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.quick-question-btn {
    padding: 8px 14px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    font-size: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.quick-question-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.quick-question-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.quick-question-btn:active {
    transform: translateY(0);
}

/* Hide quick questions when chat has messages */
.succeedlearn-chatbot-messages:not(:empty) ~ .succeedlearn-chatbot-quick-questions {
    display: none;
}

/* Input Area */
.succeedlearn-chatbot-input-area {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    gap: 10px;
    flex-shrink: 0;
}

.succeedlearn-chatbot-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.succeedlearn-chatbot-input:focus {
    border-color: #667eea;
}

.succeedlearn-chatbot-input::placeholder {
    color: #adb5bd;
}

.succeedlearn-chatbot-send {
    width: 44px;
    height: 44px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.succeedlearn-chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.succeedlearn-chatbot-send:active {
    transform: scale(0.95);
}

.succeedlearn-chatbot-send:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.succeedlearn-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.succeedlearn-chatbot-send svg {
    width: 20px;
    height: 20px;
}

/* Loading Indicator */
.succeedlearn-chatbot-loading {
    display: flex;
    justify-content: flex-start;
    padding: 12px 16px;
}

.succeedlearn-chatbot-loading-dots {
    display: flex;
    gap: 6px;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.succeedlearn-chatbot-loading-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.succeedlearn-chatbot-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.succeedlearn-chatbot-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .succeedlearn-chatbot-widget {
        bottom: 85px; /* Positioned above WhatsApp icon on mobile */
        right: 15px;
    }
    
    .succeedlearn-chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        bottom: 79px;
        border-radius: 12px;
    }
    
    .succeedlearn-chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .succeedlearn-chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .quick-question-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .succeedlearn-chatbot-header {
        padding: 16px 18px;
    }
    
    .succeedlearn-chatbot-header h3 {
        font-size: 16px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .succeedlearn-chatbot-window,
    .succeedlearn-chatbot-message,
    .succeedlearn-chatbot-toggle,
    .succeedlearn-chatbot-send,
    .quick-question-btn {
        animation: none;
        transition: none;
    }
}

/* Print Styles - Hide chatbot when printing */
@media print {
    .succeedlearn-chatbot-widget {
        display: none !important;
    }
}
