/* Hayyak chat: the citizen's chat with the Hayyak Assistant, in Hayyak maroon. The phone frame,
   the status bar, the app bar and the language toggle come from ../shared/phone.css.
   Directional styles use logical properties, so dir="rtl" mirrors the whole page. */
:root {
  --app: #8a1538;
  --app-press: #6f102c;
  --app-soft: rgb(138 21 56 / 0.08);
  --app-line: rgb(138 21 56 / 0.3);
  --app-ring: rgb(138 21 56 / 0.35);
  --bubble: #ffffff;
}

/* The header: the Hayyak mark, the title, Verified once the ID check passed, New chat. */
.app-sub { display: block; }
.verified-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin-top: 3px;
  padding: 1px 8px 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ok);
  background: var(--ok-soft);
  animation: enter var(--dur) var(--ease) both;
}
.verified-chip svg { width: 12px; height: 12px; }
.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--fill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--fill-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:focus-visible { outline: 2px solid var(--app-ring); outline-offset: 1px; }

/* Messages */
.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 10px;
  scrollbar-width: none;
}
.msgs::-webkit-scrollbar { display: none; }
.notice { align-self: center; max-width: 88%; margin: 0 0 6px; padding: 6px 12px; border-radius: 12px; font-size: 11.5px; text-align: center; color: var(--ink-3); background: var(--fill); }
.m {
  flex: none;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: pop var(--dur) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
/* align-self follows the writing direction: the Agent on the start side, the citizen on the end side. */
.m.bot { align-self: flex-start; background: var(--bubble); box-shadow: var(--shadow-card); border-end-start-radius: 6px; }
.m.user { align-self: flex-end; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--app) 86%, #fff), var(--app) 70%); border-end-end-radius: 6px; }
.m p { margin: 0; }
.m p + p { margin-top: 7px; }
.m .line { display: block; }
.m strong { font-weight: 650; }
.m a { color: inherit; }
.m bdi { font-variant-numeric: tabular-nums; white-space: nowrap; }
.m.user.photo { padding: 4px; }
.m.user.photo img { display: block; width: 200px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; }
.m.user.photo .caption { padding: 4px 8px 2px; font-size: 12.5px; }
.m.user.photo.sending img { opacity: 0.6; }
.m.err { align-self: center; display: flex; align-items: center; gap: 10px; max-width: 94%; font-size: 13px; color: var(--stop); background: var(--stop-soft); }
.m.err button { flex: none; }

.typing { flex: none; align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-radius: 20px; border-end-start-radius: 6px; background: var(--bubble); box-shadow: var(--shadow-card); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
.typing span { font-size: 12.5px; color: var(--ink-3); }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

/* A confirmation the Agent waits on (an action that needs the citizen's yes). */
.m.confirm { display: flex; flex-direction: column; gap: 10px; width: 86%; padding: 14px; }
.m.confirm h4 { margin: 0; font-size: 13px; font-weight: 650; color: var(--ink-3); text-transform: none; }
.m.confirm p { font-weight: 600; }
.m.confirm .row { gap: 8px; }
.m.confirm .settled { font-size: 13px; color: var(--ink-3); }
.m.confirm button.primary, .m.confirm button.secondary { min-height: 42px; border-radius: 12px; font-size: 14.5px; }

/* Quick replies */
.qr { display: flex; flex: none; flex-wrap: wrap; gap: 6px; max-height: 128px; overflow-y: auto; padding: 4px 14px 10px; }
.qr:empty { display: none; }
.qr button, .pill-btn {
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: start;
  color: var(--app);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--app-line), 0 2px 8px -4px rgb(0 0 0 / 0.12);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.qr button:hover, .pill-btn:hover { background: var(--app-soft); }
/* Not the full-width button.primary of phone.css. */
.qr button.primary { width: auto; min-height: 34px; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: #fff; background: var(--app); box-shadow: 0 6px 14px -8px var(--app); }
.qr button.primary:hover { background: var(--app-press); }
.qr button:disabled { opacity: 0.45; cursor: default; }

/* Composer: a floating pill, like the pages' tab bar */
.composer {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  margin: 0 12px calc(10px + var(--home));
  padding: 5px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-float);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.composer:focus-within { box-shadow: var(--shadow-float), 0 0 0 3px var(--app-ring); }
.composer input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 0;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  outline: none;
}
.round { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; }
.round svg { width: 19px; height: 19px; }
.round.attach { color: var(--ink-2); background: transparent; transition: background var(--dur-fast) var(--ease); }
.round.attach:hover { background: var(--fill); }
.round.send { color: #fff; background: var(--app); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.round.send:not(:disabled):active { transform: scale(0.94); }
.round:disabled { opacity: 0.3; cursor: default; }
.round:focus-visible, .qr button:focus-visible { outline: 3px solid var(--app-ring); outline-offset: 2px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* Sheets: the photo and the pin */
.scrim { position: absolute; inset: 0; z-index: 34; background: rgb(0 0 0 / 0.32); animation: fade var(--dur) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 80%;
  overflow-y: auto;
  padding: 10px 16px calc(20px + var(--home));
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -10px 30px rgb(0 0 0 / 0.25);
  animation: rise var(--dur) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(30px); } }
.sheet::before { content: ""; flex: none; align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.sheet h3 { margin: 4px 0 0; font-size: 12px; font-weight: 650; color: var(--ink-3); }
.link { padding: 4px 2px; border: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--app); background: none; cursor: pointer; }
.device { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px dashed var(--app-line); border-radius: var(--radius-ctl); font: inherit; font-size: 14.5px; font-weight: 600; color: var(--app); background: var(--app-soft); cursor: pointer; }
.device svg { width: 20px; height: 20px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid button { padding: 0; border: 0; font: inherit; text-align: start; background: none; cursor: pointer; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; box-shadow: 0 0 0 0.5px var(--line); }
.photo-grid small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.pin-list { display: flex; flex-direction: column; gap: 6px; }
.pin-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--radius-ctl);
  font: inherit;
  text-align: start;
  background: var(--ground);
  cursor: pointer;
}
.pin-list button:hover { background: var(--app-soft); }
.pin-list svg { flex: none; width: 20px; height: 20px; color: var(--app); }
.pin-list b { display: block; font-size: 14px; font-weight: 600; }
.pin-list small { display: block; font-size: 12px; color: var(--ink-3); }
.pin-typed { display: flex; gap: 8px; }
.pin-typed input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl); font: inherit; outline: none; }
.pin-typed input:focus { border-color: var(--app); }
