/* BroLink — style minimaliste type "WhatsApp simplifié".
 * Aucune ressource externe : polices système uniquement. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #e7e2d8;
  --header: #075e54;
  --header-text: #ffffff;
  --mine: #d9fdd3;
  --theirs: #ffffff;
  --ink: #1b1b1b;
  --muted: #667;
  --accent: #128c7e;
  --danger: #c0392b;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
}

.screen { height: 100dvh; }
.center { display: flex; align-items: center; justify-content: center; padding: 16px; }
.column { display: flex; flex-direction: column; }

/* ---------- écran d'entrée / fin ---------- */

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 30px rgba(0,0,0,.12);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.card h1 { font-size: 1.6rem; }
.card .sub { color: var(--muted); font-size: .9rem; line-height: 1.4; margin-bottom: 8px; white-space: pre-line; }

/* sélecteur de langue */
.langs { display: flex; justify-content: center; gap: 6px; margin-bottom: 4px; }
.lang {
  background: #eef1f3;
  border: 1px solid #d5dadd;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .85rem;
  font-weight: 600;
  color: #445;
  cursor: pointer;
}
.lang.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.card label { text-align: left; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.card input {
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 1rem;
  width: 100%;
}
.card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.card button {
  margin-top: 14px;
  padding: 13px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
.card button:disabled { opacity: .6; cursor: wait; }
.error { color: var(--danger); font-size: .88rem; }
.status { color: var(--muted); font-size: .88rem; }

/* ---------- en-tête du chat ---------- */

header {
  background: var(--header);
  color: var(--header-text);
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.head-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#peer-status {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* double horloge Paris / Pékin */
.clocks {
  font-size: .74rem;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip {
  background: rgba(255,255,255,.18);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
}
#btn-destroy {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- panneau code de sécurité ---------- */

#sas-panel {
  background: #fff8e1;
  border-bottom: 1px solid #e8d9a0;
  padding: 12px 16px;
  font-size: .85rem;
  line-height: 1.45;
  flex-shrink: 0;
}
#sas-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.15rem;
  letter-spacing: 1px;
  text-align: center;
  margin: 10px 0 4px;
  user-select: all;
}
.small { color: var(--muted); font-size: .75rem; text-align: center; }

/* ---------- bandeaux d'alerte ---------- */

#banners { flex-shrink: 0; }
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-size: .87rem;
  line-height: 1.35;
}
.banner.warn  { background: #fff3cd; color: #664d03; }
.banner.error { background: #f8d7da; color: #58151c; }
.banner-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: inherit; flex-shrink: 0;
}

/* ---------- messages ---------- */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sysline {
  align-self: center;
  background: rgba(0,0,0,.07);
  color: #444;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: .78rem;
  margin: 6px 0;
  text-align: center;
}
.msg {
  max-width: 78%;
  border-radius: 12px;
  padding: 7px 11px 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
  word-break: break-word;
}
.msg.mine   { align-self: flex-end;   background: var(--mine); border-bottom-right-radius: 3px; }
.msg.theirs { align-self: flex-start; background: var(--theirs); border-bottom-left-radius: 3px; }
.msg .author { font-size: .72rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.msg.mine .author { color: #3d7a3d; }
.msg .times {
  font-size: .66rem;
  color: #8a94a0;
  text-align: right;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.msg .body p { font-size: .95rem; line-height: 1.35; white-space: pre-wrap; }
.progress { font-size: .78rem; color: var(--muted); margin-top: 4px; }
img.preview {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  margin-top: 6px;
}
a.download {
  display: inline-block;
  margin-top: 6px;
  font-size: .85rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- zone de saisie ---------- */

footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: #f0f0f0;
  flex-shrink: 0;
}
footer input {
  flex: 1;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  background: #fff;
}
footer input:focus { outline: 2px solid var(--accent); }
footer button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
#btn-attach { background: #dfe3e6; }
#btn-send { background: var(--accent); color: #fff; }
footer button:disabled { opacity: .45; cursor: not-allowed; }
