/*
 * ============================================================================
 * 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;
  }
}
