/* AI Chatbot widget — all rules scoped under .aicb to avoid clashing with Bootstrap/AdminLTE */
/* Palette approximates IOCL's identity — deep navy with a muted red accent. Every colour is a
   token, so substituting the official brand values is a change to this block alone. */
.aicb { --aicb-accent: #123a6b; --aicb-accent-hover: #0d2b50; --aicb-accent-soft: #eaf0f8; --aicb-highlight: #b5121b; /* used sparingly: recording, errors */ --aicb-bg: #ffffff; --aicb-panel-bg: #f4f6f9; --aicb-user-bg: #123a6b; --aicb-user-fg: #ffffff; --aicb-bot-bg: #ffffff; --aicb-bot-fg: #1c2430; --aicb-muted: #5c6675; --aicb-border: #dde3ea; --aicb-radius: 14px; --aicb-shadow: 0 12px 40px rgba(18, 58, 107, .20); --aicb-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; position: fixed; right: 24px; bottom: 24px; z-index: 1080; font-family: var(--aicb-font); }

/* Launcher */
.aicb__launcher { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--aicb-accent); color: #fff; cursor: pointer; box-shadow: var(--aicb-shadow); display: grid; place-items: center; transition: transform .15s ease, background .15s ease; }
    .aicb__launcher:hover { background: var(--aicb-accent-hover); transform: translateY(-2px); }
.aicb__launcher-icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aicb__launcher-icon--close { display: none; }
.aicb.is-open .aicb__launcher-icon--chat { display: none; }
.aicb.is-open .aicb__launcher-icon--close { display: block; }

/* Panel */
.aicb__panel { position: absolute; right: 0; bottom: 72px; width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 120px); background: var(--aicb-panel-bg); border: 1px solid var(--aicb-border); border-radius: var(--aicb-radius); box-shadow: var(--aicb-shadow); display: flex; flex-direction: column; overflow: hidden; animation: aicb-in .18s ease; }

@keyframes aicb-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Header */
.aicb__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--aicb-accent); border-bottom: 1px solid var(--aicb-accent-hover); }
.aicb__brand { display: flex; align-items: center; gap: 8px; }
.aicb__status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.28); }
.aicb__title { font-weight: 600; font-size: 15px; color: #fff; letter-spacing: .01em; }
.aicb__actions { display: flex; align-items: center; gap: 4px; }
.aicb__icon-btn { width: 32px; height: 32px; border: none; background: transparent; color: rgba(255,255,255,.82); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
    .aicb__icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
    .aicb__icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Permanent scope disclaimer. flex: 0 0 auto keeps it at its natural height while
   .aicb__messages absorbs the remaining space, so it is never compressed and never scrolls out
   of view - the specification requires it to be permanently visible. */
.aicb__disclaimer { flex: 0 0 auto; margin: 0; padding: 8px 12px; background: var(--aicb-accent-soft); border-bottom: 1px solid var(--aicb-border); font-size: 11px; line-height: 1.45; color: var(--aicb-muted); }

/* Messages */
.aicb__messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.aicb__row { display: flex; }
.aicb__row--user { justify-content: flex-end; }
.aicb__row--bot { justify-content: flex-start; }

.aicb__bubble { max-width: 82%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; unicode-bidi: plaintext; }
.aicb__row--user .aicb__bubble { background: var(--aicb-user-bg); color: var(--aicb-user-fg); border-bottom-right-radius: 4px; }
.aicb__row--bot .aicb__bubble { background: var(--aicb-bot-bg); color: var(--aicb-bot-fg); border: 1px solid var(--aicb-border); border-bottom-left-radius: 4px; }
.aicb__bubble--ungrounded { color: var(--aicb-muted); font-style: italic; }
.aicb__bubble--error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; font-style: normal; }
/* Right-to-left answers (Urdu, Sindhi, Kashmiri). `dir="auto"` on the element makes the browser
   infer direction from the first strong character, and unicode-bidi: plaintext applies the same
   inference per paragraph — so a mixed answer with English terms still lays out correctly. */
.aicb__bubble[dir="rtl"] { text-align: right; }
    .aicb__bubble[dir="rtl"] .aicb__cites { justify-content: flex-end; }
    .aicb__bubble[dir="rtl"] .aicb__list { padding-right: 1rem; padding-left: 0; }

/* Citations */
.aicb__cites { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.aicb__cite { display: inline-flex; align-items: center; gap: 5px; background: #eef2ff; color: #3730a3; border: 1px solid #e0e7ff; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; max-width: 100%; }
    .aicb__cite b { font-weight: 700; }
.aicb__cite-doc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.aicb__cite-ref { color: #6366f1; }

/* Typing indicator */
.aicb__typing { display: inline-flex; gap: 4px; padding: 12px; }
    .aicb__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--aicb-muted); opacity: .4; animation: aicb-blink 1.2s infinite; }
        .aicb__typing span:nth-child(2) { animation-delay: .2s; }
        .aicb__typing span:nth-child(3) { animation-delay: .4s; }

@keyframes aicb-blink {
    0%, 60%, 100% { opacity: .25; }
    30% { opacity: 1; }
}

/* Composer */
.aicb__composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px; background: var(--aicb-bg); border-top: 1px solid var(--aicb-border); }
.aicb__input { flex: 1; resize: none; border: 1px solid var(--aicb-border); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 14px; line-height: 1.4; max-height: 120px; outline: none; background: #fff; color: var(--aicb-bot-fg); }
    .aicb__input:focus { border-color: var(--aicb-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.aicb__send { width: 40px; height: 40px; flex: 0 0 auto; border: none; border-radius: 10px; background: var(--aicb-accent); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s ease; }
    .aicb__send:hover:not(:disabled) { background: var(--aicb-accent-hover); }
    .aicb__send:disabled { opacity: .45; cursor: not-allowed; }
    .aicb__send svg { width: 18px; height: 18px; fill: currentColor; }
    .aicb__send svg { transform: scaleX(-1); }

.aicb__empty { margin: auto; text-align: center; padding: 20px 22px; }
.aicb__empty-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--aicb-bot-fg); }
.aicb__empty-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--aicb-muted); }
/* Separated from the body copy so the disclaimer reads as a standing note rather than part of
   the invitation to ask something. */
.aicb__empty-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--aicb-border); font-size: 11.5px; color: var(--aicb-muted); }

@media (max-width: 480px) {
    .aicb { right: 12px; bottom: 12px; }
    .aicb__panel { width: calc(100vw - 24px); height: calc(100vh - 90px); bottom: 68px; }
}

/* Inline citation links ([S#] markers rendered by renderAnswerWithLinks) */
.aicb__cite-link { display: inline-flex; align-items: center; justify-content: center; vertical-align: super; font-size: 10px; line-height: 1; font-weight: 600; padding: 1px 4px; margin: 0 1px; border-radius: 5px; color: var(--aicb-accent, #2563eb); background: #eef2ff; border: 1px solid #e0e7ff; text-decoration: none; cursor: pointer; transition: background .12s ease, color .12s ease; white-space: nowrap; }
    .aicb__cite-link:hover { background: var(--aicb-accent, #2563eb); color: #fff; border-color: var(--aicb-accent, #2563eb); text-decoration: none; }
.aicb__source-link { color: var(--aicb-accent, #2563eb); text-decoration: underline; word-break: break-all; }

/* ---------------- list paging ---------------- */
/* Sits inside the answer bubble, under the rows it pages. Separated by a rule so it reads as a
   control rather than as the last line of the list. */
.aicb__pager-wrap { margin-top: .55rem; padding-top: .5rem; border-top: 1px solid var(--aicb-border); }

.aicb__pager { display: flex; align-items: center; justify-content: center; gap: .3rem; flex-wrap: wrap; }

.aicb__pager-btn { min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem; border: 1px solid var(--aicb-border); border-radius: .35rem; background: #fff; color: var(--aicb-accent); font: inherit; font-size: .95rem; line-height: 1; cursor: pointer; }
    .aicb__pager-btn:hover:not(:disabled) { background: var(--aicb-accent); color: #fff; border-color: var(--aicb-accent); }
    /* Disabled, not hidden: the row keeps its width so the controls do not shuffle between pages. */
    .aicb__pager-btn:disabled { opacity: .35; cursor: default; }

/* Sized in ch so it fits the widest page number without reserving space for a caption. */
.aicb__pager-input { width: 3.2ch; min-width: 2.4rem; height: 1.6rem; padding: 0 .25rem; border: 1px solid var(--aicb-border); border-radius: .35rem; background: #fff; color: var(--aicb-bot-fg); font: inherit; font-size: .8rem; text-align: center; font-variant-numeric: tabular-nums; }
    .aicb__pager-input:focus { outline: none; border-color: var(--aicb-accent); box-shadow: 0 0 0 2px rgba(18, 58, 107, .14); }

.aicb__pager-label { font-size: .78rem; color: var(--aicb-muted); font-variant-numeric: tabular-nums; }

.aicb__pager-range { margin-top: .3rem; text-align: center; font-size: .7rem; color: var(--aicb-muted); font-variant-numeric: tabular-nums; }

.aicb__list { margin-top: 4px; }
    .aicb__list li { margin-bottom: 4px; }
    .aicb__list ol { margin-top: 4px; }

/* ---------------- voice input / output ---------------- */

/* Both controls stay hidden until the JS confirms the browser supports the API, so an
   unsupported browser shows no dead buttons rather than ones that silently do nothing. */
/* Sits on the navy header, so it is drawn as a translucent chip rather than a form control:
   a default select renders white and would pull the eye away from the title. */
.aicb__lang { max-width: 7rem; padding: .22rem 1.35rem .22rem .45rem; border: 1px solid rgba(255, 255, 255, .32); border-radius: .4rem; background-color: rgba(255, 255, 255, .12); color: #fff; font-family: inherit; font-size: .76rem; line-height: 1.3; cursor: pointer; -webkit-appearance: none; appearance: none; /* Chevron drawn inline so the control needs no image asset and follows the text colour. */ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .35rem center; background-size: .7rem; }

    .aicb__lang:hover { background-color: rgba(255, 255, 255, .2); }

    .aicb__lang:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

    /* The dropdown list itself is painted by the OS, which ignores the translucent background —
       so the options need explicit colours or they render white-on-white. */
    .aicb__lang option { background: #fff; color: var(--aicb-bot-fg); }

.aicb__mic { align-self: flex-end; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; margin: 0 .25rem .2rem 0; padding: .4rem; border: none; border-radius: 50%; background: transparent; color: var(--aicb-muted); cursor: pointer; }

    .aicb__mic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

    .aicb__mic:hover:not(:disabled) { background: var(--aicb-accent-soft); color: var(--aicb-accent); }
    .aicb__mic:disabled { opacity: .45; cursor: default; }

/* Recording is signalled by colour AND motion: colour alone is not enough to tell someone
   their microphone is live. aria-pressed carries the same state to a screen reader. */
.aicb__mic--recording { color: #fff; background: var(--aicb-highlight); animation: aicb-pulse 1.4s ease-in-out infinite; }

    .aicb__mic--recording:hover { background: #8f0e15; }

@keyframes aicb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(181, 18, 27, .55); }
    50% { box-shadow: 0 0 0 .35rem rgba(181, 18, 27, 0); }
}

/* Interim speech is shown in the input as it arrives so the user can see it being heard,
   but marked as provisional until recognition settles. */
.aicb__input--interim { color: var(--aicb-muted); font-style: italic; }

.aicb__listen { display: inline-flex; align-items: center; gap: .3rem; margin-top: .45rem; padding: .2rem .5rem; border: 1px solid var(--aicb-border); border-radius: 1rem; background: #fff; font-size: .75rem; color: var(--aicb-muted); cursor: pointer; }

    .aicb__listen:hover { background: var(--aicb-accent-soft); border-color: var(--aicb-accent); color: var(--aicb-accent); }
    .aicb__listen svg { width: .85rem; height: .85rem; fill: none; stroke: currentColor; stroke-width: 2; }
.aicb__listen--speaking { border-color: var(--aicb-highlight); color: var(--aicb-highlight); background: #fdf2f3; }

@media (prefers-reduced-motion: reduce) {
    .aicb__mic--recording { animation: none; }
}
