/* Enclave theme — dark by default, CSS-custom-property driven so a
   light theme is a one-line variable swap later.

   Loaded once at the top of the document; components extend the
   palette through their Shadow DOM via :host() with CSS variables.
   Telegram's dark palette is the visual reference: deep blue-grays,
   accent blue for self-messages, subtle borders. */

:root {
  color-scheme: dark;

  /* Palette */
  --bg:            #0e1419;     /* app background */
  --bg-elevated:   #141c24;     /* sidebar, elevated surfaces */
  --bg-input:      #1a242d;     /* input row, hover surfaces */
  --bubble-self:   #2b5278;     /* outgoing messages */
  --bubble-other:  #1a242d;     /* incoming messages */
  --bubble-other-text: #e8edf2;
  --bubble-self-text:  #ffffff;

  --fg:            #e8edf2;
  --fg-muted:      #6b7785;
  --fg-dim:        #455260;
  --accent:        #4f8cff;
  --accent-hover:  #6ba0ff;

  --border:        rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --shadow-soft:   0 1px 4px rgba(0, 0, 0, 0.18);
  --shadow-bubble: 0 1px 1px rgba(0, 0, 0, 0.10);
  --shadow-pop:    0 4px 18px rgba(0, 0, 0, 0.45);

  /* Sender-color hash table: 8 perceptually-distinct colors picked
     once. Components compute (sender-name -> 0..7) and look up here. */
  --sender-0: #ff7575;
  --sender-1: #ffba59;
  --sender-2: #ffe066;
  --sender-3: #82e36a;
  --sender-4: #6dd6c4;
  --sender-5: #6ba0ff;
  --sender-6: #c884ff;
  --sender-7: #ff8fbb;

  /* Layout */
  --sidebar-width: 320px;
  --header-height: 56px;
  --input-min-height: 56px;
  --avatar-size: 40px;
  --bubble-radius: 14px;

  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
  --font-mono:  ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.4;
  height: 100%;
  overflow: hidden;          /* the app handles scrolling, not the page */
  overscroll-behavior: none; /* no rubber-band on iOS */
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

input, textarea {
  font: inherit;
  color: inherit;
  background: var(--bg-input);
  border: 0;
  outline: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

::-webkit-scrollbar         { width: 8px; height: 8px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }

/* Connection-state banner — sticky at the top of the app, only
   visible when not connected. */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #4a2020;
  color: #ffd9d9;
  padding: 6px 12px;
  font-size: 13px;
  text-align: center;
  display: none;
}
body[data-state="reconnecting"] .offline-banner,
body[data-state="closed"]       .offline-banner { display: block; }
