:root {
    --navibot-primary: #0b2d63;
    --navibot-primary-soft: #194b96;
    --navibot-accent: #6dc7ff;
    --navibot-surface: rgba(255, 255, 255, 0.92);
    --navibot-surface-strong: #ffffff;
    --navibot-text: #14233c;
    --navibot-text-soft: #62718b;
    --navibot-border: rgba(11, 45, 99, 0.12);
    --navibot-shadow: 0 24px 50px rgba(8, 22, 48, 0.24);
    --navibot-radius: 24px;
}

#chat-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 72px;
    height: 72px;
    border: 0;
    border-radius: 24px;
    cursor: pointer;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--navibot-primary), var(--navibot-primary-soft));
    box-shadow: 0 18px 32px rgba(11, 45, 99, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-bubble:hover,
#chat-bubble:focus {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 22px 36px rgba(11, 45, 99, 0.38);
    outline: none;
}

.chat-bubble-ring {
    position: absolute;
    inset: -6px;
    border-radius: 28px;
    border: 1px solid rgba(109, 199, 255, 0.35);
    pointer-events: none;
}

.chat-bubble-status {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #30d158;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.15);
}

#chat-bubble img {
    width: 42px;
    height: 42px;
}

#chat-container {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 108px;
    width: min(420px, calc(100vw - 24px));
    height: min(760px, calc(100vh - 128px));
    min-height: 640px;
    background: rgba(247, 250, 255, 0.85);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--navibot-radius);
    box-shadow: var(--navibot-shadow);
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transform-origin: bottom right;
}

#chat-container.show {
    display: flex;
    animation: navibot-pop 0.22s ease forwards;
}

@keyframes navibot-pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chat-header {
    padding: 18px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #ffffff;
    background:
        radial-gradient(circle at top left, rgba(109, 199, 255, 0.35), transparent 34%),
        linear-gradient(135deg, #082553 0%, #0d376f 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chat-header-avatar img {
    width: 34px;
    height: 34px;
}

.chat-header-copy {
    display: flex;
    flex-direction: column;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

.chat-header-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.76);
    letter-spacing: 0.02em;
}

.chat-help {
    position: relative;
}

#help-btn,

#close-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#help-btn {
    font-size: 16px;
    font-weight: 700;
}

#help-btn:hover,
#help-btn:focus,
#close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.04);
}

#help-btn:focus,
#close-btn:focus {
    outline: none;
}

.chat-help-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--navibot-text-soft);
    font-size: 11px;
    line-height: 1.55;
    border: 1px solid rgba(11, 45, 99, 0.08);
    box-shadow: 0 18px 30px rgba(11, 45, 99, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    pointer-events: none;
    z-index: 2;
}

.chat-help:hover .chat-help-tooltip,
.chat-help:focus-within .chat-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 12px;
    background:
        linear-gradient(180deg, rgba(242, 247, 255, 0.92) 0%, rgba(255, 255, 255, 0.95) 100%);
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 45, 99, 0.25) transparent;
}

#chat-box::-webkit-scrollbar {
    width: 8px;
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(11, 45, 99, 0.2);
    border-radius: 999px;
}

.message-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin: 0 0 14px;
}

.message-container.user {
    justify-content: flex-end;
}

.message-container.bot {
    justify-content: flex-start;
}

.message-container .avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 14px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 10px 18px rgba(11, 45, 99, 0.12);
}

.message-container.user .avatar {
    background-image: url("../images/user_icon.png");
}

.message-container.bot .avatar {
    background-image: url("../images/chatbot_icon.png");
}

.message {
    max-width: min(84%, 300px);
    padding: 14px 16px;
    border-radius: 20px;
    box-shadow: 0 12px 24px rgba(14, 26, 50, 0.06);
}

.message.user {
    color: #ffffff;
    background: linear-gradient(135deg, #0f4ba6 0%, #0a2f67 100%);
    border-bottom-right-radius: 8px;
}

.message.bot {
    color: var(--navibot-text);
    background: var(--navibot-surface-strong);
    border: 1px solid var(--navibot-border);
    border-bottom-left-radius: 8px;
}

.intro-message {
    margin-bottom: 18px;
}

.intro-card {
    max-width: calc(100% - 46px);
}

.intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--navibot-primary);
    background: rgba(11, 45, 99, 0.08);
}

.intro-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #30d158;
}

.chatbot-response {
    text-align: left;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.bot p,
.message.bot ol,
.message.bot ul {
    margin: 0;
    padding: 0;
}

.message.bot p + p,
.message.bot p + ol,
.message.bot p + ul,
.message.bot ol + p,
.message.bot ul + p {
    margin-top: 8px;
}

.message.bot ol,
.message.bot ul {
    padding-left: 18px;
}

.message.bot li + li {
    margin-top: 4px;
}

/* Answers arrive as Markdown, so bold, code spans and links all reach the
   bubble as real tags now and need to sit on the existing type scale. */
.message.bot strong {
    font-weight: 600;
}

.message.bot code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(11, 45, 99, 0.08);
}

.message.bot a {
    color: var(--navibot-primary, #0b2d63);
    text-decoration: underline;
    word-break: break-word;
}

.message-meta {
    margin-top: 8px;
    font-size: 11px;
    color: var(--navibot-text-soft);
}

.typing-indicator-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 2px 0;
}

.typing-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(11, 45, 99, 0.35);
    animation: blink 1s infinite;
}

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

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

@keyframes blink {
    0%, 100% {
        opacity: 0.2;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

#static-questions {
    flex-shrink: 0;
    padding: 10px 12px;
    background: rgba(244, 248, 255, 0.96);
    border-top: 1px solid rgba(11, 45, 99, 0.08);
    border-bottom: 1px solid rgba(11, 45, 99, 0.08);
}

/* Messenger-style quick reply chips, paged with explicit prev/next arrows
   instead of free swipe/drag scrolling. */
.suggested-prompts-shell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggested-prompts-row {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding: 2px;
}

.suggested-prompts-nav {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1.5px solid var(--navibot-primary-soft);
    background: #ffffff;
    color: var(--navibot-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.suggested-prompts-nav:hover:not(:disabled),
.suggested-prompts-nav:focus:not(:disabled) {
    background: linear-gradient(135deg, var(--navibot-primary) 0%, var(--navibot-primary-soft) 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(11, 45, 99, 0.18);
    outline: none;
}

.suggested-prompts-nav:disabled {
    cursor: default;
    opacity: 0.35;
}

.suggested-prompt-chip {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--navibot-primary-soft);
    background: #ffffff;
    color: var(--navibot-primary);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.suggested-prompt-chip:hover,
.suggested-prompt-chip:focus {
    background: linear-gradient(135deg, var(--navibot-primary) 0%, var(--navibot-primary-soft) 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(11, 45, 99, 0.2);
    outline: none;
}

.suggested-prompts-empty {
    display: grid;
    place-items: center;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px dashed rgba(11, 45, 99, 0.12);
    background: rgba(11, 45, 99, 0.03);
    color: var(--navibot-text-soft);
    font-size: 12px;
    text-align: center;
}

#input-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.92);
}

#user-input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(11, 45, 99, 0.12);
    padding: 13px 14px;
    border-radius: 16px;
    background: #f7faff;
    color: var(--navibot-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#user-input::placeholder {
    color: #8a96aa;
}

#user-input:focus {
    outline: none;
    background-color: #ffffff;
    border-color: rgba(11, 45, 99, 0.26);
    box-shadow: 0 0 0 4px rgba(72, 135, 255, 0.12);
}

#send-btn {
    border: 0;
    padding: 13px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0d3e83 0%, #072855 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 12px 24px rgba(11, 45, 99, 0.18);
}

#send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 26px rgba(11, 45, 99, 0.24);
}

@media (max-width: 768px) {
    #chat-bubble {
        right: 16px;
        bottom: 16px;
        width: 66px;
        height: 66px;
    }

    #chat-container {
        right: 12px;
        left: 12px;
        bottom: 92px;
        width: auto;
        min-height: 0;
        height: min(78vh, 680px);
        border-radius: 22px;
    }

    #chat-header {
        padding: 16px;
    }

    .message {
        max-width: 84%;
    }

    #static-questions {
        padding: 10px;
    }

    .suggested-prompt-chip {
        padding: 8px 14px;
        font-size: 12px;
    }

    .suggested-prompts-nav {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #chat-container {
        left: 8px;
        right: 8px;
        bottom: 86px;
        height: calc(100vh - 100px);
        border-radius: 20px;
    }

    #chat-box {
        padding: 14px 12px 10px;
    }

    #input-container {
        padding: 12px;
    }

    #send-btn {
        padding: 12px 16px;
    }

    .message-container .avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .chat-help-tooltip {
        width: min(240px, calc(100vw - 48px));
        right: -36px;
    }
}
