/* LEC IELTS Floating Chatbot Stylesheet */

/* FAB Button */
.lec-chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e31e24, #b91c1c);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(227, 30, 36, 0.4);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lec-chatbot-fab:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(227, 30, 36, 0.55);
}

.lec-chatbot-fab svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.lec-chatbot-fab.active svg {
    transform: rotate(90deg);
}

/* Chat Widget Container */
.lec-chatbot-container {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(227, 30, 36, 0.15);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lec-chatbot-container.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.lec-chatbot-container.minimized {
    height: 52px;
    overflow: hidden;
}

/* Header */
.lec-chatbot-header {
    background: linear-gradient(135deg, #e31e24, #b91c1c);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.lec-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lec-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lec-chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lec-chatbot-title-group {
    display: flex;
    flex-direction: column;
}

.lec-chatbot-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3px;
    font-family: 'DM Sans', Arial, sans-serif;
}

.lec-chatbot-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lec-chatbot-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

/* Header Controls */
.lec-chatbot-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lec-chatbot-btn-control {
    background: transparent;
    border: none;
    color: #ffffff;
    opacity: 0.8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lec-chatbot-btn-control:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.lec-chatbot-btn-control svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
}

/* Chat Messages Panel */
.lec-chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fdfefe;
}

/* Scrollbar styling */
.lec-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.lec-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.lec-chatbot-messages::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

/* Chat Bubbles */
.lec-chatbot-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.lec-chatbot-bubble-wrap.user {
    align-self: flex-end;
}

.lec-chatbot-bubble-wrap.bot {
    align-self: flex-start;
}

.lec-chatbot-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    font-family: Arial, sans-serif;
}

.lec-chatbot-bubble-wrap.user .lec-chatbot-bubble {
    background: #e31e24;
    color: #ffffff;
    border-top-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(227, 30, 36, 0.15);
}

.lec-chatbot-bubble-wrap.bot .lec-chatbot-bubble {
    background: #f1f5f9;
    color: #1e293b;
    border-top-left-radius: 2px;
    border: 1px solid #e2e8f0;
}

.lec-chatbot-time {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 4px;
    align-self: flex-end;
}

.lec-chatbot-bubble-wrap.bot .lec-chatbot-time {
    align-self: flex-start;
}

/* Suggestion Chips */
.lec-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: #fdfefe;
    border-top: 1px solid #f1f5f9;
}

.lec-chatbot-chip {
    background: #fdf5f6;
    color: #e31e24;
    border: 1px solid rgba(227, 30, 36, 0.2);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'DM Sans', Arial, sans-serif;
}

.lec-chatbot-chip:hover {
    background: #e31e24;
    color: #ffffff;
    border-color: #e31e24;
    transform: translateY(-1px);
}

/* Typing Indicator */
.lec-chatbot-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-radius: 14px;
    border-top-left-radius: 2px;
    border: 1px solid #e2e8f0;
    width: fit-content;
}

.lec-chatbot-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: lecDotBounce 1.4s infinite ease-in-out both;
}

.lec-chatbot-dot:nth-child(1) { animation-delay: -0.32s; }
.lec-chatbot-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes lecDotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Rate Limits Banner */
.lec-chatbot-limit-banner {
    background: #fef2f2;
    border-top: 1px solid #fee2e2;
    padding: 8px 16px;
    font-size: 11.5px;
    color: #ef4444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-family: Arial, sans-serif;
}

.lec-chatbot-counter {
    font-weight: 700;
}

/* Chat Input Bar */
.lec-chatbot-input-bar {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.lec-chatbot-textarea {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13.5px;
    resize: none;
    height: 36px;
    max-height: 80px;
    font-family: Arial, sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}

.lec-chatbot-textarea:focus {
    border-color: #e31e24;
}

.lec-chatbot-btn-send {
    background: #e31e24;
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(227, 30, 36, 0.2);
}

.lec-chatbot-btn-send:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.lec-chatbot-btn-send:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.lec-chatbot-btn-send svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* System Alerts / Error States */
.lec-chatbot-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    margin: 4px 0;
    text-align: center;
    width: 100%;
}

.lec-chatbot-alert.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.lec-chatbot-alert.warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .lec-chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
    
    /* Hide FAB on mobile when chat is open to avoid overlapping input controls */
    .lec-chatbot-fab.active {
        display: none !important;
    }
    
    .lec-chatbot-container {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100%;
        height: 100dvh;
        max-height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
    
    .lec-chatbot-container.open {
        transform: none;
    }
    
    .lec-chatbot-container.minimized {
        height: 52px;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100vw;
    }

    /* Horizontal scroll suggestion chips on mobile to save vertical space */
    .lec-chatbot-suggestions {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        padding: 8px 12px;
        gap: 8px;
    }
    
    .lec-chatbot-suggestions::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    .lec-chatbot-chip {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    /* Prevent mobile browser (iOS) zoom on focus by using 16px font-size */
    .lec-chatbot-textarea {
        font-size: 16px !important;
        height: 40px;
    }

    .lec-chatbot-input-bar {
        padding: 8px 12px;
    }
}

/* Link Styling inside Chat Bubbles */
.lec-chatbot-link {
    color: #e31e24;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.lec-chatbot-link:hover {
    color: #b91c1c;
}

