﻿/* AI Chatbot – Ujjwala | Navy/amber theme, Roboto (loaded by custom.css) */
/* CSS variables mirroring the main site palette */
:root { --chat-primary: #03457d; --chat-primary-dark: #042e5b; --chat-primary-light: #48668e; --chat-accent: #faa815; --chat-accent-dark: #c8860f; --chat-danger: #dc3545; --chat-success: #28a745; --chat-white: #ffffff; --chat-bg: #f0f4f8; --chat-border: #d0dcea; --chat-text: #080808; --chat-text-muted: #6c757d; --chat-shadow-sm: 0 2px 8px rgba(3, 46, 91, 0.12); --chat-shadow-md: 0 6px 24px rgba(3, 46, 91, 0.22); --chat-radius: 10px; --chat-radius-sm: 6px; --chat-radius-pill: 50px; }
/* Floating action button */
#ai-fab { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; background: linear-gradient(135deg, #03457d 0%, #042e5b 100%); color: var(--chat-white); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1050; box-shadow: 0 4px 16px rgba(250, 168, 21, 0.45); border: none; transition: transform 0.25s ease, box-shadow 0.25s ease; }
    #ai-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(250, 168, 21, 0.55); }
    #ai-fab:focus-visible { outline: 3px solid var(--chat-accent); outline-offset: 3px; }
/* Tooltip bubble above FAB */
.ai-tooltip { position: fixed; bottom: 92px; right: 24px; max-width: 230px; background: var(--chat-white); color: var(--chat-text); border: 1px solid var(--chat-border); border-left: 3px solid var(--chat-accent); border-radius: var(--chat-radius-sm); padding: 10px 14px; font-size: 13px; font-family: 'Roboto', sans-serif; box-shadow: var(--chat-shadow-sm); z-index: 1049; display: none; }
    .ai-tooltip::after { content: ""; position: absolute; bottom: -8px; right: 22px; border-width: 8px 8px 0; border-style: solid; border-color: var(--chat-white) transparent transparent transparent; }
    .ai-tooltip.show { display: block; animation: aiFadeIn 0.2s ease-out; }
@keyframes aiFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Main chat popup card */
.ai-chat-popup { position: fixed !important; bottom: 92px; right: 24px; width: 370px; height: 520px; display: none; z-index: 1050; border-radius: var(--chat-radius) !important; border: none !important; overflow: hidden; box-shadow: var(--chat-shadow-md); font-family: 'Roboto', sans-serif; animation: chatSlideUp 0.25s ease-out; }
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Header – same gradient used on .info-sec-title and .modal-head in custom.css */
.ai-chat-popup .card-header { background: linear-gradient(to bottom, #48668e 0%, #042e5b 100%); border-bottom: none; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; border-radius: 0 !important; }
    .ai-chat-popup .card-header > h3.card-title { color: var(--chat-white) !important; font-size: 15px; font-weight: 500; font-family: 'Roboto', sans-serif; margin: 0; display: flex; align-items: center; gap: 6px; letter-spacing: 0.2px; }
        /* Bot icon in header uses amber accent */
        .ai-chat-popup .card-header > h3.card-title i { color: var(--chat-accent); font-size: 17px; }
.ai-chat-popup .card-tools { display: flex; align-items: center; gap: 5px; }
/* Small square tool buttons in header */
.ai-chat-popup .card-header .btn-tool { width: 28px; height: 28px; border-radius: var(--chat-radius-sm); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding: 0; border: none; transition: filter 0.2s, transform 0.15s; cursor: pointer; }
    .ai-chat-popup .card-header .btn-tool:hover { filter: brightness(1.15); transform: scale(1.06); }
.ai-chat-popup .card-header .btn-success.btn-tool { background: var(--chat-success); color: var(--chat-white); }
.ai-chat-popup .card-header .btn-danger.btn-tool { background: var(--chat-danger); color: var(--chat-white); }
/* Message area with subtle line texture */
.ai-chat-popup .card-body.chat-messages { background: var(--chat-bg); background-image: repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(3, 69, 125, 0.03) 40px); padding: 14px 12px; overflow-y: auto; flex: 1; height: calc(520px - 53px - 72px); scroll-behavior: smooth; }
/* Message row */
.direct-chat-msg { margin-bottom: 10px; display: flex; animation: msgFadeIn 0.18s ease-out; }
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.direct-chat-text { border-radius: var(--chat-radius); padding: 9px 13px; max-width: 78%; word-wrap: break-word; font-size: 13.5px; line-height: 1.5; position: relative; }
/* User bubble – amber gradient matching site CTAs */
.direct-chat-msg.user { justify-content: flex-end; }
    .direct-chat-msg.user .direct-chat-text { background: linear-gradient(135deg, var(--chat-accent) 0%, var(--chat-accent-dark) 100%); color: var(--chat-primary-dark); border-bottom-right-radius: 3px; font-weight: 500; }
/* Bot bubble – white card with navy left border */
.direct-chat-msg.bot { justify-content: flex-start; }
    .direct-chat-msg.bot .direct-chat-text { background: var(--chat-white); border: 1px solid var(--chat-border); border-left: 3px solid var(--chat-primary); color: var(--chat-text); border-bottom-left-radius: 3px; box-shadow: var(--chat-shadow-sm); }
/* Animated typing dots */
.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 10px 13px; background: var(--chat-white); border: 1px solid var(--chat-border); border-left: 3px solid var(--chat-primary); border-radius: var(--chat-radius); border-bottom-left-radius: 3px; box-shadow: var(--chat-shadow-sm); width: fit-content; max-width: 70px; }
    .typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background-color: var(--chat-primary); animation: typingBounce 1.3s infinite ease-in-out both; display: inline-block; }
        .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
        .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
        .typing-indicator span:nth-child(3) { animation-delay: 0s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
/* Footer input area */
.ai-chat-popup .card-footer { background: var(--chat-white); border-top: 1px solid var(--chat-border); padding: 10px 12px; }
    /* Pill-shaped input wrapper */
    .ai-chat-popup .card-footer .input-group { border: 1.5px solid var(--chat-border); border-radius: var(--chat-radius-pill); overflow: hidden; background: var(--chat-bg); transition: border-color 0.2s, box-shadow 0.2s; }
        .ai-chat-popup .card-footer .input-group:focus-within { border-color: var(--chat-primary); box-shadow: 0 0 0 3px rgba(3, 69, 125, 0.12); }
#questionInput { background: transparent; border: none; padding: 8px 14px; font-size: 13.5px; font-family: 'Roboto', sans-serif; color: var(--chat-text); outline: none !important; box-shadow: none !important; flex: 1; }
    #questionInput::placeholder { color: var(--chat-text-muted); opacity: 1; }
/* Circular icon buttons inside the input pill */
.ai-chat-popup .card-footer .input-group-append { display: flex; align-items: center; gap: 2px; padding-right: 5px; }
    .ai-chat-popup .card-footer .input-group-append .btn { width: 32px; height: 32px; border-radius: 50%; border: none; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; padding: 0; transition: transform 0.15s, filter 0.15s; cursor: pointer; }
        .ai-chat-popup .card-footer .input-group-append .btn:hover { transform: scale(1.1); filter: brightness(1.1); }
/* Mic button – idle and active states */
#voiceInputBtn { background: #e8eef6; color: var(--chat-primary); }
    #voiceInputBtn:hover { background: #d0dcef; }
    #voiceInputBtn.listening { background: var(--chat-danger); color: var(--chat-white); animation: voicePulse 1.5s infinite; }
@keyframes voicePulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
/* Send button */
.ai-chat-popup .card-footer .btn-primary { background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%); color: var(--chat-white); }
/* Voice status and browser-not-supported indicators */
#voiceStatus,
#browserNotSupported { font-size: 12px; margin-top: 5px; }
    #voiceStatus small { color: var(--chat-danger); }
    #browserNotSupported small { color: var(--chat-accent-dark); }
/* Accessibility helpers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -40px; left: 0; background: var(--chat-primary); color: var(--chat-white); padding: 8px 14px; text-decoration: none; z-index: 100000; border-radius: 0 0 var(--chat-radius-sm) 0; }
    .skip-link:focus { top: 0; outline: 3px solid var(--chat-accent); outline-offset: 2px; }
button:focus-visible,
input:focus-visible { outline: 3px solid var(--chat-accent); outline-offset: 2px; }
/* Thin custom scrollbar */
.ai-chat-popup .chat-messages::-webkit-scrollbar { width: 5px; }
.ai-chat-popup .chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-popup .chat-messages::-webkit-scrollbar-thumb { background: var(--chat-border); border-radius: 10px; }
    .ai-chat-popup .chat-messages::-webkit-scrollbar-thumb:hover { background: var(--chat-primary-light); }
/* Mobile */
@media (max-width: 480px) {
    .ai-chat-popup { width: calc(100vw - 20px); right: 10px; bottom: 82px; height: 460px; }
    .btn { min-height: 40px; min-width: 40px; }
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .typing-indicator span,
    #voiceInputBtn.listening,
    .ai-chat-popup,
    .direct-chat-msg { animation: none; }
    * { transition-duration: 0.01ms !important; }
}
/* High contrast */
@media (prefers-contrast: high) {
    .direct-chat-msg.bot .direct-chat-text { border: 2px solid #000; }
}
