/*
 * ============================================================================
 * XChat — Presence UI
 * ============================================================================
 *
 * Единственный stylesheet базового presence-компонента.
 *
 * ДАННЫЕ:
 *   backend/src/chat/presence.js
 *
 * CLIENT MODEL / RENDER:
 *   frontend/public/js/chat/presence.js
 *
 * PRESENTATION:
 *   этот файл
 *
 * MOBILE:
 *   frontend/public/css/mobile.css
 *
 * ВАЖНО:
 *   mobile.css может менять только layout/размеры presence.
 *   Нельзя создавать отдельный mobile renderer списка пользователей.
 * ============================================================================
 */

.xc-live-presence {
  box-sizing: border-box;
  width: 100%;
  padding: 3px 4px 4px;

  font: 12px Verdana, Arial, sans-serif;
  color: #cfcfcf;

  background: transparent;
}

.xc-live-users-list {
  line-height: 1.32;
  overflow: hidden;
}


/* --------------------------------------------------------------------------
   USER ROW
   -------------------------------------------------------------------------- */

.xc-live-user {
  display: block;

  min-height: 15px;

  cursor: pointer;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  text-decoration: none;
}

/*
 * XCHAT_USERS_PRIVATE_ARROW_VISUAL_V4
 *
 * Whole user row remains clickable as normal [nick],
 * but it must not visually merge with the private >> shortcut.
 */
.xc-live-user:hover {
  background: rgba(255, 255, 255, 0.08);

  text-decoration: none;

  filter: brightness(1.25);
}

/*
 * Hovering anywhere on the normal user row visually highlights
 * the nickname, while >> remains its own independent private link.
 */
#usersBox
.xc-live-user:hover
.xc-live-user-nick {
  text-decoration: underline;
}


/* --------------------------------------------------------------------------
   PRIVATE SHORTCUT >>
   -------------------------------------------------------------------------- */

/*
 * XCHAT_USERS_LAYOUT_V5
 *
 * The private shortcut is always the left-most item.
 * Give it a visible gap before status/nickname.
 */
#usersBox
.xc-users-private-arrow {
  display: inline-block;

  margin-right: 7px;

  color: #7ea7ff;

  font-weight: 700;

  cursor: pointer;

  user-select: none;
  -webkit-user-select: none;

  text-decoration: none;

  position: relative;
  z-index: 2;
}

#usersBox
.xc-users-private-arrow:hover {
  color: #ff9bc5;

  text-decoration: none;

  text-shadow:
    0 0 5px
    rgba(255, 105, 170, .45);

  filter: none;
}

#usersBox
.xc-users-private-arrow:focus-visible {
  outline:
    1px dotted #b9ccff;

  outline-offset: 2px;

  text-decoration: none;
}


/* --------------------------------------------------------------------------
   NICK
   -------------------------------------------------------------------------- */

.xc-live-user-nick {
  cursor: pointer;
}

.xc-live-user-nick:hover {
  text-decoration: underline;
}

.xc-live-user-male {
  color: #67ea91;
}

.xc-live-user-female {
  color: #c281ad;
}


/* --------------------------------------------------------------------------
   STATUS
   -------------------------------------------------------------------------- */

.xc-live-status {
  display: inline-block;

  margin: 0 4px 0 0;

  font-size: 10px;
  line-height: 1;

  vertical-align: middle;
}

.xc-live-status img {
  display: inline-block;

  vertical-align: middle;

  border: 0;
}


/* --------------------------------------------------------------------------
   ROLE
   -------------------------------------------------------------------------- */

.xc-live-star {
  display: inline-block;

  width: 9px;

  color: #6d6d6d;
}

.xc-live-user-admin .xc-live-star {
  color: #ffff00;

  font-weight: bold;

  text-shadow: 0 0 3px #000;
}

.xc-live-star {
  margin-left: 4px;
}

.xc-live-vip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 22px;
  min-width: 22px;
  height: 11px;
  margin-left: 4px;
  padding: 0 2px;
  border: 1px solid #8b6f00;
  background: #171200;
  color: #ffdf00;
  font: bold 8px/9px Verdana, Arial, sans-serif;
  flex: 0 0 22px;
  vertical-align: middle;
  text-shadow: 0 0 2px #6b5200;
}


/* --------------------------------------------------------------------------
   INFO
   -------------------------------------------------------------------------- */

.xc-live-user-info {
  display: inline-block;

  width: 12px;
  height: 11px;

  margin: 0 0 0 3px;
  padding: 0;

  border: 0;

  appearance: none;
  background: transparent;

  cursor: pointer;

  vertical-align: -1px;
  margin-left: 4px;
}

.xc-live-user-info img {
  display: block;

  width: 12px;
  height: 11px;

  border: 0;
}

.xc-live-user-info:hover,
.xc-live-user-info:focus-visible {
  outline: none;

  filter: brightness(1.25);
}


/* --------------------------------------------------------------------------
   DESKTOP ROW LAYOUT
   Mobile/tablet presence remains owned by mobile.css.
   -------------------------------------------------------------------------- */

@media (min-width: 1025px) {
  .xc-live-user {
    display: flex;
    align-items: center;
    width: 100%;
  }

  .xc-live-user-nick {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .xc-live-user-info {
    flex: 0 0 12px;
    margin-left: auto;
  }
}


/* --------------------------------------------------------------------------
   IGNORED USER
   -------------------------------------------------------------------------- */

.xc-live-user.xc-live-user-ignored .xc-live-user-nick {
  color: #707070;
  opacity: 0.72;

  text-decoration-line: line-through;
  text-decoration-color: #a45b5b;
  text-decoration-thickness: 1px;
}

.xc-live-user.xc-live-user-ignored .xc-live-star,
.xc-live-user.xc-live-user-ignored .xc-live-status {
  filter: grayscale(1);
  opacity: 0.55;
}


/* --------------------------------------------------------------------------
   EMPTY STATE
   -------------------------------------------------------------------------- */

.xc-live-empty {
  margin-top: 4px;

  color: #969696;

  font-size: 11px;
  font-style: italic;
}

/*
 * XCHAT_USERS_ROW_EDGES_V1
 *
 * Desktop:
 *   >>  STATUS  NICK  STAR/VIP ---------------- INFO
 *
 * Use the full width of the users column.
 * Phone/tablet layout remains untouched.
 */
@media (min-width: 1025px) {

  #usersBox .xc-live-users-list {
    width: 100% !important;
    box-sizing: border-box !important;

    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #usersBox .xc-live-user {
    display: flex !important;
    align-items: center !important;

    width: 100% !important;
    min-width: 0 !important;

    box-sizing: border-box !important;

    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  #usersBox .xc-users-private-arrow {
    flex: 0 0 auto !important;

    margin-left: 0 !important;
  }

  #usersBox .xc-live-user-nick {
    min-width: 0 !important;
  }

  #usersBox .xc-live-user-info {
    position: static !important;

    flex: 0 0 auto !important;

    margin-left: auto !important;
    margin-right: 0 !important;
  }
}

/*
 * XCHAT_DESKTOP_USERS_SPREAD_V2
 *
 * Desktop user row:
 *
 * >> STATUS NICK STAR/VIP ------------------------- [i]
 *
 * Sidebar width itself remains unchanged.
 */
@media (min-width: 1025px) {

  #usersBox,
  #usersBox > .xc-live-presence,
  #usersBox .xc-live-users-list {
    width: 100% !important;
    max-width: none !important;

    margin-left: 0 !important;
    margin-right: 0 !important;

    padding-left: 0 !important;
    padding-right: 0 !important;

    box-sizing: border-box !important;
  }

  #usersBox .xc-live-user {
    position: relative !important;

    display: flex !important;
    align-items: center !important;

    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;

    margin-left: 0 !important;
    margin-right: 0 !important;

    padding-left: 0 !important;
    padding-right: 17px !important;

    box-sizing: border-box !important;
  }

  #usersBox .xc-users-private-arrow {
    flex: 0 0 auto !important;

    margin-left: 0 !important;
  }

  #usersBox .xc-live-user-info {
    position: absolute !important;

    top: 50% !important;
    right: 0 !important;
    left: auto !important;

    margin: 0 !important;

    transform: translateY(-50%) !important;
  }
}

/*
 * XCHAT_VIP_BADGE_SHIMMER_V1
 *
 * Small retro VIP badge highlight.
 *
 * Performance contract:
 *   CSS only
 *   transform + opacity animation
 *   no animated shadow/filter
 *   no JS/timer/observer owner
 */
.xc-live-vip {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.xc-live-vip::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -4px;
  bottom: -4px;
  left: -9px;
  width: 6px;
  pointer-events: none;

  background:
    linear-gradient(
      90deg,
      rgba(255,255,255,0) 0%,
      rgba(255,249,183,.18) 20%,
      rgba(255,255,255,.94) 50%,
      rgba(255,235,102,.30) 75%,
      rgba(255,255,255,0) 100%
    );

  opacity: 0;

  transform:
    translate3d(-9px, 0, 0)
    skewX(-17deg);

  animation:
    xchat-vip-badge-shimmer
    6.4s
    ease-in-out
    infinite;
}

@keyframes xchat-vip-badge-shimmer {
  0%,
  78% {
    opacity: 0;

    transform:
      translate3d(-9px, 0, 0)
      skewX(-17deg);
  }

  80% {
    opacity: 0;
  }

  82% {
    opacity: .92;
  }

  91% {
    opacity: .92;

    transform:
      translate3d(37px, 0, 0)
      skewX(-17deg);
  }

  93%,
  100% {
    opacity: 0;

    transform:
      translate3d(37px, 0, 0)
      skewX(-17deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xc-live-vip::after {
    animation: none;
    display: none;
  }
}

/*
 * XCHAT_PEOPLE_DIRECTORY_DESKTOP_PANEL_V1
 *
 * Directory-only presentation.
 * Existing .xc-live-presence remains the sole online-list owner.
 */

.xpd-directory {
  box-sizing: border-box;
  width: 100%;
  padding: 3px 4px 0;
  font: 11px Verdana, Arial, sans-serif;
}

.xpd-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  margin: 0 0 5px;
}

.xpd-tab {
  min-width: 0;
  height: 20px;
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 3px;
  color: #aaa;
  background: rgba(0,0,0,.17);
  font: 10px Verdana, Arial, sans-serif;
  line-height: 16px;
  cursor: pointer;
}

.xpd-tab:hover {
  color: #ddd;
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.06);
}

.xpd-tab.is-active {
  color: #f0f0f0;
  border-color: rgba(137,177,223,.44);
  background: rgba(72,108,151,.28);
}

.xpd-tab-search {
  margin-left: auto;
  width: 25px;
  padding-left: 2px;
  padding-right: 2px;
}

.xpd-view[hidden],
.xpd-search[hidden] {
  display: none;
}

.xpd-search {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0 0 5px;
}

.xpd-search-input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: 23px;
  padding: 2px 5px;
  border: 1px solid #49515b;
  border-radius: 3px;
  outline: none;
  color: #ddd;
  background: rgba(0,0,0,.28);
  font: 11px Verdana, Arial, sans-serif;
}

.xpd-search-input:focus {
  border-color: #6e91b8;
}

.xpd-search-submit {
  height: 23px;
  padding: 2px 5px;
  border: 1px solid #4d5d70;
  border-radius: 3px;
  color: #d8e5f4;
  background: rgba(56,82,111,.42);
  font: 10px Verdana, Arial, sans-serif;
  cursor: pointer;
}

.xpd-summary {
  min-height: 14px;
  margin: 0 1px 3px;
  color: #8d949c;
  font-size: 10px;
}

.xpd-results {
  overflow: hidden;
}

.xpd-person {
  padding: 3px 2px 4px;
  border-bottom: 1px solid rgba(255,255,255,.045);
}

.xpd-person:last-child {
  border-bottom: 0;
}

.xpd-person:hover {
  background: rgba(255,255,255,.045);
}

.xpd-person-main {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 15px;
}

.xpd-dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  margin: 0 5px 0 1px;
  border-radius: 50%;
  background: #555;
}

.xpd-person.is-online .xpd-dot {
  background: #65d98a;
  box-shadow: 0 0 4px rgba(101,217,138,.36);
}

.xpd-person.is-guest .xpd-dot {
  background: #777;
  box-shadow: none;
}

.xpd-person.is-guest.is-online .xpd-dot {
  background: #aaa;
}

.xpd-nick {
  min-width: 0;
  max-width: calc(100% - 26px);
  padding: 0;
  border: 0;
  outline: 0;
  overflow: hidden;
  color: var(--xpd-nick-color, #67ea91);
  background: transparent;
  font: 11px Verdana, Arial, sans-serif;
  line-height: 15px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.xpd-nick:hover:not(:disabled) {
  text-decoration: underline;
}

.xpd-nick:disabled {
  cursor: default;
  opacity: 1;
}

.xpd-role-star {
  flex: 0 0 auto;
  margin-left: 3px;
  color: #ffff00;
  font-size: 10px;
  text-shadow: 0 0 3px #000;
}

.xpd-info {
  flex: 0 0 auto;
  width: 12px;
  height: 11px;
  margin: 0 0 0 4px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
}

.xpd-info img {
  display: block;
  width: 12px;
  height: 11px;
  border: 0;
}

.xpd-info:hover {
  filter: brightness(1.22);
}

.xpd-meta {
  margin: 1px 0 0 11px;
  overflow: hidden;
  color: #777f88;
  font-size: 9px;
  line-height: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xpd-person.is-online .xpd-meta {
  color: #8d9b91;
}

.xpd-person.is-guest .xpd-meta {
  color: #777;
}

.xpd-empty {
  padding: 7px 2px;
  color: #858585;
  font-size: 10px;
  font-style: italic;
}

/*
 * XCHAT_PEOPLE_DIRECTORY_UX_V2
 *
 * Long Recent/Search lists scroll inside the existing
 * right drawer instead of extending past the viewport.
 */
.xpd-results {
  box-sizing: border-box;
  max-height: calc(100vh - 285px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color:
    rgba(106, 139, 181, .70)
    rgba(0, 0, 0, .18);
}

.xpd-results::-webkit-scrollbar {
  width: 7px;
}

.xpd-results::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, .18);
}

.xpd-results::-webkit-scrollbar-thumb {
  border: 1px solid rgba(0, 0, 0, .38);
  border-radius: 6px;
  background: rgba(106, 139, 181, .70);
}

.xpd-results::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 159, 202, .82);
}
