/**
 * EduLoom AI Academic Counselor Chatbot Styles
 */

.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Trigger Button */
.chatbot-toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem 0.75rem 0.85rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-toggle-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.5);
    background: linear-gradient(135deg, #172554 0%, #1d4ed8 100%);
}

.chatbot-toggle-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.chatbot-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.online-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
    display: inline-block;
}

/* Pulsing Status Glow */
.chatbot-toggle-pulse {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.4);
    animation: chatbotPulse 2.5s infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes chatbotPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* Expandable Chat Window */
.chatbot-window {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(11, 19, 43, 0.22), 0 0 0 1px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #0b132b 0%, #172554 100%);
    color: #ffffff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.chatbot-header-title {
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.2;
    color: #ffffff;
}

.chatbot-header-status {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 2px;
}

.online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chatbot-btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.chatbot-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-msg {
    display: flex;
    gap: 0.65rem;
    max-width: 88%;
    animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-msg-content {
    display: flex;
    flex-direction: column;
}

.chat-msg-bubble {
    padding: 0.75rem 0.95rem;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.bot-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    border-top-left-radius: 4px;
}

.user-bubble {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

.chat-msg-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 3px;
    padding: 0 4px;
}

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

/* Suggestion Chips */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.chatbot-chip {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-family: inherit;
    text-align: left;
}

.chatbot-chip:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1e3a8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
}

/* Miniature Tables in Chat */
.chat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin: 0.4rem 0;
    background: #f8fafc;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.chat-table th {
    background: #eff6ff;
    color: #1e40af;
    padding: 0.4rem 0.5rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 1px solid #cbd5e1;
}

.chat-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

/* Typing Indicator */
.chatbot-typing {
    padding: 0.5rem 1.1rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.typing-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.4rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingPulse 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Quick CTA Strip */
.chatbot-quick-cta {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    padding: 0.45rem 1rem;
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-quick-cta button {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* Input Form */
.chatbot-input-form {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    color: #0b132b;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #2563eb;
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.15s;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 82px; /* Positioned above mobile sticky bar */
        right: 14px;
    }
    .chatbot-toggle-label {
        display: none; /* Icon-only floating bubble on mobile */
    }
    .chatbot-toggle-btn {
        padding: 0.65rem;
        border-radius: 50%;
    }
    .chatbot-window {
        width: calc(100vw - 28px);
        height: 480px;
        right: 0;
        bottom: calc(100% + 10px);
    }
}
