/* Rozmowa on a phone in WhatsApp's shapes (task #258, ADR 0282), at a phone's width: linked
   before phone.css, which stays the last stylesheet. Quartio's own colours, type and icons. */

/* The history column's own button: the clock beside a computer's column, the arrow back to the
   list on a phone. */
.history-toggle .history-back { display: none; }
.chat-new-fab { display: none; }

@media (max-width: 760px) {
  /* The list of conversations is the start: the whole screen, no shade; a conversation is the
     screen over it. */
  /* (Only while open: closed it keeps the drawer's width, so a wider window opens the column
     from there and nothing beside it reflows.) */
  .history.open { width: 100%; flex-basis: 100%; }
  .history .history-inner { width: 100%; padding: 12px 12px 0; border-right: 0; }
  .history-heading { display: none; }
  .history.open ~ .history-shade { visibility: hidden; opacity: 0; }
  .chat-layout:has(> .history.open) > :not(.history) { visibility: hidden; }
  .history .history-search { padding: 0 14px; min-height: 44px; border-radius: 22px; background: var(--surface); }
  /* (The list scrolls to the screen's foot, its last rows clear of the round button.) */
  .history-items { margin-top: 12px; padding-bottom: 84px; }
  .history-group { margin: 16px 12px 4px; }
  /* A row as a messenger's: a round mark, the name in its size, a thumb's height. */
  .history-row { min-height: 64px; gap: 14px; padding: 10px 44px 10px 10px; font-size: 16px; border-radius: 10px; }
  .history-row > .icon { width: 44px; height: 44px; padding: 12px; border-radius: 50%; background: var(--sage); }
  /* The round button for a new conversation, at the foot of the list on the right. */
  .chat-new-fab { display: grid; place-items: center; position: absolute; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 3; width: 56px; height: 56px; border-radius: 16px; background: var(--ink); color: var(--surface); box-shadow: 0 6px 20px var(--q-shadow-deep); }
  .chat-new-fab .icon { width: 24px; height: 24px; }
  .chat-new-fab:active { transform: scale(.95); }
  .history:not(.open) .chat-new-fab, .history.selecting .chat-new-fab { display: none; }
  /* (Over the list the header names the list: who reads the conversation under it is not said.) */
  .workspace:has(.chat-layout > .history.open) .topbar .share-slot { display: none; }
  /* Over the list the header's clock is the way back to it, an arrow; on the list it is gone. */
  .history-toggle .icon:not(.history-back) { display: none; }
  .history-toggle .history-back { display: block; }
  .history-toggle[aria-expanded=true] { display: none; }
  .history-toggle.has-news[aria-expanded=false]::after { top: 8px; right: 8px; }
}

/* A conversation as a messenger's: the person's words in a green bubble at the right, Quartio's
   answer in a white one at the left, the column's width (a widget in it keeps its room; who wrote
   it at its top, as a group's bubble has), the time
   inside each; the box at the foot, a round field with "+" in it and a round send button beside
   it, growing with the text. A new conversation is the same screen, empty: its heading small in
   the middle, its starters as chips over the box. */
@media (max-width: 760px) {
  .chat-view { padding: 0 10px; }
  .messages { gap: 10px; padding: 14px 2px 12px; }
  .message-row--user .message-bubble { max-width: 86%; padding: 8px 12px 6px; border-radius: 14px 4px 14px 14px; }
  .message-row--assistant .message-bubble { width: 100%; max-width: 100%; padding: 8px 12px 6px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; background: var(--surface); }
  .message-row--assistant .message-heading { gap: 6px; margin: 0 0 6px; font-size: 13px; }
  .message-row--assistant .message-heading .symbol { width: 18px; height: 18px; }
  .message-meta, .message-row--user .message-meta { margin-top: 4px; justify-content: flex-end; }
  .message-text, .message-row--assistant .message-text { font-size: 15.5px; line-height: 1.6; }
  /* (A quote's or a code block's Kopiuj keeps within its line.) */
  .message-text .block-copy { margin-top: 1px; margin-bottom: 1px; }

  .chat-view .composer-wrap { display: flex; flex-direction: column; padding: 6px 0 10px; }
  .chat-view .composer { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: end; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .chat-view .composer:focus-within { box-shadow: none; }
  .chat-view .composer textarea { grid-column: 1; grid-row: 1; min-height: 48px; max-height: 140px; padding: 12px 16px 12px 50px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); line-height: 1.4; }
  .chat-view .composer textarea:focus { border-color: var(--control); }
  /* The files put on the box: a closed box of their own over the round field. */
  .chat-view .file-chips:not(:empty) { max-height: 177px; margin-bottom: 6px; border-bottom: 1px solid var(--control); border-radius: 14px; }
  /* (Its border closed underneath takes a pixel: the tray's rows keep their room.) */
  .chat-view .file-chips:has(.file-chip--card) { max-height: 264px; }
  /* (Empty, its placeholder keeps the one line: cut with an ellipsis, not under the field's foot.) */
  .chat-view .composer textarea:placeholder-shown { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-view .composer .attach-button { grid-column: 1; grid-row: 1; justify-self: start; align-self: end; position: relative; z-index: 1; width: 44px; height: 44px; margin: 0 0 2px 3px; }
  .chat-view .composer .stop-button { grid-column: 2; grid-row: 1; width: 48px; height: 48px; border-radius: 50%; }
  .chat-view .composer .send-button { grid-column: 3; grid-row: 1; width: 48px; height: 48px; border-radius: 50%; }

  .chat-view.empty::before { flex: 1 1 0px; }
  .chat-view.empty::after { flex: 0 0 0px; min-height: 0; }
  .chat-view.empty .conversation, .chat-view.empty .composer-wrap { max-width: none; }
  .welcome { margin: 0 auto 20px; }
  .welcome h1 { font-size: 34px; line-height: 1.15; letter-spacing: -1px; }
  .chat-view.empty .chat-starters { order: -1; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; margin: 0 -10px 10px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
  .chat-view.empty .chat-suggestion { flex: 0 0 auto; border-radius: 18px; white-space: nowrap; }
}
