/*
   MOG Natural — Blue Cover Six app
   Copyright (c) 2026 Blue Cover Six LLC / John Molt
   An unlimited license is granted to the Reno Police Department
   and the City of Reno in perpetuity.

   2026-05-09 1:12 PM PT

   wwwroot/styles/app.css
*/

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--black);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─────────────────────────────────────────────────────────────────────────
   HEADER — mobile-first
   ─────────────────────────────────────────────────────────────────────────
   The header has three pieces: a left text block ("MOG Natural" + subtitle),
   a center RPD badge, and a right hamburger button. On mobile the title
   and hamburger have wildly different intrinsic widths, so a 1fr/auto/1fr
   grid pushes the badge off-center. To make the badge always centered to
   the header itself, we anchor the badge absolutely using the top/right/
   bottom/left = 0 + margin: auto trick — independent of the side cells'
   widths. The header itself is the positioning context (position: sticky
   establishes that just like position: relative would).

   At 600px+ we switch to a real grid where the badge takes its column,
   because desktop has plenty of room and the natural 3-column flow looks
   cleaner with everything sitting in document order.
*/
header {
    background: var(--dark);
    border-bottom: 2px solid var(--cyan-dim);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 60px;
}

.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Keep the text block from forcing the header taller than 60px when
       the title wraps. The header min-height already guards visual height. */
    min-width: 0;
}

.header-title-main {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--white);
    line-height: 1;
    /* Mobile-first sizing — desktop overrides below. */
    font-size: 16px;
    letter-spacing: 1.5px;
}

.header-title-main span {
    color: var(--cyan);
}

.header-subtitle {
    font-family: var(--font-mono);
    color: var(--gray);
    text-transform: uppercase;
    margin-top: 2px;
    /* Mobile-first sizing — desktop overrides below. */
    font-size: 8px;
    letter-spacing: 1px;
}

/* The badge wrapper. On mobile, absolutely centered to the header.
   The top/right/bottom/left = 0 + margin: auto pattern centers an
   absolutely-positioned element both horizontally and vertically inside
   its containing block — completely independent of how wide the side
   cells are. width/height: fit-content shrinks the wrapper to the badge's
   intrinsic size so the auto-margins have something to work with. */
.header-badge-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    width: fit-content;
    height: fit-content;
    pointer-events: none;
}

.header-badge-wrap img {
    height: 100%;
    width: auto;
    object-fit: contain;
    opacity: 0.9;
    /* Mobile-first sizing — desktop overrides below. */
    max-height: 44px;
    min-height: 32px;
}

/* The right cell holds the hamburger. Nothing special — flex
   space-between on the header keeps it pinned to the right edge. */

/* ── TABS ── */
.tabs {
    display: flex;
    background: var(--dark);
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    user-select: none;
}

.tab.active {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
    background: #0f1a1f;
}

.tab:hover:not(.active) {
    color: var(--white);
    background: #161616;
}

/* ── MAIN ── */
main {
    flex: 1;
    padding: 12px;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.panel { display: none; }
.panel.active { display: block; }

/* ── INPUT SECTION ── */
.input-section {
    margin-bottom: 10px;
}

.input-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

textarea.question {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 15px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 64px;
    outline: none;
    transition: border-color 0.2s;
    display: block;
}

textarea.question:focus {
    border-color: var(--cyan-dim);
}

textarea.question::placeholder {
    color: var(--gray-dim);
    font-size: 13px;
}

.btn-ask {
    margin-top: 8px;
    width: 100%;
    background: var(--cyan-dim);
    border: none;
    border-radius: 4px;
    color: var(--white);
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 12px;
    text-transform: uppercase;
    transition: background 0.2s, color 0.2s;
}

.btn-ask:hover {
    background: var(--cyan);
    color: var(--black);
}

.btn-ask:disabled {
    background: var(--border);
    color: var(--gray-dim);
    cursor: not-allowed;
}

/* ── STATUS BAR ── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 8px;
    min-height: 18px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.3s;
}

.status-dot.thinking {
    background: var(--orange);
    animation: pulse 1s infinite;
}

.status-dot.done {
    background: var(--green);
}

.status-dot.error {
    background: var(--red);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.status-text {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--gray);
    flex: 1;
}

.token-count {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--gray-dim);
}

/* ── ANSWER AREA ── */
.answer-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--orange);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
}

/* ── FEEDBACK ROW ── */
/*
   Three icon buttons that sit between the response label and the answer-box.
   Hidden by Alpine x-show until an answer is present.
   Buttons are 44x44 to clear Apple HIG tap-target minimums.
   White SVG source files are tinted with CSS filter so we don't have to edit
   the SVGs themselves — same image is used for idle/hover/selected and the
   filter changes per state. Filter values were computed from the white-source
   target colors using a hue-rotate / brightness / saturate solve.
*/
.feedback-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.feedback-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}

.feedback-btn img {
    width: 22px;
    height: 22px;
    /* Idle: dim cyan tint on the white SVG. */
    filter: brightness(0) saturate(100%)
            invert(54%) sepia(13%) saturate(862%)
            hue-rotate(155deg) brightness(92%) contrast(86%);
    transition: filter 0.15s;
}

.feedback-btn:hover img,
.feedback-btn.is-selected img,
.feedback-btn.is-speaking img {
    /* Hover/selected/speaking: full cyan. */
    filter: brightness(0) saturate(100%)
            invert(72%) sepia(58%) saturate(2476%)
            hue-rotate(155deg) brightness(101%) contrast(101%);
}

.feedback-btn.is-selected {
    background: rgba(0, 212, 255, 0.12);
    border-color: var(--cyan);
}

.feedback-btn:hover {
    border-color: var(--cyan);
}

/* Pulse for Read Aloud while speech is active. Wired but stubbed —
   the speaking class is bound by Alpine; the audio that flips it
   lives in the next ticket. */
.feedback-btn.is-speaking {
    animation: feedback-pulse 1.2s ease-in-out infinite;
}

@keyframes feedback-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
}

.answer-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 14px;
    min-height: 100px;
    line-height: 1.7;
}

.answer-box.empty {
    color: var(--gray-dim);
    font-family: var(--font-mono);
    font-size: 11px;
}

/* ── CHARGE ENTRY CARDS ── */
.charge-entry {
    background: var(--card2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--cyan-dim);
    border-radius: 4px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.charge-entry:last-child {
    margin-bottom: 0;
}

/* ── MARKDOWN INSIDE ANSWER / CHARGE CARDS ── */
.answer-box p {
    margin: 0 0 8px 0;
    color: var(--white);
    font-size: 14px;
    line-height: 1.7;
}

/* Charge title line — standalone strong becomes block headline */
.charge-entry > p > strong:only-child,
.charge-entry > p:first-child > strong {
    color: var(--cyan);
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
    line-height: 1.3;
}

/* Inline strong in prose */
.answer-box p strong,
.answer-box li strong {
    color: var(--cyan);
    font-weight: 600;
}

/* Lists */
.answer-box ul, .answer-box ol {
    padding-left: 18px;
    margin: 4px 0 8px;
}

.answer-box li {
    margin: 3px 0;
    color: var(--white);
    font-size: 14px;
    line-height: 1.6;
}

.answer-box a {
    color: var(--cyan);
}
.answer-box a:hover {
    color: var(--white);
}

/* Headings */
.answer-box h1, .answer-box h2, .answer-box h3 {
    font-family: var(--font-head);
    color: var(--orange);
    margin: 14px 0 6px;
    letter-spacing: 1px;
    font-size: 15px;
    text-transform: uppercase;
}

/* Code */
.answer-box code {
    font-family: var(--font-mono);
    background: var(--border);
    padding: 1px 5px;
    border-radius: 2px;
    font-size: 12px;
    color: var(--orange);
}

/* ── STATUTE-CODE LINKS ── */
/* RMC and NRS codes inside answer cards become clickable spans that open the
   busRmcModal. Click handling is wired via event delegation in app.js init(). */
.statute-link {
    cursor: pointer;
    border-bottom: 1px dotted var(--cyan-dim);
    transition: color 150ms ease, border-color 150ms ease;
}
.statute-link--rmc {
    color: var(--cyan);
}
.statute-link--nrs {
    color: var(--orange);
    border-bottom-color: var(--orange);
    opacity: 0.85;
}
.statute-link:hover {
    border-bottom-style: solid;
}
.statute-link--rmc:hover {
    color: var(--white);
    border-bottom-color: var(--cyan);
}
.statute-link--nrs:hover {
    color: var(--white);
    border-bottom-color: var(--orange);
    opacity: 1;
}

/* ── FOOTER ── */
footer {
    background: var(--dark);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--gray-dim);
    line-height: 1.8;
}

footer span {
    color: var(--cyan);
}

/* Admin-only edit link inside charge cards.
   Only rendered when isAdmin === true (see app.js appendEditLinks).
   Styled as a small cyan underlined link to match the .statute-link
   affordance pattern — admins recognize "blue underline = clickable". */
.charge-edit-row {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    text-align: right;
}
.charge-edit-link {
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: lowercase;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.charge-edit-link:hover {
    color: var(--white);
}

/* Admin-only edit link rendered inline next to a resource <h2> title in
   the resources answer. Shares the lowercase-cyan-underline affordance
   with .charge-edit-link so admins recognize it as the same edit lever,
   but sits inline (no bordered row) to keep the answer's flow tight. */
.resource-edit-link {
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: lowercase;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: 10px;
    vertical-align: middle;
    font-weight: normal;
}
.resource-edit-link:hover {
    color: var(--white);
}

.bus-fav-star {
    display: inline-block;
    color: #f5b94c;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    margin-right: 4px;
    transition: transform 0.1s;
}
.bus-fav-star:hover {
    transform: scale(1.2);
}

/* ─────────────────────────────────────────────────────────────────────────
   DESKTOP — 600px and up
   ─────────────────────────────────────────────────────────────────────────
   Restore the 3-column grid layout for the header and bump title sizing
   back up. The badge becomes a normal grid child instead of an absolutely-
   positioned overlay. We explicitly reset every absolute-positioning
   property so nothing leaks from the mobile-first rules.
*/
@media (min-width: 600px) {
    header {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }
    .header-left {
        justify-self: start;
    }
    .header-badge-wrap {
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        margin: 0;
        width: auto;
        height: auto;
        justify-self: center;
        pointer-events: auto;
        justify-content: flex-end;
    }
    .header-right {
        justify-self: end;
    }

    .header-title-main {
        font-size: 24px;
        letter-spacing: 3px;
    }
    .header-subtitle {
        font-size: 9px;
        letter-spacing: 2px;
    }
    .header-badge-wrap img {
        max-height: 52px;
        min-height: 36px;
    }

    .btn-ask {
        padding: 12px 40px;
    }

    textarea.question { min-height: 56px; }
}

/*
   ═══════════════════════════════════════════════════════════════════════════
   RPD_RGU_INTEL — Search form chrome
   05/15/2026 12:00 PM

   Append to wwwroot/styles/app.css.

   These styles cover the layout of the Search collapsible body only.
   The collapsible frame itself and the cards inside Recents / Search
   Results live in their own components (busCollapsible.js and
   busRecordCard.js) per BUS development standards Section 7.
   ═══════════════════════════════════════════════════════════════════════════
*/

.rgi-search-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.rgi-search-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.rgi-search-field--wide {
    grid-column: 1 / -1;
}

.rgi-search-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-dim);
}

.rgi-search-input {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}
.rgi-search-input:focus {
    outline: none;
    border-color: var(--cyan-dim);
}
.rgi-search-input--date {
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

.rgi-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Match-mode switch.
   Two labels straddling a knob. Click anywhere on the strip to flip.
   .is-any modifier on the parent slides the knob right and rebalances
   label colors so the active side is the bright one.                 */
.rgi-search-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.rgi-search-switch-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-dim);
    transition: color 0.15s ease;
}
.rgi-search-switch:not(.is-any) .rgi-search-switch-label--all {
    color: var(--cyan);
}
.rgi-search-switch.is-any .rgi-search-switch-label--any {
    color: var(--cyan);
}

.rgi-search-switch-knob {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 9px;
}
.rgi-search-switch-knob::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 14px;
    height: 14px;
    background: var(--cyan);
    border-radius: 50%;
    transition: left 0.15s ease;
}
.rgi-search-switch.is-any .rgi-search-switch-knob::after {
    left: 19px;
}

.rgi-search-btn {
    background: var(--cyan-dim);
    border: 1px solid var(--cyan);
    color: var(--white);
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 8px 22px;
    border-radius: 4px;
    cursor: pointer;
}
.rgi-search-btn:hover {
    background: var(--cyan);
}