/* ChatApp web client — dark terminal-ish theme, mirroring the TUI. */

@font-face {
  font-family: valley; /* set name */
  src: url('./valley.ttf'); /* url of the font */
}

@font-face {
  font-family: "Jetrains Mono";
  src: url('./jetbrains.ttf');
}


:root {
  --bg: #eee;
  --panel: #6d99a9;
  --border: #2c3947;
  --text: #4b656e;
  --dim: #4b656e;
  --accent: #4fa3e3;
  --error: #e35d5d;
  --ok: #5dc98a;
}



* { box-sizing: border-box; }

/* The `hidden` attribute must win over every `display` rule in this file:
   author declarations override the UA stylesheet's hidden-attribute rule
   regardless of specificity (author origin beats UA origin), so
   `.screen { display: flex }` would otherwise keep #chat-screen
   (position: fixed, inset: 0) on top of the login card and swallow every
   click ("frozen" page), and #login-screen would stay visible after a
   successful login (M11). */
[hidden] {
  display: none !important;
}

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: valley;

/*  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo,
    Consolas, monospace;*/ 
  font-size: 15px;
}

/* Centered single-panel screens (login / placeholder). */
.screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--panel);
  border: none; //1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
}

#login-screen .card { width: min(420px, 92vw); }

/* The register card (M11) is the same size as the login card. */
#register-screen .card { width: min(420px, 92vw); }

#login-form h1,
#register-form h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
}

#login-form #login-subtitle,
#register-form #register-subtitle {
  font-size: 14px;
  margin: 0 0 18px;
}

#login-form label,
#register-form label {
  display: block;
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 14px 0 4px;
}

#login-form input,
#register-form input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0px;
  padding: 9px 10px;
  font: "courier";
}

#login-form input:focus,
#register-form input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Country autocomplete (M16 follow-up): the register card's country
   field is a text input with a suggestion dropdown below it (app.js
   -> initCountryAutocomplete). */
.country-autocomplete { position: relative; }

#country-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0px;
  max-height: 224px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#country-suggestions li {
  padding: 7px 9px;
  border-radius: 0px;
  cursor: pointer;
  white-space: nowrap;
}

#country-suggestions li.active,
#country-suggestions li:hover {
  background: var(--accent);
  color: #0c1116;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

button {
  flex: 1;
  font: inherit;
  font-weight: 400;
  border-radius: 0px;
  padding: 10px;
  font-family: valley;
  cursor: pointer;
  background: var(--accent);
  color: #0c1116;
  border: 1px solid var(--accent);
}

button:hover:not(:disabled) { filter: brightness(1.1); }

button:disabled { opacity: 0.5; cursor: default; }

#register-btn,
#register-back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.status {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--dim);
}

.status.error { color: var(--error); }
.status.ok { color: var(--ok); }

/* -- Chat screen (M10 step 11) ------------------------------------------- */

.screen.chat {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

#chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  //background: var(--panel);
  background: var(--bg);
  border-bottom: 1px solid #aaa;
  font-weight: 600;
}

#signout-btn {
  margin-left: auto;
  flex: none;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

#chat-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* User list: ~20% of the width (TUI's left pane). */
#user-pane {
  width: 20%;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

#user-list-subtitle {
  padding: 8px 12px;
  color: var(--dim);
  display: none;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

/* M27: public channel buttons — a vertical stack of full-width chips
   above the user list (hidden while no channel is configured). */
#room-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.room-btn {
  flex: none; /* override the base button's flex: 1 */
  width: 100%;
  text-align: left;
  font-weight: 500;
  padding: 7px 10px;
  background: #4b656e ;
  
  border: none; //1px solid var(--border);
  color: #fff; // var(--t);
  
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-btn:hover:not(:disabled) {
  background: #222b35;
  filter: none;
}

.room-btn.selected {
  background: #2a3644;
  border-color: var(--accent);
  color: var(--accent);
}

#user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

#user-list li {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#user-list li:hover { background: #222b35; }

#user-list li.selected { background: #2a3644; color: var(--accent); }

/* M15: struck-through row for a blocked user (the TUI's "strike" style).
   A user in both the friend and the block list shows the ❤ prefix AND
   the strikethrough. */
#user-list li.blocked-row { text-decoration: line-through; }

/* Messages + composer: ~80% of the width (TUI's right pane). */
#chat-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#message-window {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo,
               Consolas, monospace;
  background-color: var(--bg);
}

.msg-line {
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-line .ts { color: var(--dim); }

.welcome-view {
  font-family: inherit;
  font-size: inherit;
  white-space: pre-wrap;
  margin: 0;
}

.status-line {
  padding: 2px 0;
  color: var(--dim);
  font-style: italic;
}

/* M18: the /report confirmation lines (app.js -> addReportNote) —
   display-only, dim + italic like the status lines; the username is
   its own <code> span. Not part of the message history. */
.report-note {
  padding: 2px 0;
  color: var(--dim);
  font-style: italic;
}

/* M20: the self-chat notification (app.js -> renderSelfNote) — the
   own conversation's display-only first line, dim + italic like the
   report notes; the bold word comes from the inner <strong>.
   Not part of the message history. */
.self-note {
  padding: 2px 0;
  color: var(--dim);
  font-style: italic;
}

#composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

#message-input {
  flex: 1;
  resize: none;
  background: var(--bg);
  color: var(--text);
  border: px solid var(--border);
  //border-radius: px;
  padding: 9px 10px;
  font-family: valley;
  font-size: 1.0rem;
}

#message-input:focus { outline: none; border-color: var(--accent); }

#send-btn { flex: none; padding: 10px 18px; }

/* M15: bottom-right toast (a friend coming online), mirroring the TUI's
   ``notify`` position. The [hidden] rule keeps it off-screen. */
/* M17: help/rules docs modal — a web rendering of the TUI's DocsModal
   (fancy.py): a fixed full-viewport overlay (dimmed background,
   flex-centered card, above the toast). The card is 70% of the
   viewport, a flex column: centered bold title, a scrollable body for
   the verbatim document (white-space: pre-wrap keeps the file's own
   line breaks), and a small centered OK button. The [hidden] rule
   keeps the overlay off-screen. */
#docs-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

/* The [hidden] attribute must win over the overlay's own display. */
#docs-modal[hidden] { display: none; }

#docs-modal-card {
  width: 70vw;
  height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}

#docs-modal-title {
  margin: 0 0 10px;
  text-align: center;
  font-weight: 600;
}

#docs-modal-content {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* The base button rule sets flex: 1, which would split the card's
   leftover height with the scrollable body — pin the OK button to a
   small fixed size instead (~3 lines tall, ~10–15% of the card's
   width) and center it under the document. */
#docs-modal-ok {
  flex: none;
  align-self: center;
  width: 10vw;
  height: 65px;
  margin-top: 12px;
}

#toast {
  position: fixed;
  right: 16px;
  bottom: 92px;
  z-index: 10;
  max-width: min(360px, 80vw);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* -- M26: admin broadcast (📢 Admin row + read-only conversation) ----------- */

@keyframes admin-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.broadcast-row {
  animation: admin-blink 1.2s ease-in-out infinite;
}

.broadcast-note {
  font-weight: bold;
}
