/* ============================================================
   Samarth eGov · Guest mobile action bar
   A fixed bottom row holding the destinations the header drops at narrow
   widths (Public Notices below md, Help below lg), plus search — which has no
   header button at all, only Cmd/Ctrl+K and the mega menu — and the portal
   entry point. Shown below md only.
   Markup: views/layouts/samarth4/include/guest-bottombar.php
   ============================================================ */

/* Height lives on .g-body rather than on the bar, because the body padding and
   the toast stack below both need to read it and neither is a descendant of
   the bar. */
.g-body { --g-bbar-h: 4rem; }

.g-bbar {
    /* Above page content, below the mega menu (1070) and command palette
       (1080) so either overlay covers the bar instead of fighting it. */
    position: fixed;
    z-index: 1040;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    align-items: stretch;
    /* The inset keeps the row clear of the iOS home indicator; it resolves to
       0px everywhere else, so the bar is exactly --g-bbar-h tall on Android
       and desktop. */
    height: calc(var(--g-bbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--g-border);
    background: color-mix(in srgb, var(--g-bg) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    /* Upward-only shadow: lifts the bar off the content scrolling under it
       without drawing a second line beside the border. */
    box-shadow: 0 -10px 26px -20px color-mix(in srgb, var(--g-shadow-color) 38%, transparent);
}

.g-bbar__item {
    position: relative;
    flex: 1 1 0;
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .22rem;
    padding: .4rem .2rem;
    border: 0;
    background: transparent;
    color: var(--g-text-faint);
    font-family: inherit;
    font-size: .63rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    /* Grey flash on tap reads as a bug on a bar this prominent. */
    -webkit-tap-highlight-color: transparent;
    transition: color .16s var(--g-ease);
}

.g-bbar__item:hover { color: var(--g-text-muted); }
.g-bbar__item:focus-visible {
    outline: 2px solid var(--g-accent);
    /* Inset, so the ring is not clipped by the bar's own top border. */
    outline-offset: -3px;
    border-radius: var(--g-r-md);
}

.g-bbar__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.g-bbar__ico {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
}
/* Unread notices dot on the Notices icon (same accent dot as the mega
   menu's notice tiles). The ring matches the bar so it reads as cut out. */
.g-bbar__ico { position: relative; }
.g-bbar__new {
    position: absolute;
    top: -2px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--g-accent);
    box-shadow: 0 0 0 2px var(--g-bg);
}
.g-bbar__new[hidden] { display: none !important; }
.g-bbar__ico svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Current page: tinted, with a short cap hanging off the top border so the
   state survives at a glance without relying on colour alone. */
.g-bbar__item.is-active { color: var(--g-accent-ink); }
.g-bbar__item.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 1.75rem;
    height: 2px;
    border-radius: 0 0 999px 999px;
    background: var(--g-accent);
}

/* Centre action (search) — a filled tile rather than a bare glyph, matching
   .g-btn-accent in the header. It opens a dialog rather than navigating, so it
   never takes the is-active state. */
.g-bbar__item--cta { color: var(--g-accent-ink); }
.g-bbar__item--cta .g-bbar__ico {
    width: 2.15rem;
    height: 2.15rem;
    padding: .45rem;
    border-radius: var(--g-r-md);
    background: linear-gradient(135deg, var(--g-accent), var(--g-accent-2));
    color: #fff;
    box-shadow: 0 7px 18px -9px color-mix(in srgb, var(--g-accent) 75%, transparent);
    transition: transform .16s var(--g-ease), box-shadow .16s var(--g-ease);
}
/* Slight press feedback, since this one reads as a button rather than a tab. */
.g-bbar__item--cta:active .g-bbar__ico {
    transform: scale(.94);
    box-shadow: 0 4px 10px -8px color-mix(in srgb, var(--g-accent) 75%, transparent);
}

[data-guest-theme="dark"] .g-bbar {
    background: color-mix(in srgb, var(--g-bg) 80%, transparent);
    box-shadow: 0 -10px 26px -18px rgba(0, 0, 0, .5);
}

@media (max-width: 767.98px) {
    .g-bbar { display: flex; }

    /* Reserve the bar's height at the end of the page, or it would sit over
       the last of the footer. */
    .g-body {
        padding-bottom: calc(var(--g-bbar-h) + env(safe-area-inset-bottom, 0px));
    }

    /* Toasts are fixed to the same corner, so lift them clear of the bar. */
    .g-toast-stack {
        bottom: calc(var(--g-bbar-h) + env(safe-area-inset-bottom, 0px) + .75rem);
    }
}

/* Very narrow phones: keep five targets on one row by trimming the labels
   rather than letting them wrap to two lines and blow out the bar height. */
@media (max-width: 359.98px) {
    .g-bbar__item { font-size: .58rem; }
    .g-bbar__ico { width: 1.35rem; height: 1.35rem; }
    .g-bbar__item--cta .g-bbar__ico { width: 1.95rem; height: 1.95rem; }
}
