/* SPDX-License-Identifier: AGPL-3.0-only */
/* The web app shell's own UI (web/shell): full-window screens ("Use here",
   database errors), the connection status, the update and notification
   banners. Desktop's stylesheets style everything else. */

:root {
  --web-shell-bg: #ffffff;
  --web-shell-fg: #1b1b1b;
  --web-shell-muted: #5e5e5e;
  --web-shell-card: #f6f6f6;
  --web-shell-border: #dedede;
  --web-shell-accent: #2c6bed;
  --web-shell-accent-fg: #ffffff;
  --web-shell-banner: #f6f6f6;
  --web-shell-warn: #fff4d6;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-theme) {
    --web-shell-bg: #121212;
    --web-shell-fg: #e9e9e9;
    --web-shell-muted: #a8a8a8;
    --web-shell-card: #1f1f1f;
    --web-shell-border: #3b3b3b;
    --web-shell-accent: #2c6bed;
    --web-shell-accent-fg: #ffffff;
    --web-shell-banner: #2e2e2e;
    --web-shell-warn: #3a3018;
  }
}

body.dark-theme {
  --web-shell-bg: #121212;
  --web-shell-fg: #e9e9e9;
  --web-shell-muted: #a8a8a8;
  --web-shell-card: #1f1f1f;
  --web-shell-border: #3b3b3b;
  --web-shell-accent: #2c6bed;
  --web-shell-accent-fg: #ffffff;
  --web-shell-banner: #2e2e2e;
  --web-shell-warn: #3a3018;
}

.web-shell {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--web-shell-fg);
  box-sizing: border-box;
}

.web-shell *,
.web-shell *::before,
.web-shell *::after {
  box-sizing: inherit;
}

.web-shell button {
  font: inherit;
  cursor: pointer;
}

.web-shell a {
  color: var(--web-shell-accent);
}

.web-shell__button {
  border: 0;
  border-radius: 20px;
  padding: 8px 20px;
  font-weight: 600;
  background: var(--web-shell-accent);
  color: var(--web-shell-accent-fg);
}

.web-shell__button--secondary {
  background: transparent;
  color: var(--web-shell-accent);
  box-shadow: inset 0 0 0 1px var(--web-shell-border);
}

.web-shell__button--danger {
  background: #c5221f;
  color: #ffffff;
}

.web-shell__button:focus-visible {
  outline: 2px solid var(--web-shell-accent);
  outline-offset: 2px;
}

/* Full-window screens. */
.web-shell-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
  background: var(--web-shell-bg);
  text-align: center;
  overflow-y: auto;
}

.web-shell-screen__logo {
  width: 72px;
  height: 72px;
  -webkit-mask: url('images/signal-logo.svg') no-repeat center / 100%;
  mask: url('images/signal-logo.svg') no-repeat center / 100%;
  background-color: var(--web-shell-accent);
}

.web-shell-screen__title {
  margin: 0;
  max-width: 520px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.web-shell-screen__text {
  margin: 0;
  max-width: 520px;
  color: var(--web-shell-muted);
  font-size: 15px;
  line-height: 1.5;
}

.web-shell-screen__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.web-shell-screen__footer,
.web-shell-footer {
  color: var(--web-shell-muted);
  font-size: 12px;
  line-height: 1.5;
}

.web-shell-screen__footer {
  margin-top: 24px;
}

/* Connection status: a card while nothing else is on screen, a banner
   above the link screen. */
.web-shell-status {
  position: fixed;
  z-index: 99000;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.web-shell-status--card {
  inset: 0;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  background: var(--web-shell-bg);
  text-align: center;
}

.web-shell-status--card .web-shell-status__title {
  font-size: 20px;
  font-weight: 600;
}

.web-shell-status--banner {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--web-shell-warn);
  box-shadow: 0 1px 4px rgb(0 0 0 / 15%);
}

.web-shell-status__detail {
  color: var(--web-shell-muted);
  font-size: 13px;
}

.web-shell-spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2.5px solid var(--web-shell-border);
  border-top-color: var(--web-shell-accent);
  border-radius: 50%;
  animation: web-shell-spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .web-shell-spinner {
    animation-duration: 3s;
  }
}

@keyframes web-shell-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Banners (update available, notifications, install). */
.web-shell-banner {
  position: fixed;
  z-index: 99500;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--web-shell-banner);
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
  font-size: 14px;
  line-height: 1.4;
}

.web-shell-banner--top {
  top: 12px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
}

.web-shell-banner__text {
  flex: 1;
  min-width: 0;
}

.web-shell-banner__text strong {
  display: block;
}

.web-shell-banner__link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--web-shell-accent);
  font-weight: 600;
  text-align: start;
}

.web-shell-banner__close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--web-shell-muted);
  font-size: 18px;
  line-height: 1;
}

/* The notice under the link screen. */
.web-shell-footer {
  position: fixed;
  z-index: 99100;
  left: 0;
  right: 0;
  bottom: 8px;
  padding: 0 16px;
  text-align: center;
}

.web-shell-footer p {
  margin: 2px 0;
}

/* The debug log view, and its link under the link screen. */
.web-shell-debuglog {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 45%);
}

.web-shell-debuglog__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(900px, 100%);
  height: min(720px, 100%);
  padding: 20px;
  border-radius: 12px;
  background: var(--web-shell-bg);
  box-shadow: 0 4px 24px rgb(0 0 0 / 25%);
}

.web-shell-debuglog__title {
  margin: 0;
  font-size: 20px;
}

.web-shell-debuglog__hint {
  margin: 0;
  color: var(--web-shell-muted);
  font-size: 13px;
}

.web-shell-debuglog__text {
  flex: 1;
  min-height: 0;
  width: 100%;
  resize: none;
  padding: 8px;
  border: 1px solid var(--web-shell-border);
  border-radius: 6px;
  background: var(--web-shell-card);
  color: var(--web-shell-fg);
  font: 12px/1.4 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  white-space: pre;
}

.web-shell-debuglog__buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.web-shell-debuglog__status {
  margin-right: auto;
  color: var(--web-shell-muted);
  font-size: 13px;
}

.web-shell__button:disabled {
  opacity: 0.5;
  cursor: default;
}

.web-shell-debuglog-link {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 99000;
  max-width: calc(100vw - 32px);
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--web-shell-muted);
  font: 12px Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-decoration: underline;
  cursor: pointer;
}
