/*
 * "Find on this site" (Site Guide) button and panel.
 * The button is stacked above the IP Saarthi button (.chat-bot: right 10px,
 * bottom 100px, 50px), using the same look.
 */

.sg-root {
    --sg-blue: #034ea2;
    --sg-navy: #263a7f;
    --sg-text: #1f2937;
    --sg-muted: #5b6474;
    --sg-line: #dfe3ec;
    --sg-soft: #f3f6fb;
    --sg-bg: #fff;
}

.sg-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Button ─────────────────────────────────────────────────────────────── */

.sg-launcher {
    position: fixed;
    right: 12px;
    bottom: 160px;
    z-index: 99998; /* just under IP Saarthi, whose label slides out on hover */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 46px;
    height: 46px;
    padding: 0 10px;
    border: 0;
    border-radius: 46px;
    background: var(--sg-bg);
    color: var(--sg-blue);
    box-shadow: 0 4px 4px 0 #00000040;
    cursor: pointer;
    overflow: hidden;
    transition: width .4s ease;
}

.sg-launcher__icon {
    flex: 0 0 26px;
}

.sg-launcher__label {
    width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
    color: var(--sg-navy);
}

.sg-launcher:hover,
.sg-launcher:focus-visible {
    width: 186px;
}

.sg-launcher:hover .sg-launcher__label,
.sg-launcher:focus-visible .sg-launcher__label {
    width: 100%;
    padding-right: 8px;
    opacity: 1;
}

.sg-launcher:focus-visible {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

.sg-root.sg-is-open .sg-launcher {
    background: var(--sg-blue);
    color: #fff;
}

/* Home page on short desktop screens: the floating side buttons fill the
   right edge, so sit beside IP Saarthi instead of above it. */
@media (min-width: 992px) and (max-height: 820px) {
    body:has(ul.rightSideBtn) .sg-launcher {
        right: 70px;
        bottom: 102px;
    }
}

/* ── Panel ──────────────────────────────────────────────────────────────── */

.sg-panel {
    position: fixed;
    right: 70px;
    bottom: 100px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: calc(100vw - 90px);
    max-height: min(580px, calc(100vh - 130px));
    border-radius: 14px;
    background: var(--sg-bg);
    color: var(--sg-text);
    box-shadow: 0 12px 40px rgba(15, 23, 42, .28);
    font-size: 15px;
    line-height: 1.45;
    overflow: hidden;
}

.sg-panel[hidden] {
    display: none;
}

.sg-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 12px 18px;
    background: var(--sg-navy);
    color: #fff;
}

.sg-panel__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.sg-panel__actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sg-clear {
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    padding: 7px 12px;
    cursor: pointer;
}

.sg-clear:hover,
.sg-clear:focus-visible {
    background: rgba(255, 255, 255, .18);
    outline: none;
}

.sg-clear[hidden] {
    display: none;
}

.sg-notice {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: #555;
}

.sg-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.sg-close:hover,
.sg-close:focus-visible {
    background: rgba(255, 255, 255, .18);
    outline: none;
}

.sg-panel__body {
    flex: 1 1 auto;
    padding: 14px 16px;
    overflow-y: auto;
    background: var(--sg-soft);
}

.sg-msg {
    margin-bottom: 12px;
}

.sg-msg p {
    margin: 0 0 8px;
}

.sg-msg p:last-child {
    margin-bottom: 0;
}

.sg-msg--bot {
    padding: 10px 12px;
    border-radius: 4px 12px 12px 12px;
    background: var(--sg-bg);
    border: 1px solid var(--sg-line);
}

.sg-msg--user {
    margin-left: auto;
    width: fit-content;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px 4px 12px 12px;
    background: var(--sg-blue);
    color: #fff;
    overflow-wrap: anywhere;
}

.sg-msg--status {
    color: var(--sg-muted);
    font-style: italic;
}

.sg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sg-chip {
    padding: 4px 10px;
    border: 1px solid var(--sg-blue);
    border-radius: 999px;
    background: var(--sg-bg);
    color: var(--sg-blue);
    font-size: 13px;
    cursor: pointer;
}

.sg-chip:hover,
.sg-chip:focus-visible {
    background: var(--sg-blue);
    color: #fff;
    outline: none;
}

.sg-results {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.sg-result {
    padding: 8px 0;
    border-top: 1px solid var(--sg-line);
}

.sg-result:first-child {
    border-top: 0;
}

.sg-result__title {
    font-weight: 600;
    color: var(--sg-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.sg-result__meta {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--sg-muted);
}

.sg-result__file {
    display: inline-block;
    margin-top: 3px;
    font-size: 13px;
    color: var(--sg-blue);
}

.sg-more {
    display: inline-block;
    margin-top: 6px;
    font-size: 14px;
    color: var(--sg-blue);
}

.sg-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--sg-line);
    background: var(--sg-bg);
}

.sg-form input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #b9c2d3;
    border-radius: 21px;
    color: var(--sg-text);
    background: #fff;
    font-size: 15px;
}

.sg-form input:focus {
    border-color: var(--sg-blue);
    outline: 2px solid rgba(3, 78, 162, .25);
}

.sg-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--sg-blue);
    color: #fff;
    cursor: pointer;
}

.sg-send:disabled {
    opacity: .6;
    cursor: wait;
}

.sg-send:focus-visible {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

.sg-panel__foot {
    padding: 8px 14px 10px;
    border-top: 1px solid var(--sg-line);
    background: var(--sg-bg);
    font-size: 12px;
    color: var(--sg-muted);
}

.sg-panel__foot p {
    margin: 0 0 3px;
}

.sg-panel__foot a {
    color: var(--sg-blue);
    text-decoration: underline;
}

/* Phones: the panel takes the width of the screen. */
@media (max-width: 575px) {
    .sg-panel {
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }
}

/* ── High contrast (accessibility toolbar) ─────────────────────────────── */
/* That mode turns all text yellow (body.dark-contrast * { color: #ff0 !important }),
   so everything here is black with yellow borders; nothing has a yellow fill. */

body.dark-contrast .sg-launcher,
body.dark-contrast .sg-root.sg-is-open .sg-launcher,
body.dark-contrast .sg-send,
body.dark-contrast .sg-msg--user {
    background: #000;
    border: 2px solid #ff0;
}

body.dark-contrast .sg-panel,
body.dark-contrast .sg-panel__body,
body.dark-contrast .sg-form,
body.dark-contrast .sg-panel__foot,
body.dark-contrast .sg-msg--bot,
body.dark-contrast .sg-chip,
body.dark-contrast .sg-form input {
    background: #000;
    border-color: #ff0;
}

body.dark-contrast .sg-panel {
    border: 2px solid #ff0;
}

body.dark-contrast .sg-panel__head {
    background: #000;
    border-bottom: 1px solid #ff0;
}

body.dark-contrast .sg-chip:hover,
body.dark-contrast .sg-chip:focus-visible,
body.dark-contrast .sg-close:hover,
body.dark-contrast .sg-close:focus-visible {
    background: #333;
}

body.dark-contrast .sg-result {
    border-top-color: #ff0;
}

@media (prefers-reduced-motion: reduce) {
    .sg-launcher {
        transition: none;
    }
}
