/* Chat page — col-4 list / col-8 thread */

.page-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 32px;
  padding-bottom: 2rem;
  background: #fff;
}

.page-chat--empty .page-chat__layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 8rem);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
}

.chat-empty__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  margin-bottom: 1.5rem;
  border-radius: 50%;
  background: #eef3f7;
}

.chat-empty__emoji {
  display: block;
  font-size: 54px;
  line-height: 1;
}

.chat-empty__title {
  margin: 0 0 0.75rem;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: #122a32;
  text-align: center;
}

.chat-empty__text {
  max-width: 420px;
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-muted, #73686a);
  text-align: center;
}

.page-chat__layout {
  flex: 1;
  min-height: 0;
}

.page-chat__layout > .row {
  --bs-gutter-x: 1.25rem;
  min-height: calc(100vh - var(--header-height) - 8rem);
}

.page-chat__col {
  display: flex;
  min-height: 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - var(--header-height) - 8rem);
  border: 0.5px solid #195C93;
  border-radius: 0;
  background: #fff;
  overflow: hidden;
}

.chat-panel--list {
  border-radius: 10px;
}

.chat-panel--thread {
  border-color: transparent;
}

/* Conversation list */

.chat-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.chat-list__status {
  margin: 0;
  padding: 24px 20px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-muted, #9aa7b2);
  text-align: center;
}

.chat-list__status--error {
  color: var(--color-primary, #ff207a);
}

.chat-list__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 15px 20px;
  border: none;
  border-bottom: 1px solid #e8eef2;
  border-radius: 0;
  background: #fff;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-list__item:last-child {
  border-bottom: none;
}

.chat-list__item:hover {
  background: #fafcfd;
}

.chat-list__item.is-active {
  background: #F7FDFF;
}

.chat-list__avatar {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef3f6;
}

.chat-list__body {
  flex: 1;
  min-width: 0;
  padding-right: 0px;
}

.chat-list__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-list__name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list__meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding-top: 2px;
}

.chat-list__time {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  color: #9aa7b2;
}

.chat-list__preview {
  margin: 0;
  padding-right: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: #8a969f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list__unread {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
}

.chat-list__unread-spacer {
  display: block;
  width: 9px;
  height: 9px;
}

.page-chat__mobile-header {
  display: none;
}

/* Thread header */

.chat-thread__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0px 8px 16px 0px;
  border-bottom: 1px solid #e8eef2;
}

.chat-thread__peer {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.chat-thread__peer-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.chat-thread__peer-btn:hover .chat-thread__name,
.chat-thread__peer-btn:focus-visible .chat-thread__name {
  color: var(--color-primary);
}

.chat-thread__avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 5px;
  object-fit: cover;
  background: #eef3f6;
}

.chat-thread__name {
  display: block;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-thread__report {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: #F7FDFF;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-primary);
  cursor: pointer;
}

.chat-thread__report:hover {
  background: rgba(255, 32, 122, 0.06);
}

.chat-thread__report-icon {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.chat-thread__report-icon--mobile {
  display: none;
}

/* Messages */

.chat-thread__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 8px 12px 0px;
}

.chat-thread__date {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 20px;
  font-size: 10px;
  font-weight: 400;
  color: #9aa7b2;
}

.chat-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  max-width: 78%;
}

.chat-message--incoming {
  margin-right: auto;
  align-items: flex-start;
}

.chat-message--outgoing {
  margin-left: auto;
  align-items: flex-end;
}

.chat-message__main {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}

.chat-message--outgoing .chat-message__main {
  flex-direction: row-reverse;
}

.chat-message__avatar {
  flex-shrink: 0;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef3f6;
}

.chat-message__bubble {
  margin: 0;
  padding: 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--color-text);
  word-break: break-word;
  min-width: 0;
}

.chat-message--incoming .chat-message__bubble {
  background: #FEF8F7;
  border: none;
  border-radius: 5px 5px 5px 0px;
}

.chat-message--outgoing .chat-message__bubble {
  background: #F7FDFF;
  border: none;
  border-radius: 5px 5px 0px 5px;
}

.chat-message__time {
  margin-top: 4px;
  margin-left: calc(35px + 10px);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: #9aa7b2;
}

.chat-message--outgoing .chat-message__time {
  margin-left: 0;
  margin-right: calc(35px + 10px);
}

.chat-thread__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  color: var(--color-muted);
  font-size: 15px;
}

.chat-thread__status {
  margin: 0;
  padding: 24px 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-muted, #9aa7b2);
  text-align: center;
}

.chat-thread__status--error {
  color: var(--color-primary, #ff207a);
}

.chat-thread__blocked {
  flex-shrink: 0;
  margin: 8px 4px 8px;
  padding: 20px 24px 18px;
  border: 0.5px solid #195C93;
  border-radius: 12px;
  background: #f7fdff;
  text-align: center;
}

.chat-thread__blocked-icon {
  margin: 0 auto 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
}

.chat-thread__blocked-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
}

.chat-thread__blocked-text a {
  color: var(--color-primary, #ff207a);
  text-decoration: underline;
  font-weight: 500;
}

.chat-thread__unavailable {
  flex-shrink: 0;
  margin: 8px 4px 8px;
  padding: 20px 24px 18px;
  border: 0.5px solid #195C93;
  border-radius: 12px;
  background: #f7fdff;
  text-align: center;
}

.chat-thread__unavailable-icon {
  margin: 0 auto 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
}

.chat-thread__unavailable-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: #6b7280;
}

.chat-thread__unavailable-text {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: #6b7280;
}

/* Composer */

.chat-composer {
  position: relative;
  flex-shrink: 0;
  padding: 12px 4px 8px;
}

.chat-composer__field {
  width: 100%;
  height: 52px;
  padding: 0 52px 0 20px;
  border: 0.5px solid #195C93;
  border-radius: 10px;
  background: #F7FDFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s ease;
}

.chat-composer__field::placeholder {
  color: #a3aeb8;
}

.chat-composer__field:focus {
  border-color: #b7c8d4;
}

.chat-composer__send {
  position: absolute;
  top: 50%;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  transform: translateY(-50%);
}

.chat-composer__send:hover:not(:disabled) {
  background: rgba(255, 32, 122, 0.08);
}

.chat-composer__send:disabled {
  opacity: 0.4;
  cursor: default;
}

.chat-composer__send-icon {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--color-primary, #ff207a);
}

.chat-thread__back {
  display: none;
}

@media (max-width: 991.98px) {
  .page-chat__layout > .row {
    min-height: calc(100vh - var(--header-height) - 7rem);
  }

  .chat-panel {
    height: calc(100vh - var(--header-height) - 7rem);
    max-height: none;
  }

  .page-chat--list-only .page-chat__col--thread,
  .page-chat--thread-only .page-chat__col--list {
    display: none;
  }

  .page-chat--list-only .page-chat__col--list,
  .page-chat--thread-only .page-chat__col--thread {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }

  .chat-thread__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 4px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
  }

  .chat-thread__back-icon {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
  }

  .chat-thread__header {
    padding-left: 0;
    padding-right: 0;
  }

  .chat-thread__messages {
    padding-left: 0;
    padding-right: 0;
  }

  .chat-composer {
    padding-left: 0;
    padding-right: 0;
  }

  .chat-message {
    max-width: 88%;
  }

  .chat-thread__report {
    height: 36px;
    padding: 0 4px;
    gap: 0;
  }

  .chat-thread__report-label {
    display: none;
  }

  .chat-thread__report-icon--desktop {
    display: none;
  }

  .chat-thread__report-icon--mobile {
    display: block;
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 599.98px) {
  .page-shell:has(.page-chat--list-only) > header,
  .page-shell:has(.page-chat--thread-only) > header {
    display: none;
  }

  .page-shell:has(.page-chat--thread-only) .mobile-bottom-nav {
    display: none;
  }

  .page-chat__mobile-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 64px;
    min-height: 64px;
    background: #f2ccb3;
  }

  .page-chat__mobile-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: #122a32;
  }

  .page-chat {
    padding-top: 0;
    padding-bottom: calc(1rem + 72px);
    background: #fff;
  }

  .page-chat--list-only {
    padding-bottom: 72px;
  }

  .page-chat--thread-only {
    padding-bottom: 0;
  }

  .page-chat__layout {
    padding-left: 0;
    padding-right: 0;
  }

  .page-chat__layout > .row,
  .chat-panel {
    height: calc(100vh - 64px - 72px);
    min-height: calc(100vh - 64px - 72px);
  }

  .page-chat--thread-only .page-chat__layout > .row,
  .page-chat--thread-only .chat-panel {
    height: 100vh;
    min-height: 100vh;
  }

  .page-chat__col--list,
  .page-chat__col--thread {
    padding-left: 0;
    padding-right: 0;
  }

  .chat-panel--list,
  .chat-panel--thread {
    border: none;
    border-radius: 0;
    max-height: none;
  }

  .chat-panel--thread {
    background: #fff;
  }

  .chat-thread__header {
    flex-shrink: 0;
    gap: 10px;
    min-height: 64px;
    padding: 10px 16px;
    border-bottom: none;
    background: #f2ccb3;
  }

  .chat-thread__peer {
    gap: 12px;
  }

  .chat-thread__back {
    width: 28px;
    height: 28px;
    margin-right: 0;
  }

  .chat-thread__avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .chat-thread__name {
    font-size: 16px;
    font-weight: 600;
  }

  .chat-thread__report {
    height: 36px;
    padding: 0;
    gap: 0;
    background: transparent;
  }

  .chat-thread__report-label {
    display: none;
  }

  .chat-thread__report-icon--desktop {
    display: none;
  }

  .chat-thread__report-icon--mobile {
    display: block;
    width: 42px;
    height: 42px;
  }

  .chat-thread__messages {
    padding: 16px 20px 12px 20px;
    background: #fff;
  }

  .chat-thread__date {
    margin: 8px 0 16px;
    font-size: 11px;
  }

  .chat-message {
    max-width: 85%;
    margin-bottom: 16px;
  }

  .chat-message__avatar {
    width: 35px;
    height: 35px;
    border-radius: 5px;
  }

  .chat-message__bubble {
    padding: 10px 12px;
    font-size: 14px;
  }

  .chat-message__time {
    margin-left: calc(32px + 10px);
    font-size: 11px;
  }

  .chat-message--outgoing .chat-message__time {
    margin-right: calc(32px + 10px);
  }

  .chat-composer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #eef2f5;
  }

  .chat-composer__field {
    height: 48px;
    padding: 0 48px 0 16px;
    font-size: 14px;
  }

  .chat-thread__blocked {
    margin: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-thread__unavailable {
    margin: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .chat-list__item {
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #e6edf2;
  }

  .chat-list__item.is-active {
    background: #fff;
  }

  .chat-list__avatar {
    width: 52px;
    height: 52px;
    border-radius: 10px;
  }

  .chat-list__name {
    font-size: 16px;
    font-weight: 600;
  }

  .chat-list__preview {
    font-size: 14px;
    color: #8a969f;
  }

  .chat-list__time {
    font-size: 13px;
    color: #9aa7b2;
  }

  .chat-list__meta {
    min-height: 44px;
    gap: 12px;
  }

  .chat-list__unread {
    width: 10px;
    height: 10px;
  }
}
