/* ==========================================================================
 * Demo Page - Mobile Common Styles
 * ==========================================================================
 * Shared styles for mobile A/B variants: phone frame, mobile status bar,
 * bottom navigation, screen transitions, and mobile-specific overrides.
 *
 * Phone mockup replaces the desktop window mockup on narrow viewports.
 * ========================================================================== */

/* ---------- Show/Hide Desktop vs Mobile Mockup ---------- */
.demo-mockup--desktop {
  display: block;
}

.demo-mockup--desktop[hidden] {
  display: none;
}

.demo-mockup--mobile {
  display: none;
}

.demo-mockup--mobile[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .demo-mockup--desktop:not([hidden]) {
    display: none;
  }
  .demo-mockup--mobile:not([hidden]) {
    display: flex;
    width: 100%;
    justify-content: center;
  }
  .demo-mockup--desktop[hidden] {
    display: none !important;
  }
}

/* Foldable phones (Samsung Z Fold unfolded landscape ≈832–841px) */
@media (pointer: coarse) and (max-width: 884px) and (min-width: 769px) {
  .demo-mockup--desktop:not([hidden]) {
    display: none;
  }
  .demo-mockup--mobile:not([hidden]) {
    display: flex;
    width: 100%;
    justify-content: center;
  }
  .demo-mockup--desktop[hidden] {
    display: none !important;
  }
}

/* ---------- Phone Frame (mobile mockup shell) ---------- */
.demo-phone {
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  background: var(--background-primary);
  border: 3px solid var(--gray-300);
  position: relative;
}

@media (max-width: 768px) {
  .demo-phone {
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* Foldable phones: remove phone frame */
@media (pointer: coarse) and (max-width: 884px) and (min-width: 769px) {
  .demo-phone {
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* ---------- Mobile Status Bar (top of phone) ---------- */
.demo-phone__statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  background: var(--gray-800);
  color: var(--gray-200);
  font-size: 0.7rem;
  font-weight: 600;
  user-select: none;
}

.demo-phone__statusbar-time {
  font-size: 0.72rem;
  font-weight: 700;
}

.demo-phone__statusbar-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
}

/* ---------- Phone Body ---------- */
.demo-phone__body {
  position: relative;
  height: 620px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .demo-phone__body {
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
  }
}

/* Foldable phones: fill viewport */
@media (pointer: coarse) and (max-width: 884px) and (min-width: 769px) {
  .demo-phone__body {
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
  }
}

/* ---------- Screen Container (holds all screens, one visible at a time) ---------- */
.demo-phone__screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.demo-mobile-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  transition: transform 0.3s ease, opacity 0.3s ease;
  background: var(--background-primary);
}

/* Screen states */
.demo-mobile-screen--active {
  transform: translateX(0);
  opacity: 1;
  z-index: 2;
}

.demo-mobile-screen--left {
  transform: translateX(-30%);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.demo-mobile-screen--right {
  transform: translateX(100%);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.demo-mobile-screen--hidden {
  transform: translateX(0);
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Mobile Top Header (per-screen) ---------- */
.demo-mobile-header__logo {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  object-fit: contain;
}

.demo-mobile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--background-primary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 44px;
  z-index: 5;
  position: sticky;
  top: 0;
}

.demo-mobile-header__back {
  background: none;
  border: none;
  color: var(--primary-green);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.demo-mobile-header__back:hover {
  background: var(--gray-100);
}

.demo-mobile-header__title {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-mobile-header__lock {
  font-size: 0.7rem;
  color: var(--primary-green);
  flex-shrink: 0;
}

.demo-mobile-header__info {
  flex: 1;
  min-width: 0;
}

.demo-mobile-header__subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.demo-mobile-header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.demo-mobile-header__actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  border-radius: 50%;
  transition: background var(--transition-fast);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-mobile-header__actions button:hover {
  background: var(--gray-100);
}

/* ---------- Workspace Pill ---------- */
.demo-mobile-ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--gray-100);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 6px;
  vertical-align: middle;
}

.demo-mobile-ws-pill i {
  font-size: 0.5rem;
}

/* ---------- Workspace Dropdown (mobile rooms header) ---------- */
.demo-mobile-ws-dropdown {
  position: relative;
  flex-shrink: 0;
}

.demo-mobile-ws-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--gray-100);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.demo-mobile-ws-dropdown__trigger:hover {
  background: var(--gray-200);
}

.demo-mobile-ws-dropdown__chevron {
  font-size: 0.55rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.demo-mobile-ws-dropdown__chevron.is-open {
  transform: rotate(180deg);
}

.demo-mobile-ws-dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 4px;
  overflow: hidden;
}

.demo-mobile-ws-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.demo-mobile-ws-dropdown__item:hover {
  background: var(--gray-100);
}

.demo-mobile-ws-dropdown__item--active {
  background: var(--gray-100);
  font-weight: 600;
}

.demo-mobile-ws-dropdown__item-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Empty State (mobile Variant B) ---------- */
.demo-mobile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.demo-mobile-empty-state[hidden] {
  display: none;
}

.demo-mobile-empty-state i {
  font-size: 2rem;
  opacity: 0.4;
}

.demo-mobile-empty-state p {
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 240px;
  margin: 0;
}

/* ---------- Bottom Navigation Bar ---------- */
.demo-mobile-bottomnav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--background-primary);
  border-top: 1px solid var(--border-color);
  padding: 4px 0;
  flex-shrink: 0;
  z-index: 10;
  user-select: none;
}

/* Safe area padding on real phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .demo-mobile-bottomnav {
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
}

.demo-mobile-bottomnav__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 600;
  transition: color 0.2s ease;
  position: relative;
}

.demo-mobile-bottomnav__tab i {
  font-size: 1.05rem;
  transition: color 0.2s ease;
}

/* Active tab accent colors (matching desktop nav tabs) */
.demo-mobile-bottomnav__tab--active[data-mobile-tab="rooms"] {
  color: var(--text-primary);
}

.demo-mobile-bottomnav__tab--active[data-mobile-tab="chat"] {
  color: var(--primary-green);
}

.demo-mobile-bottomnav__tab--active[data-mobile-tab="docs"] {
  color: var(--secondary-blue);
}

.demo-mobile-bottomnav__tab--active[data-mobile-tab="tasks"] {
  color: var(--accent-orange);
}

/* Notification badge on tab */
.demo-mobile-bottomnav__badge {
  position: absolute;
  top: 0;
  right: 4px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* Hidden tab (context-aware nav) */
.demo-mobile-bottomnav__tab--hidden {
  display: none;
}

/* ---------- Mobile Workspace Indicator ---------- */
.demo-mobile-ws {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px;
}

.demo-mobile-ws__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--primary-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--gray-800);
  color: var(--gray-200);
  flex-shrink: 0;
}

.demo-mobile-ws__name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- Mobile Room List ---------- */
.demo-mobile-rooms {
  padding: 0;
}

.demo-mobile-rooms__label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.demo-mobile-room {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
  -webkit-tap-highlight-color: transparent;
}

.demo-mobile-room:focus:not(:focus-visible) {
  outline: none;
}

.demo-mobile-room:last-child {
  border-bottom: none;
}

.demo-mobile-room:hover,
.demo-mobile-room:active {
  background: var(--gray-100);
}

.demo-mobile-room--active {
  background: var(--gray-100);
}

.demo-mobile-room__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.demo-mobile-room__icon--private {
  background: rgba(124, 224, 154, 0.1);
}

.demo-mobile-room__icon i {
  font-size: 0.7rem;
}

.demo-mobile-room__info {
  flex: 1;
  min-width: 0;
}

.demo-mobile-room__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-mobile-room__preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.demo-mobile-room__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.demo-mobile-room__time {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.demo-mobile-room__badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- Mobile DM Items ---------- */
.demo-mobile-dm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.demo-mobile-dm:last-child {
  border-bottom: none;
}

.demo-mobile-dm:hover,
.demo-mobile-dm:active {
  background: var(--gray-100);
}

.demo-mobile-dm__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.demo-mobile-dm__info {
  flex: 1;
  min-width: 0;
}

.demo-mobile-dm__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.demo-mobile-dm__preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.demo-mobile-dm__time {
  font-size: 0.68rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ---------- Mobile Chat Messages ---------- */
.demo-mobile-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-mobile-messages__date {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-secondary);
  padding: 4px 0 6px;
  font-weight: 600;
}

/* ---------- Mobile Message Bubble ---------- */
.demo-mobile-msg {
  display: flex;
  gap: 8px;
  padding: 3px 0;
}

.demo-mobile-msg__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.demo-mobile-msg__body {
  flex: 1;
  min-width: 0;
}

.demo-mobile-msg__header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 1px;
}

.demo-mobile-msg__author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.demo-mobile-msg__time {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.demo-mobile-msg__bubble {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.demo-mobile-msg__bubble a {
  color: var(--secondary-blue);
  text-decoration: none;
}

.demo-mobile-msg__attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--gray-100);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.demo-mobile-msg__attachment i {
  color: var(--secondary-blue);
}

/* Own messages */
.demo-mobile-msg--own {
  flex-direction: row-reverse;
}

.demo-mobile-msg--own .demo-mobile-msg__body {
  text-align: right;
}

.demo-mobile-msg--own .demo-mobile-msg__header {
  justify-content: flex-end;
}

.demo-mobile-msg--own .demo-mobile-msg__bubble {
  display: inline-block;
  background: rgba(124, 224, 154, 0.2);
  padding: 6px 10px;
  border-radius: 12px 12px 2px 12px;
  text-align: left;
}

/* Read receipt */
.demo-mobile-msg__receipt {
  font-size: 0.62rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.demo-mobile-msg__receipt i {
  color: var(--secondary-blue);
  margin-right: 2px;
}

/* Reactions */
.demo-mobile-msg__reactions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.demo-mobile-msg__reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--gray-100);
  font-size: 0.68rem;
  cursor: pointer;
}

/* Typing indicator */
.demo-mobile-msg--typing {
  align-items: center;
}

.demo-mobile-msg__typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.demo-mobile-msg__typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: demo-mobile-typing-bounce 1.4s infinite;
}

.demo-mobile-msg__typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.demo-mobile-msg__typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes demo-mobile-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.demo-mobile-msg__typing-text {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ---------- Mobile Chat Input ---------- */
.demo-mobile-input {
  padding: 6px 10px;
  border-top: 1px solid var(--border-color);
  background: var(--background-primary);
  flex-shrink: 0;
}

.demo-mobile-input__row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--background-secondary);
}

.demo-mobile-input__field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: 2px 4px;
}

.demo-mobile-input__field::placeholder {
  color: var(--text-secondary);
}

.demo-mobile-input__btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.85rem;
  border-radius: 50%;
}

.demo-mobile-input__send {
  background: var(--primary-green);
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.demo-mobile-input__encrypted {
  text-align: center;
  font-size: 0.6rem;
  color: var(--text-secondary);
  padding: 2px 0 0;
}

.demo-mobile-input__encrypted i {
  color: var(--primary-green);
  margin-right: 2px;
}

/* ---------- Mobile Search Bar ---------- */
.demo-mobile-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--gray-100);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.demo-mobile-search i {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.demo-mobile-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.82rem;
  color: var(--text-primary);
  width: 100%;
}

.demo-mobile-search input::placeholder {
  color: var(--text-secondary);
}

/* ---------- Mobile Floating Action Button ---------- */
.demo-mobile-fab {
  position: absolute;
  bottom: 70px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-green);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 8;
}

.demo-mobile-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* ---------- Phone Top Toolbar (close + A/B toggle) ---------- */
.demo-phone__toolbar {
  display: none; /* shown only in fullscreen via demo-embed.css */
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #1e293b; /* hardcoded — var(--gray-800) flips to white in dark mode */
  border-bottom: 1px solid rgba(124, 224, 154, 0.15);
  flex-shrink: 0;
}

.demo-phone__toolbar-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(124, 224, 154, 0.15);
  color: var(--primary-green);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.demo-phone__toolbar-close:hover {
  background: rgba(124, 224, 154, 0.25);
  color: var(--primary-green-light);
}

/* ---------- Mobile A/B Toggle ---------- */
.demo-mobile-ab-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}

.demo-mobile-ab-toggle__label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--gray-200);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.demo-mobile-ab-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.demo-mobile-ab-toggle__track {
  position: relative;
  display: flex;
  align-items: center;
  width: 36px;
  height: 18px;
  border-radius: 10px;
  background: var(--gray-600);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.demo-mobile-ab-toggle__thumb {
  position: absolute;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--white, #fff);
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
  transition: left var(--transition-fast);
}

.demo-mobile-ab-toggle__input:checked ~ .demo-mobile-ab-toggle__track {
  background: var(--primary-green, #7ce09a);
}

.demo-mobile-ab-toggle__input:checked ~ .demo-mobile-ab-toggle__track .demo-mobile-ab-toggle__thumb {
  left: 20px;
}

.demo-mobile-ab-toggle__letter {
  font-size: 0.55rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
  line-height: 18px;
  position: relative;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  color: transparent;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.demo-mobile-ab-toggle__input:not(:checked) ~ .demo-mobile-ab-toggle__track .demo-mobile-ab-toggle__letter--b {
  opacity: 1;
  color: var(--gray-200);
}

.demo-mobile-ab-toggle__input:checked ~ .demo-mobile-ab-toggle__track .demo-mobile-ab-toggle__letter--a {
  opacity: 1;
  color: rgba(15, 23, 42, 0.72);
}

/* ---------- Mobile Chat View Layout ---------- */
.demo-mobile-chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.demo-mobile-chat-screen .demo-mobile-messages {
  flex: 1;
  overflow-y: auto;
}

/* Ensure hidden chat rooms stay hidden even in flex context */
.demo-mobile-chat-screen .demo-mobile-messages[hidden] {
  display: none;
}

.demo-mobile-chat-screen .demo-mobile-input {
  flex-shrink: 0;
}

/* ---------- Mobile Docs View ---------- */
.demo-mobile-docs {
  padding: 12px 14px;
  overflow-y: auto;
}

.demo-mobile-docs__editor {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.demo-mobile-docs__editor h1 {
  font-size: 1.2rem;
  margin: 0 0 8px;
}

.demo-mobile-docs__editor h2 {
  font-size: 1rem;
  margin: 12px 0 6px;
  color: var(--text-primary);
}

.demo-mobile-docs__editor h3 {
  font-size: 0.9rem;
  margin: 10px 0 4px;
}

.demo-mobile-docs__editor p {
  margin: 4px 0;
}

.demo-mobile-docs__editor ul {
  padding-left: 20px;
  margin: 4px 0;
}

.demo-mobile-docs__editor li {
  margin: 2px 0;
}

.demo-mobile-docs__editor ol {
  padding-left: 20px;
  margin: 4px 0;
}

.demo-mobile-docs__editor code {
  background: var(--gray-100);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.8rem;
}

.demo-mobile-docs__editor[contenteditable="true"] {
  cursor: text;
  outline: none;
  border-radius: 6px;
  transition: box-shadow 0.2s ease;
}

.demo-mobile-docs__editor[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px var(--primary-green, #7ce09a);
}

/* ---------- Mobile Docs Editing Toolbar (Variant B) ---------- */
.demo-mobile-docs-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color, #334155);
  background: var(--bg-secondary, #1e293b);
  flex-shrink: 0;
}

.demo-mobile-docs-toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.75rem;
  cursor: pointer;
}

.demo-mobile-docs-toolbar button:hover {
  background: var(--gray-100, #334155);
  color: var(--text-primary, #e2e8f0);
}

.demo-mobile-docs-toolbar__sep {
  width: 1px;
  height: 18px;
  background: var(--border-color, #334155);
  margin: 0 4px;
}

/* ---------- Mobile Docs List & Detail (Variant B) ---------- */
.demo-mobile-docs-list,
.demo-mobile-docs-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.demo-mobile-docs-list[hidden],
.demo-mobile-docs-detail[hidden] {
  display: none;
}

/* Back button in docs detail header (right corner) */
.demo-mobile-docs-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border-color, #334155);
  border-radius: 6px;
  background: transparent;
  color: var(--primary-green, #7ce09a);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.demo-mobile-docs-back-btn:hover {
  background: var(--gray-100, #334155);
}

.demo-mobile-docs-items {
  padding: 0;
}

.demo-mobile-docs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.demo-mobile-docs-item:hover,
.demo-mobile-docs-item:active {
  background: var(--gray-100);
}

.demo-mobile-docs-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(74, 144, 226, 0.1);
  color: var(--secondary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.demo-mobile-docs-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-mobile-docs-item__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-mobile-docs-item__meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.demo-mobile-docs-item__arrow {
  font-size: 0.65rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ---------- Mobile Kanban/Tasks View ---------- */
.demo-mobile-kanban {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-mobile-kanban__column {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 8px;
}

.demo-mobile-kanban__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
}

.demo-mobile-kanban__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.demo-mobile-kanban__count {
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: var(--gray-200);
  padding: 1px 6px;
  border-radius: 10px;
}

.demo-mobile-kanban__card {
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}

.demo-mobile-kanban__card:last-child {
  margin-bottom: 0;
}

.demo-mobile-kanban__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.demo-mobile-kanban__badge--feature { background: rgba(124, 224, 154, 0.15); color: var(--primary-green-dark, #5cb877); }
.demo-mobile-kanban__badge--bug { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.demo-mobile-kanban__badge--docs { background: rgba(74, 144, 226, 0.1); color: var(--secondary-blue); }
.demo-mobile-kanban__badge--design { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.demo-mobile-kanban__badge--urgent { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.demo-mobile-kanban__badge--okr { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.demo-mobile-kanban__badge--hiring { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.demo-mobile-kanban__badge--budget { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.demo-mobile-kanban__badges {
  display: flex;
  gap: 4px;
}

.demo-mobile-kanban__desc {
  font-size: 0.78rem;
  color: var(--text-primary);
  margin: 0;
}

.demo-mobile-kanban__assignee {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-top: 6px;
}

.demo-mobile-kanban__assignees {
  display: flex;
  gap: -4px;
  margin-top: 6px;
}

.demo-mobile-kanban__assignees .demo-mobile-kanban__assignee {
  margin-top: 0;
  margin-left: -4px;
}

.demo-mobile-kanban__assignees .demo-mobile-kanban__assignee:first-child {
  margin-left: 0;
}

/* ---------- Mobile Task Board (Variant B list layout) ---------- */
.demo-mobile-taskboard {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.demo-mobile-taskboard[hidden] {
  display: none;
}

.demo-mobile-taskboard__project-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  padding: 4px 2px 0;
}

.demo-mobile-taskboard__section {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}

/* Section Header (colored bar) */
.demo-mobile-taskboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: none;
  cursor: pointer;
  user-select: none;
  color: #fff;
  font-family: inherit;
}

.demo-mobile-taskboard__header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-mobile-taskboard__header-icon {
  font-size: 1.1rem;
}

.demo-mobile-taskboard__header-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.demo-mobile-taskboard__header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-mobile-taskboard__header-count {
  font-size: 0.85rem;
  font-weight: 600;
}

.demo-mobile-taskboard__header-chevron {
  font-size: 0.7rem;
  transition: transform 0.25s ease;
}

/* Collapsed state */
.demo-mobile-taskboard__section--collapsed .demo-mobile-taskboard__header-chevron {
  transform: rotate(-90deg);
}

.demo-mobile-taskboard__section--collapsed .demo-mobile-taskboard__cards {
  display: none;
}

/* Header color variants (BRBack palette) */
.demo-mobile-taskboard__header--backlog {
  background: var(--gray-500, #64748b);
}

.demo-mobile-taskboard__header--todo {
  background: var(--secondary-blue, #4a90e2);
}

.demo-mobile-taskboard__header--inprogress {
  background: var(--accent-orange, #ff6b35);
}

.demo-mobile-taskboard__header--done {
  background: var(--primary-green-dark, #5cb877);
}

/* Task Cards Container */
.demo-mobile-taskboard__cards {
  background: var(--background-primary);
}

/* Individual Task Card */
.demo-mobile-taskboard__card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-primary);
}

.demo-mobile-taskboard__card:last-child {
  border-bottom: none;
}

/* Card Icon */
.demo-mobile-taskboard__card-icon {
  font-size: 1rem;
  color: var(--text-secondary);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.demo-mobile-taskboard__card-icon--red { color: var(--accent-red, #ef4444); }
.demo-mobile-taskboard__card-icon--green { color: var(--primary-green-dark, #5cb877); }
.demo-mobile-taskboard__card-icon--blue { color: var(--secondary-blue, #4a90e2); }
.demo-mobile-taskboard__card-icon--orange { color: var(--accent-orange, #ff6b35); }

/* Card Info */
.demo-mobile-taskboard__card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.demo-mobile-taskboard__card-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Card Badge */
.demo-mobile-taskboard__card-badge {
  display: inline-block;
  width: fit-content;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
}

.demo-mobile-taskboard__card-badge--high {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red, #ef4444);
}

.demo-mobile-taskboard__card-badge--review {
  background: rgba(74, 144, 226, 0.12);
  color: var(--secondary-blue, #4a90e2);
}

/* Card sub-task progress */
.demo-mobile-taskboard__card-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0 6px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Card Menu (three dots) */
.demo-mobile-taskboard__card-menu {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 4px 6px;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.demo-mobile-taskboard__card-menu:hover {
  background: var(--gray-100);
}

/* ---------- Admin badge ---------- */
.demo-mobile-msg__badge-role {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(74, 144, 226, 0.15);
  color: var(--secondary-blue);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Unread separator */
.demo-mobile-messages__unread {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-red);
}

.demo-mobile-messages__unread::before,
.demo-mobile-messages__unread::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--accent-red);
  opacity: 0.4;
}

/* ---------- Join button in rooms screen ---------- */
.demo-mobile-join-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px 14px;
  padding: 8px;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  transition: border-color var(--transition-fast), color var(--transition-fast);
  width: calc(100% - 28px);
}

.demo-mobile-join-btn:hover {
  border-color: var(--primary-green);
  color: var(--primary-green);
}

/* ---------- Join Room Modal ---------- */
.demo-mobile-join-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.5);
}

.demo-mobile-join-modal[hidden] {
  display: none;
}

.demo-mobile-join-modal__panel {
  width: 100%;
  max-height: 85%;
  border-radius: 14px 14px 0 0;
  background: var(--bg-primary, #0f172a);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-mobile-join-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.demo-mobile-join-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}

.demo-mobile-join-modal__close {
  background: none;
  border: none;
  color: var(--text-secondary, #94a3b8);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.demo-mobile-join-modal__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--gray-100, #1e293b);
}

.demo-mobile-join-modal__search i {
  color: var(--text-secondary, #94a3b8);
  font-size: 0.75rem;
}

.demo-mobile-join-modal__search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary, #e2e8f0);
  font-size: 0.8rem;
  font-family: inherit;
}

.demo-mobile-join-modal__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color, #334155);
  padding: 0 14px;
}

.demo-mobile-join-modal__tab {
  flex: 0;
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.demo-mobile-join-modal__tab--active {
  color: var(--text-primary, #e2e8f0);
  border-bottom-color: var(--primary-green, #7ce09a);
}

.demo-mobile-join-modal__content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 14px;
}

/* Discover tab — room list */
.demo-mobile-join-modal__room {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #334155);
}

.demo-mobile-join-modal__room:last-child {
  border-bottom: none;
}

.demo-mobile-join-modal__room-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
}

.demo-mobile-join-modal__room-icon--private {
  font-size: 0.85rem;
}

.demo-mobile-join-modal__room-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-mobile-join-modal__room-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}

.demo-mobile-join-modal__room-desc {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
}

.demo-mobile-join-modal__room-action {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #334155);
  background: transparent;
  color: var(--text-primary, #e2e8f0);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.demo-mobile-join-modal__room-action:hover {
  border-color: var(--primary-green, #7ce09a);
  color: var(--primary-green, #7ce09a);
}

.demo-mobile-join-modal__room-action--knock {
  border-color: var(--border-color, #334155);
}

/* Create tab — form */
.demo-mobile-join-modal__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  margin: 12px 0 6px;
}

.demo-mobile-join-modal__label:first-child {
  margin-top: 4px;
}

.demo-mobile-join-modal__input,
.demo-mobile-join-modal__textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #334155);
  background: var(--gray-100, #1e293b);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.demo-mobile-join-modal__input:focus,
.demo-mobile-join-modal__textarea:focus {
  border-color: var(--primary-green, #7ce09a);
}

.demo-mobile-join-modal__textarea {
  resize: none;
}

.demo-mobile-join-modal__type-toggle {
  display: flex;
  gap: 8px;
}

.demo-mobile-join-modal__type-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #334155);
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.demo-mobile-join-modal__type-btn--active {
  border-color: var(--primary-green, #7ce09a);
  color: var(--text-primary, #e2e8f0);
}

.demo-mobile-join-modal__create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--primary-green, #7ce09a);
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

/* ---- Tasks List / Board Pane (both Mobile Variants) ---- */
.demo-mobile-tasks-list,
.demo-mobile-tasks-board {
  display: flex;
  flex-direction: column;
}

.demo-mobile-tasks-list[hidden],
.demo-mobile-tasks-board[hidden] {
  display: none;
}

.demo-mobile-tasks-list__items {
  display: flex;
  flex-direction: column;
}

.demo-mobile-tasks-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.demo-mobile-tasks-list__item[hidden] {
  display: none;
}

.demo-mobile-tasks-list__item:active {
  background: var(--gray-100);
}

.demo-mobile-tasks-list__item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border-radius: 8px;
  color: var(--primary-green);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.demo-mobile-tasks-list__item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.demo-mobile-tasks-list__item-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-mobile-tasks-list__item-meta {
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.demo-mobile-tasks-list__item-arrow {
  color: var(--text-secondary);
  font-size: 0.72rem;
  flex-shrink: 0;
}
