/**
 * Kingston Engineering College – AI Assistant v2 Styles
 * Modern chatbot UI with smooth animations and responsive design
 */

/* ── Chat Messages Container ─────────────────────────────── */
.ai-chat-messages {
    flex: 1;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    background: #f7f9fc;
    scroll-behavior: smooth;
}

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

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

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

/* ── Message Groups ──────────────────────────────────────── */
.ai-message-group {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
    animation: aiMsgIn 0.3s ease-out forwards;
    opacity: 0;
}

.ai-message-group.animate {
    animation: aiMsgIn 0.3s ease-out forwards;
}

.ai-message-group.bot {
    align-self: flex-start;
}

.ai-message-group.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

/* ── Bot Avatar ──────────────────────────────────────────── */
.ai-bot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003366, #1a5490);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.ai-bot-avatar i {
    color: #fff;
    font-size: 0.75rem;
}

/* ── Message Bubbles ─────────────────────────────────────── */
.ai-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.65;
    max-width: 100%;
    word-break: break-word;
}

.ai-message-group.bot .ai-message-bubble {
    background: #ffffff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border: 1px solid #e8edf5;
}

.ai-message-group.user .ai-message-bubble {
    background: linear-gradient(135deg, #003366, #1a5490);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.25);
}

/* ── Bullet Points ───────────────────────────────────────── */
.ai-points {
    margin: 10px 0 4px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-points li {
    position: relative;
    padding-left: 16px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #2a2a3e;
}

.ai-points li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: #003366;
    font-weight: 900;
    font-size: 1.1em;
    line-height: 1.4;
}

/* ── Action Buttons ──────────────────────────────────────── */
.ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ai-btn {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-block;
    white-space: nowrap;
}

.ai-btn.primary {
    background: #003366;
    color: #ffffff;
}

.ai-btn.primary:hover {
    box-shadow: 0 4px 12px rgba(26, 84, 144, 0.25);
    transform: translateY(-1px);
}

.ai-btn.secondary {
    background: #e8eef8;
    color: #003366;
}

.ai-btn.secondary:hover {
    background: #d0ddf0;
    transform: translateY(-1px);
}

.ai-btn.outline {
    background: transparent;
    border: 1.5px solid #003366;
    color: #003366;
}

.ai-btn.outline:hover {
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
    border-color: #003366;
    transform: translateY(-1px);
}

/* ── Typing Indicator ────────────────────────────────────── */
.ai-typing-bubble {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 56px;
}

.ai-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a0aec0;
    animation: aiTypingBounce 1.2s infinite ease-in-out;
    display: inline-block;
}

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

@keyframes aiTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Status Indicator ────────────────────────────────────── */
.ai-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    opacity: 0.85;
}

.ai-status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: aiPulse 2s infinite;
}

@keyframes aiPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.3); opacity: 0.6; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .ai-message-group {
        max-width: 95%;
    }

    .ai-chat-messages {
        padding: 14px 12px;
        gap: 12px;
    }

    .ai-actions {
        flex-direction: column;
    }

    .ai-btn {
        width: 100%;
        text-align: center;
    }

    .ai-suggestions-row {
        gap: 6px;
    }

    .ai-suggestion-chip {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .ai-result-cards {
        gap: 6px;
    }
}

/* ── Suggestion Chips ────────────────────────────────────── */
.ai-suggestions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0 4px 44px; /* indent to align with bot bubble */
    animation: aiMsgIn 0.35s ease-out forwards;
    opacity: 0;
}

.ai-suggestions-row.animate {
    animation: aiMsgIn 0.4s ease-out 0.15s forwards;
    opacity: 0;
}

.ai-suggestion-chip {
    background: #fff;
    border: 1.5px solid #c5d3e8;
    color: #003366;
    border-radius: 20px;
    padding: 5px 13px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
    white-space: nowrap;
}

.ai-suggestion-chip:hover {
    background: #e8f0fb;
    border-color: #003366;
    transform: translateY(-1px);
}

/* ── Search Fallback Cards ───────────────────────────────── */
.ai-result-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.ai-result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f0f5ff;
    border: 1.5px solid #c5d3e8;
    border-radius: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.15s;
}

.ai-result-card:hover {
    background: #dce8ff;
    border-color: #003366;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,51,102,0.12);
    text-decoration: none;
    color: inherit;
}

.ai-result-card-inner {
    flex: 1;
    min-width: 0;
}

.ai-result-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #003366;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-result-card-desc {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-result-card-cat {
    font-size: 0.68rem;
    font-weight: 600;
    color: #0056b3;
    background: #d6e8ff;
    border-radius: 12px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
