/* ============================================================================
   NabGol — CHAT COMPOSER  (the bottom bar: attach preview + input + send)
   ----------------------------------------------------------------------------
   Owns EXACTLY one thing: `.chat-input` and everything inside it (including
   the attachment preview, `.file-preview`). Does not touch `#messages` or
   `.chat-header` — those are chat-canvas.css's and chat-header.css's, by the
   same one-owner-per-region rule.

   Why this file exists: same story as chat-header.css. The message area and
   the header now speak one visual language (chat-canvas.css / chat-header.css:
   hairline instead of frame, a three-level ink scale, green spent once). The
   composer still spoke the old one — a solid/gradient bar, a saturated green
   focus glow on the input pill, icon buttons in raw `#a1a1aa`/`#8b949e`.

   Scope decision — same exclusions as chat-header.css, plus one more:
     - size, padding, gap, the safe-area math, `--nabgol-composer-offset`
       (script.js measures this composer's real height and the typing
       indicator overlay positions off it — retinting colours never touches
       height, so this is safe by construction, not by carefulness).
     - `.voice-btn.recording`: a real state (the mic is live), no --nbgc-*
       equivalent, excluded below with `:not(.recording)` rather than left to
       specificity luck.
     - any self-painted CTA chip class (`.nabgol-live-tutor-cta`,
       `.suggestion-chip--live-power`) — those paint their own surface already
       (chip ink, not canvas ink); this file never touches those class names.
       `.live-call-btn--tutor`'s ring WAS on that list too, on the grounds that
       this file sets no box-shadow. Section 4b now does, for one declaration
       and one reason: the ring was a hard-coded accent that no theme switch
       could reach, and it is the composer's second accent element. It is
       re-tinted, never removed.

   The specificity problem — found by grepping "chat-input|input-wrapper|
   composer-" in chat-flagship-polish.css BEFORE writing a rule here (the
   lesson chat-header.css left in docs/CHAT_CANVAS_HANDOFF.md): that file
   already ships a light-theme unification pass for several of these exact
   selectors (`html[data-theme="light"] body:is(...) .chat-input .input-wrapper
   {...}`, `.composer-hint {...}`, `.composer-ai-disclaimer {...}`, a
   mobile-only `.input-wrapper` variant). Each carries an extra
   `[data-theme="light"]` attribute selector — one more specificity "class"
   than an equivalent plain rule here, so for any property BOTH files claim,
   a same-depth selector here LOSES even though this file loads later (a
   loss, not a tie load order could settle). Section 7 below duplicates each
   of those exact selector shapes to force a genuine tie, which this file's
   later load order then wins. Properties with no such competing rule (the
   bar itself, the attachment preview, the toolbar icons, send) don't need a
   duplicate — this file's own `.chat-input`-scoped selector already carries
   more classes than anything currently fighting it.

   Load order: after chat-canvas.css AND chat-header.css, in both templates.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1) THE BAR ITSELF — hairline instead of a filled/gradient slab.
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input {
  background: none !important;
  background-image: none !important;
  border-top: 1px solid var(--nbgc-hairline) !important;
}

/* One font-family line, one token, owner's call: what the reader types is set in
   the same face as what they get back. Defined once, in chat-canvas.css.
   The selector has to name the field itself, not just the bar: a <textarea> does
   not inherit font-family — form controls start from the UA's own font — so
   putting this on `.chat-input` alone would restyle the placeholder row and the
   hint while leaving the reader's actual sentence in the browser default. */
body:is(.desktop-chat, .mobile-chat) .chat-input,
body:is(.desktop-chat, .mobile-chat) .chat-input #input,
body:is(.desktop-chat, .mobile-chat) .chat-input textarea {
  font-family: var(--nbgc-font) !important;
}

/* ---------------------------------------------------------------------------
   2) THE INPUT PILL — the one surface this region keeps (same idea as the
   user bubble: a quiet, self-contained field, not a slab under everything).
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input .input-wrapper {
  background: var(--nbgc-surface) !important;
  border-color: var(--nbgc-hairline) !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input .input-wrapper:focus-within {
  border-color: var(--nbgc-accent-edge) !important;
  /* The focus ring moves OUT here from the field it used to sit inside (see
     the `:focus` rule below). A wash, not a fill: a keyboard user still gets
     an unmistakable halo, and it costs the accent budget nothing because a
     7-10% alpha never lands near the accent itself. */
  box-shadow: 0 0 0 3px var(--nbgc-accent-wash) !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input #input,
body:is(.desktop-chat, .mobile-chat) .chat-input textarea {
  color: var(--nbgc-ink) !important;
  background: transparent !important;
}
/* style-common.css:457 rings the focused field with `0 0 0 3px
   rgba(66,133,244,.2)` — Google blue, from the era before this product had a
   colour. It sat INSIDE the pill whose border already says "focused", so the
   composer showed two focus rings in two different hues, one of them not the
   brand's. Found by the accent-budget harness: a blue box in a green product
   is invisible to a contrast check and obvious in a screenshot. */
body:is(.desktop-chat, .mobile-chat) .chat-input #input:focus,
body:is(.desktop-chat, .mobile-chat) .chat-input textarea:focus {
  box-shadow: none !important;
  border-color: transparent !important;
  outline: none !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input textarea::placeholder,
body:is(.desktop-chat, .mobile-chat) .chat-input #input::placeholder {
  color: var(--nbgc-ink-faint) !important;
}

/* ---------------------------------------------------------------------------
   3) ATTACHMENT PREVIEW — same neutral surface as the input pill so a photo
   about to be sent doesn't sit in a differently-toned box right above it.
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input.composer-has-attach {
  background: var(--nbgc-surface) !important;
  border-color: var(--nbgc-hairline) !important;
}
body:is(.desktop-chat, .mobile-chat) .file-preview .file-name {
  color: var(--nbgc-ink) !important;
}
body:is(.desktop-chat, .mobile-chat) .file-preview .file-meta,
body:is(.desktop-chat, .mobile-chat) .file-preview .fp-caption-hint {
  color: var(--nbgc-ink-soft) !important;
}

/* ---------------------------------------------------------------------------
   4) TOOLBAR ICONS — voice/attach/camera/live-call. Same ink scale as the
   header. `.recording` is a live state with no --nbgc-* equivalent (and a
   meaningful one: the mic is on) — excluded on purpose, not left to chance;
   its own `.chat-input .composer-action-btn` ancestor chain plus the
   `.recording` class already out-classes this file's `:not(.recording)`
   selector, so it is never a specificity coin-flip either.
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording),
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording) .ico {
  background: none !important;
  background-image: none !important;
  color: var(--nbgc-ink-soft) !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording):hover,
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording):focus-visible,
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording):hover .ico,
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-action-btn:not(.recording):focus-visible .ico {
  background: var(--nbgc-surface-2) !important;
  color: var(--nbgc-ink-strong) !important;
}

/* ---------------------------------------------------------------------------
   4b) THE LIVE-CALL RING — the composer's second accent element.
   chat-flagship-polish.css rings `.live-call-btn--tutor` with a hard-coded
   `0 0 0 2px rgba(52,211,153,.35)`. The file header above said this file never
   sets box-shadow; that stance was written when the only question was colour.
   The question now is weight, and a ring at .35 alpha next to a solid accent
   send button gives the composer two things competing to be "the action".
   It is NOT removed — the ring is how a tutor robot says "you can call me from
   right here", a real capability, and the product wall forbids taking that
   away. It moves onto --nbgc-accent-edge: the same edge weight the canvas
   spends on its closing question, one step below send, and a token instead of
   a hex that no theme switch could ever reach (that .35 mint was identical in
   day and night, on two completely different backgrounds).
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input .live-call-btn--tutor {
  box-shadow: 0 0 0 2px var(--nbgc-accent-edge) !important;
}

/* ---------------------------------------------------------------------------
   5) SEND — the one legitimate accent use in this region (the primary
   action), same as the message area reserves its accent for the closing
   question. The old raw `color:#fff` on the icon measured only 1.92:1 on
   this theme's bright mint accent (test_chat_composer_gate.js caught it, not
   inspection) — --nbgc-ink-on-accent replaces it. Same token family, same
   file that already owns every other --nbgc-* value; not a parallel set.
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input .send-btn {
  background: var(--nbgc-accent) !important;
  background-image: none !important;
  color: var(--nbgc-ink-on-accent) !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input .send-btn .ico {
  color: var(--nbgc-ink-on-accent) !important;
  stroke: currentColor !important;
}

/* ---------------------------------------------------------------------------
   6) HINT + DISCLAIMER — quiet chrome under the field.
   --------------------------------------------------------------------------- */
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-hint {
  color: var(--nbgc-ink-faint) !important;
}
body:is(.desktop-chat, .mobile-chat) .chat-input .composer-ai-disclaimer {
  color: var(--nbgc-ink-faint) !important;
}

/* ---------------------------------------------------------------------------
   7) LIGHT-THEME TIE-BREAKS — see the file header. Same selector shape as
   the chat-flagship-polish.css rules being out-specificity'd, so this is a
   real tie that this file's later load order settles.
   --------------------------------------------------------------------------- */
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input .input-wrapper {
  background: var(--nbgc-surface) !important;
  border-color: var(--nbgc-hairline) !important;
  color: var(--nbgc-ink) !important;
}
html[data-theme="light"] body.mobile-chat .input-wrapper {
  background: var(--nbgc-surface) !important;
  border-color: var(--nbgc-hairline) !important;
  box-shadow: none !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .chat-input #input {
  color: var(--nbgc-ink) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-hint {
  color: var(--nbgc-ink-faint) !important;
}
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .composer-ai-disclaimer {
  color: var(--nbgc-ink-faint) !important;
}
