/* Skype Reborn web client: the phone apps' layout. One screen at a time on a
   phone; on a wide screen the home screen stays on the left and the open
   conversation (or profile, group, …) shows on the right. */

:root {
  --blue: #0078d4;
  --blue-dark: #005a9e;
  --bar-subtle: #ffffff;
  --page: #ffffff;
  --chat-bg: #f0f2f5;
  --text: #202124;
  --grey: #5f6368;
  --divider: #e1e4e8;
  --red: #c4314b;
  --green: #107c10;
  --away: #e6a000;
  --bubble-out: #dceefc;
  --bubble-in: #ffffff;
  --focus: #ffb900;
  --radius: 14px;
  --home-width: 380px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--page);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Buttons and fields ─────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger {
  border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 600; min-height: 44px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #eef3f8; color: var(--blue-dark); }
.btn-danger { background: #fdecef; color: var(--red); }
.btn-primary.small { padding: 6px 14px; min-height: 36px; }
.btn-link { background: none; border: 0; color: var(--blue); padding: 10px; }
.btn-full { width: 100%; margin-top: 8px; }
.text-btn { background: none; border: 0; color: var(--blue); padding: 8px 10px; min-height: 40px; font-weight: 600; }
.text-btn:disabled { color: #aaa; }
.icon-btn {
  background: none; border: 0; font-size: 22px; width: 44px; height: 44px;
  border-radius: 50%; display: inline-grid; place-items: center; flex: none;
}
.icon-btn.small { width: 36px; height: 36px; font-size: 16px; }
/* The classic blue microphone, drawn white so it shows on the blue button. */
.mic-glyph {
  width: 24px; height: 24px; background: currentColor;
  -webkit-mask: url("../img/mic.png") center / contain no-repeat; mask: url("../img/mic.png") center / contain no-repeat;
}
.profile-picture { width: 96px; height: 96px; border-radius: 12px; align-self: flex-start; margin: 8px 0 4px; }
.round-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--blue); color: #fff; font-size: 20px; display: grid; place-items: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.field-group { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field-group label { font-size: 14px; color: var(--grey); }
.inline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-row select { flex: 1 1 12em; min-width: 0; }
input[type=text], input[type=password], input[type=email], input[type=search], select, textarea {
  border: 1px solid #c8ccd0; border-radius: 10px; padding: 10px 12px; background: #fff; min-height: 44px;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; min-height: 44px; }
.checkbox-row input { width: 22px; height: 22px; }
.auto-away { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.auto-away .checkbox-row { margin: 0; }
/* The Sounds screen: an event's tick box, then its Play button. */
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--divider, #e1e4e8); }
.sound-row .checkbox-row { margin: 4px 0; flex: 1; }

/* ── Sign in ────────────────────────────────────────────────────── */
.login-screen { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--chat-bg); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.login-title { color: var(--blue); margin: 0 0 8px; text-align: center; }
.auth-status { margin-top: 12px; min-height: 1.4em; }
.auth-status.error { color: var(--red); }
.auth-status.success { color: var(--green); }

/* ── App frame ──────────────────────────────────────────────────── */
.app { height: 100%; height: 100dvh; display: flex; }
.view { display: flex; flex-direction: column; height: 100%; min-width: 0; flex: 1; background: var(--page); }

/* Phones: only the screen on top shows. */
@media (max-width: 899px) {
  .app .view { display: none; }
  .app .view.on-top { display: flex; }
  .welcome-view { display: none !important; }
}
/* Wide screens: home on the left, the rest on the right. */
@media (min-width: 900px) {
  .home-view { flex: 0 0 var(--home-width); border-right: 1px solid var(--divider); display: flex !important; }
  .app .view:not(.home-view) { display: none; }
  .app .view.right-pane { display: flex; }
  .app .view .back-btn[data-back-hide-wide] { visibility: hidden; }
}

/* ── Home ───────────────────────────────────────────────────────── */
.home-header {
  background: var(--blue); color: #fff; padding: 12px 16px 12px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.app-title { margin: 0 0 4px; font-size: 24px; }
.profile-btn {
  display: flex; flex-direction: column; align-items: flex-start; background: none; border: 0;
  color: #fff; padding: 6px 0; text-align: left; width: 100%; min-height: 44px;
}
.profile-name { font-weight: 700; font-size: 17px; }
.profile-sub { font-size: 14px; color: var(--bar-subtle); }
.header-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.pill-btn { background: #fff; color: var(--blue); border: 0; border-radius: 18px; padding: 8px 16px; font-weight: 600; min-height: 40px; }
.section-heading { font-size: 22px; margin: 14px 16px 4px; }
.home-status { margin: 0 16px 6px; color: var(--grey); font-size: 14px; }
.tab-panels { flex: 1; overflow-y: auto; min-height: 0; }
.settings-panel { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.settings-note { color: var(--grey); font-size: 14px; margin: 0; }

.tab-bar { border-bottom: 1px solid var(--divider); background: #fff; }   /* above the section heading */
.tab-bar [role=tablist] { display: flex; }
.tab-bar [role=tab] {
  flex: 1; background: none; border: 0; padding: 8px 4px; min-height: 58px; color: var(--grey);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 14px;
}
.tab-bar [role=tab][aria-selected=true] { color: var(--blue); font-weight: 700; }
.tab-icon { font-size: 20px; line-height: 1; }

.conn-banner, .call-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; background: #fff4ce; font-size: 14px;
}
.call-banner { background: #dff6dd; }
.notify-prompt { background: #e8f0fe; color: var(--text, #201f1e); padding: 10px 16px; }
.notify-prompt p { margin: 0 0 8px; }
.form-note { color: var(--grey); font-size: 14px; margin: 4px 0 12px; }
.conn-banner-btn { background: none; border: 1px solid currentColor; border-radius: 8px; padding: 4px 10px; }

/* ── Rows (chats, calls, search results, members) ───────────────── */
.row-list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: stretch; border-bottom: 1px solid var(--divider); }
.row-main {
  flex: 1; display: flex; align-items: center; gap: 12px; background: none; border: 0;
  padding: 12px 8px 12px 16px; text-align: left; min-height: 64px; min-width: 0;
}
.row-main:hover, .row-main.active { background: #f3f7fb; }
.row-main.row-inert { cursor: default; }
.row-main.row-inert:hover { background: none; }
.row-lines { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title.missed { color: var(--red); }
.row-sub { color: var(--grey); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-preview { color: var(--grey); }
.list-tools { padding: 4px 16px 8px; display: flex; gap: 8px; }
.filter-btn { background: #fff; color: var(--blue-dark); border: 1px solid var(--blue); border-radius: 18px; padding: 6px 14px; min-height: 40px; font-weight: 600; }
.filter-btn[aria-pressed=true] { background: var(--blue); color: #fff; }
.hidden-toggle { margin: 8px 8px 0; }
.row-options { background: none; border: 0; width: 48px; font-size: 20px; color: var(--grey); flex: none; }
/* Icons and pictures (web/img, rendered from assets/icons by scripts/client_art.py). */
.status-icon { width: 20px; height: 20px; flex: none; }
.row-icon { width: 24px; text-align: center; flex: none; font-size: 18px; }
img.row-icon { height: auto; }
.group-icon { width: 20px; height: 20px; margin: 0 2px; image-rendering: auto; }
.bar-icon { width: 26px; height: 26px; display: block; }
.badge { background: var(--red); color: #fff; border-radius: 11px; min-width: 22px; padding: 1px 6px; font-size: 12px; text-align: center; flex: none; }
.row-empty { padding: 24px 16px; color: var(--grey); text-align: center; }

/* ── Top bar (conversation and sub-screens) ─────────────────────── */
.top-bar {
  display: flex; align-items: center; gap: 4px; background: var(--blue); color: #fff;
  padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); min-height: 60px;
}
.back-btn { background: none; border: 0; color: #fff; font-size: 34px; width: 44px; height: 44px; line-height: 1; flex: none; }
.top-title { flex: 1; margin: 0; font-size: 20px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar .icon-btn { color: #fff; }
.title-btn { background: none; border: 0; color: #fff; display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; padding: 2px 4px; min-width: 0; }
.title-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.title-sub { font-size: 13px; font-weight: 400; color: var(--bar-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ── Conversation ───────────────────────────────────────────────── */
.chat-view { background: var(--chat-bg); }
.messages-heading { margin: 6px 0 2px; text-align: center; font-size: 13px; color: var(--grey); font-weight: 600; }
.message-list { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 6px 8px 10px; min-height: 0; }
.older-btn { align-self: center; background: #fff; color: var(--blue-dark); border: 1px solid var(--divider); border-radius: 18px; padding: 6px 16px; min-height: 40px; font-weight: 600; margin: 4px 0; }
.search-panel { background: #fff; padding: 4px 12px 8px; border-bottom: 1px solid var(--divider); max-height: 50%; display: flex; flex-direction: column; }
.search-panel .subheading { margin: 6px 0; }
.search-panel input[type=search] { flex: 1 1 10em; min-width: 0; }
.search-results { overflow-y: auto; min-height: 0; }
.msg.found .bubble, .msg.found .call-event { outline: 3px solid var(--focus); outline-offset: 2px; }
.msg { display: flex; margin: 3px 0; align-items: flex-end; gap: 2px; }
.msg.out { justify-content: flex-end; }
.msg.out .msg-options { order: -1; }
.bubble {
  max-width: min(78%, 560px); background: var(--bubble-in); border-radius: var(--radius);
  padding: 7px 12px 5px; box-shadow: 0 1px 1px rgba(0,0,0,.05); overflow-wrap: anywhere;
}
.msg.out .bubble { background: var(--bubble-out); }
/* The message (an option of the list box) is focused: it shows on its bubble or line. */
.msg:focus { outline: none; }
.msg:focus .bubble, .msg:focus .call-event,
.msg:focus-within .bubble, .msg:focus-within .call-event { outline: 3px solid var(--focus); outline-offset: 2px; }
.msg-author { font-size: 13px; font-weight: 700; color: var(--blue); }
.msg-text { white-space: pre-wrap; }
.msg-text.removed { font-style: italic; color: var(--grey); }
.msg-text a { color: var(--blue-dark); text-decoration: underline; overflow-wrap: anywhere; }
.msg-text.contact-card { font-weight: 600; }
.day-heading { list-style: none; text-align: center; margin: 10px 0 4px; }
.day-heading h4 { display: inline-block; margin: 0; font-size: 13px; font-weight: 600; color: var(--grey); background: #e4e8ed; border-radius: 10px; padding: 2px 10px; }
#sendContactChoices { max-height: 50vh; overflow-y: auto; }
/* A call in the conversation: a centred line, not a bubble. */
.msg.event { justify-content: center; }
.call-event { background: #e4e8ed; color: var(--text); border-radius: var(--radius); padding: 5px 12px; font-size: 14px; text-align: center; max-width: 90%; }
.call-event.unanswered { color: var(--red); background: #fbe9ec; }
.call-event.group-event { color: var(--grey); background: transparent; }
.msg-edited { color: var(--grey); font-size: 12px; white-space: nowrap; }
.msg-quote { border-left: 3px solid var(--blue); padding-left: 8px; color: var(--grey); font-size: 14px; margin-bottom: 4px; }
.msg-reactions { margin-top: 3px; font-size: 17px; background: #eceff3; border-radius: 10px; padding: 0 6px; display: inline-block; }
.msg-meta { font-size: 11px; color: var(--grey); text-align: right; margin-top: 2px; }
.msg-meta .read { color: var(--blue); }
.msg-meta .failed { color: var(--red); }
.msg-meta .waiting { color: var(--grey); }
.msg-options { background: none; border: 0; color: var(--grey); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; flex: none; }
.bubble { transition: transform .12s ease-out; }
@media (prefers-reduced-motion: reduce) { .bubble { transition: none; } }
/* Touch screens: no Message actions button; swipe, hold or tap the message instead.
   The message's heading lies over it, so VoiceOver and TalkBack focus the whole
   message and a double tap lands on it. */
@media (pointer: coarse) {
  .msg { position: relative; }
  .msg-options { display: none; }
  .msg .msg-heading {
    position: absolute; inset: 0; width: auto; height: auto; margin: 0; clip: auto;
    white-space: normal; overflow: hidden; color: transparent; font-size: 1px; z-index: 1;
  }
}
.voice-btn { background: none; border: 0; color: var(--blue); font-weight: 600; padding: 4px 0; display: flex; gap: 8px; align-items: center; min-height: 36px; }
.file-link { color: var(--blue); background: none; border: 0; padding: 2px 0; text-decoration: underline; text-align: left; }
.chat-status { margin: 0; padding: 4px 12px; text-align: center; font-size: 13px; color: var(--grey); }
.reply-bar { display: flex; align-items: center; background: #e8f0fe; padding: 4px 8px 4px 12px; }
.reply-label { flex: 1; color: var(--blue-dark); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer, .record-bar {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px; background: #fff;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.record-bar { align-items: center; min-height: 60px; }
.message-input { flex: 1; resize: none; max-height: 140px; border-radius: 22px; padding: 11px 14px; }
.rec-time { color: #d62839; font-size: 18px; font-variant-numeric: tabular-nums; padding: 0 6px; }
.rec-hint { flex: 1; color: var(--grey); font-size: 13px; }

/* ── Forms (profile, find people, groups) ───────────────────────── */
.form-body { padding: 8px 16px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-body > button { align-self: flex-start; }
.form-status { color: var(--grey); min-height: 1.3em; margin: 4px 0; }
.subheading { color: var(--blue); font-size: 15px; margin: 14px 0 4px; }
.people-picker { border: 0; padding: 0; margin: 8px 0; }
.people-picker legend { color: var(--blue); font-weight: 700; margin-bottom: 4px; }
.profile-line { margin: 8px 0; }
/* Contact requests and blocked people: a name, the message, and buttons. */
.plain-list { list-style: none; margin: 0; padding: 0; }
.person-item { border-bottom: 1px solid var(--divider); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.person-name { font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.person-sub { color: var(--grey); font-size: 14px; margin: 0; overflow-wrap: anywhere; }
.person-message { margin: 2px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.person-empty { color: var(--grey); padding: 8px 0; }
.modal-card textarea { resize: vertical; }
.welcome-view { justify-content: center; align-items: center; color: var(--grey); background: var(--chat-bg); }

/* ── Call ───────────────────────────────────────────────────────── */
.call-view { position: fixed; inset: 0; background: #12263a; color: #fff; z-index: 50; overflow-y: auto; display: flex; }
.call-view.hidden { display: none; }
.modal-screen { position: fixed; inset: 0; z-index: 40; display: flex; background: rgba(0,0,0,.45); overflow-y: auto; padding-inline: 16px; }
.modal-screen.hidden { display: none; }
/* Add to Call opens over the call screen. */
.modal-screen.over-call { z-index: 62; }
.add-to-call-people { max-height: 50vh; overflow-y: auto; }
.modal-card { margin: auto; width: 100%; max-width: 420px; background: var(--page); color: var(--text); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.modal-card h2 { margin: 0 0 4px; }
.call-card { margin: auto; width: 100%; max-width: 440px; padding: 32px 20px; text-align: center; }
.call-name { font-size: 30px; margin: 0 0 6px; }
.call-state { color: #aacdeb; font-size: 18px; margin: 0; }
.call-timer { color: #aacdeb; min-height: 1.4em; margin: 4px 0 28px; font-variant-numeric: tabular-nums; }
.call-buttons { display: flex; flex-direction: column; gap: 10px; }
.waiting-bar { background: #344a63; border-radius: 12px; padding: 12px; margin: 0 0 20px; }
.waiting-text { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.waiting-buttons { display: flex; gap: 10px; }
.waiting-buttons .call-btn { flex: 1; }
.call-people-heading { font-size: 15px; color: #aacdeb; margin: 0 0 6px; font-weight: 600; }
.call-people { list-style: none; margin: 0 0 24px; padding: 0; text-align: left; }
.call-people li { padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.08); margin-bottom: 6px; }
.call-btn {
  border: 0; border-radius: 12px; color: #fff; font-size: 18px; font-weight: 700; min-height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
/* The handset icons are decoration: the button's words say what it does. */
.call-btn.answer::before, .call-btn.hangup::before {
  content: ""; width: 24px; height: 24px; flex: none;
  background: url("../img/phone.png") center / contain no-repeat;
}
.call-btn.hangup::before { background-image: url("../img/hang-up.png"); }
.call-btn.answer { background: var(--green); }
.call-btn.hangup { background: var(--red); }
.call-btn.blue { background: var(--blue); }
.call-btn.neutral { background: #344a63; }

/* ── Options menu ───────────────────────────────────────────────── */
/* cursor: pointer, or iOS Safari never sends the tap outside the menu as a click. */
.menu-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 60; cursor: pointer; }
.action-menu .menu-close { border-top: 1px solid #e3e7ec; color: var(--grey); }
.action-menu {
  position: fixed; z-index: 61; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 420px); background: #fff; border-radius: 16px 16px 0 0; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,.2);
}
@media (min-width: 900px) { .action-menu { bottom: auto; top: 30%; border-radius: 16px; } }
.action-menu-title { margin: 6px 16px 8px; color: var(--grey); font-size: 14px; }
.action-menu [role=menuitem] {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 14px 20px; font-size: 17px; min-height: 48px;
}
.action-menu [role=menuitem]:hover, .action-menu [role=menuitem]:focus { background: #eef3f8; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); padding: 0 8px; }
.action-menu .emoji-grid [role=menuitem] { text-align: center; font-size: 28px; padding: 10px 0; }

.toast-container { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: rgba(32,33,36,.92); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 14px; max-width: 90vw; }

/* ── Moderation (docs/moderation.md) ──────────────────────────────────── */
/* The reported message, kept as it was: a quote, never a link. */
.report-snapshot {
    margin: 8px 0;
    padding: 10px 12px;
    border-left: 4px solid var(--divider);
    background: var(--chat-bg);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* What is wrong with a field, beside the field as well as in the status line. */
.field-error { color: var(--red); font-size: 14px; margin: 2px 0 0; }
/* Four tabs at 400px: "Moderation" is the long one, so let it wrap rather than
   shrink the others or abbreviate the label. */
@media (max-width: 420px) {
    .tab-bar [role=tab] { font-size: 13px; }
}
