/* Junie AI chat widget — copied from Ezyshare/AI Junie/AiJunie.html (demo-page styles dropped).
 * Fonts switched to the site's Inter; extra rules at the end adapt it to this site. */

.chatbot-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 9999;
}

.speech {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(223, 233, 248, 0.95);
    border-radius: 18px;
    padding: 11px 15px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 18px rgba(17, 46, 100, 0.13);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    animation: junieBounceIn 0.4s ease;
}

.speech:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(17, 46, 100, 0.2);
}

.speech:after {
    content: "";
    position: absolute;
    bottom: -9px;
    right: 26px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.92);
    border-right: 1px solid rgba(223, 233, 248, 0.95);
    border-bottom: 1px solid rgba(223, 233, 248, 0.95);
    transform: rotate(45deg);
}

.speech .hi {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 3px;
    color: #1c2f50;
    font-family: "Inter", system-ui, sans-serif;
}

.speech .txt {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    line-height: 1.3;
    font-family: "Inter", system-ui, sans-serif;
}

.junie-mascot {
    animation: floaty 4s ease-in-out infinite;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.junie-mascot:hover {
    transform: scale(1.06);
}

.junie-mascot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

@keyframes floaty {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }

    100% {
        transform: translateY(0px);
    }
}

.chat-widget {
    display: none;
    position: fixed;
    bottom: 120px;
    right: 24px;
    width: min(380px, calc(100vw - 48px));
    height: 435px;
    max-height: min(560px, calc(100vh - 160px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(17, 46, 100, 0.18);
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    font-family: "Inter", system-ui, sans-serif;
    animation: junieBounceIn 0.25s ease;
}

.chat-widget.open {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #22c55e 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    flex-shrink: 0;
}

.chat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.85;
    transition: opacity 0.1s;
}

.chat-header button:hover {
    opacity: 1;
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    background: #f7fbff;
}

.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

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

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-bubble {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.84rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg.bot .msg-bubble {
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
    background: #4f46e5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: junieDot 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.chat-footer {
    border-top: 1px solid #e5e7eb;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #6366f1;
    background: #fff;
    color: #4f46e5;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.quick-btn:hover {
    background: #4f46e5;
    color: #fff;
}

.chat-input-wrap {
    display: flex;
    gap: 6px;
}

#chatInput {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.84rem;
    outline: none;
    font-family: inherit;
}

#chatInput:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.send-button {
    flex-shrink: 0;
    padding: 9px 16px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.84rem;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    font-weight: 600;
}

.send-button:hover {
    background: #4338ca;
}

.chat-service-type-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chat-service-type-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid #6366f1;
    background: #fff;
    color: #4f46e5;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
}

.chat-service-type-btn:hover {
    background: #4f46e5;
    color: #fff;
}

.chat-slot-btn {
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #22c55e;
    background: #fff;
    color: #16a34a;
    font-size: 0.76rem;
    cursor: pointer;
    margin: 2px;
    font-family: inherit;
}

.chat-slot-btn:hover {
    background: #22c55e;
    color: #fff;
}

.chat-slot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-reply-p {
    margin: 0 0 4px;
    font-size: 0.82rem;
}

@keyframes junieBounceIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes junieDot {
    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 108px;
    }

    .chatbot-float {
        right: 12px;
    }
}

/* ---------- NSI Academy additions ---------- */

/* Speech bubble and mascot are <button>s here (keyboard accessible): clear button defaults */
.chatbot-float button {
    font: inherit;
    text-align: left;
    padding: 0;
    border: 0;
    background: none;
}

.chatbot-float .speech {
    padding: 11px 15px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(223, 233, 248, 0.95);
}

/* Tailwind's reset strips list bullets and link colours; restore them inside AI replies */
.msg-bubble ul {
    list-style: disc;
    padding-left: 1.2em;
}

.msg-bubble ol {
    list-style: decimal;
    padding-left: 1.2em;
}

.msg-bubble a {
    color: #4f46e5;
    text-decoration: underline;
}

.chat-msg.user .msg-bubble a {
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .junie-mascot,
    .speech,
    .chat-widget {
        animation: none;
    }
}
