/* SHARWAT — messages page */

body.messages-body {
  padding: 0;
  background: var(--bg-body);
  align-items: stretch;
  min-height: 100vh;
}

.messages-shell {
  width: 1200px;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 16px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.messages-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.messages-back {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-white);
  color: var(--burgundy-deep);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.messages-back:hover {
  background: var(--burgundy-pale);
}

[dir='ltr'] .messages-back i,
[dir='ltr'] .chat-header__back i {
  transform: scaleX(-1);
}

.messages-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}

.messages-sub {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.messages-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  min-height: calc(100vh - 140px);
}

.messages-inbox,
.messages-chat {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm, 14px);
  box-shadow: 0 8px 28px rgba(26, 26, 46, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.messages-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-weight: 600;
}

.messages-inbox__list {
  overflow-y: auto;
  flex: 1;
}

.messages-inbox__empty {
  padding: 48px 24px;
  text-align: center;
}

.messages-inbox__empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--burgundy-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--burgundy-mid);
}

.messages-inbox__empty h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}

.messages-inbox__empty p {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.6;
}

.messages-empty__btn {
  display: inline-flex;
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--burgundy-mid);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
  text-align: start;
  width: 100%;
  border-inline: none;
  border-top: none;
  background: transparent;
  font-family: inherit;
}

.conv-item:hover {
  background: var(--burgundy-pale);
}

.conv-item.is-active {
  background: rgba(168, 77, 114, 0.12);
  border-inline-start: 3px solid var(--burgundy-mid);
}

.conv-item.is-unread .conv-item__preview {
  font-weight: 800;
  color: var(--text-primary);
}

.conv-item__thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--burgundy-pale);
  flex-shrink: 0;
}

.conv-item__thumb--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--burgundy-light);
}

.conv-item__body {
  flex: 1;
  min-width: 0;
}

.conv-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.conv-item__name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.conv-item__ad {
  font-size: 12px;
  font-weight: 700;
  color: var(--burgundy-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.conv-item__preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item__badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.messages-chat__placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 32px;
}

.messages-chat__placeholder i {
  font-size: 42px;
  color: var(--burgundy-light);
}

.messages-chat__active {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #fff, var(--burgundy-pale));
}

.chat-header__back {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--burgundy-deep);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.chat-header__body {
  flex: 1;
  min-width: 0;
}

.chat-header__name {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.chat-header__ad {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--burgundy-mid);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header__ad-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--burgundy-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.chat-header__report-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(168, 77, 114, 0.35);
  background: rgba(168, 77, 114, 0.08);
  color: var(--burgundy-mid);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.chat-header__report-btn.is-done {
  opacity: 0.55;
  cursor: default;
}

.chat-header__report-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.chat-header__delete-btn {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f9fc;
}

.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: min(88%, 520px);
}

.chat-bubble-wrap.is-mine {
  align-self: flex-end;
}

.chat-bubble-wrap.is-other {
  align-self: flex-start;
}

.chat-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-bubble-wrap.is-mine .chat-bubble-row {
  flex-direction: row-reverse;
}

[dir='rtl'] .chat-bubble-wrap.is-mine .chat-bubble-row {
  flex-direction: row;
}

[dir='rtl'] .chat-bubble-wrap.is-other .chat-bubble-row {
  flex-direction: row-reverse;
}

.chat-msg-action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  min-height: 34px;
}

.chat-msg-action--report {
  color: var(--burgundy-mid);
  border-color: rgba(168, 77, 114, 0.35);
  background: rgba(168, 77, 114, 0.08);
}

.chat-msg-action--report.is-done {
  opacity: 0.55;
  cursor: default;
}

.chat-msg-action--delete {
  width: 34px;
  padding: 0;
}

.chat-bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-bubble__menu {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.chat-bubble:hover .chat-bubble__menu,
.chat-bubble:focus-within .chat-bubble__menu {
  opacity: 1;
}

.chat-bubble.is-mine .chat-bubble__menu {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.chat-bubble.is-mine {
  background: linear-gradient(135deg, var(--burgundy-mid), var(--burgundy-deep));
  color: #fff;
  border-bottom-right-radius: 4px;
}

[dir='rtl'] .chat-bubble.is-mine {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-bubble.is-other {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

[dir='rtl'] .chat-bubble.is-other {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

.chat-bubble__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble__img {
  display: block;
  max-width: 240px;
  max-height: 200px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.chat-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.85;
}

.chat-bubble__meta .fa-check-double.is-read {
  color: #93c5fd;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
  background: #fff;
}

.chat-composer__attach,
.chat-composer__send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.chat-composer__attach {
  background: var(--burgundy-pale);
  color: var(--burgundy-mid);
  border: 1px solid rgba(168, 77, 114, 0.15);
}

.chat-composer__send {
  background: var(--burgundy-mid);
  color: #fff;
}

.chat-composer__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-composer__input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
}

.chat-composer__input:focus {
  outline: none;
  border-color: var(--burgundy-light);
}

@media (max-width: 860px) {
  .messages-layout {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 120px);
  }

  .messages-inbox,
  .messages-chat {
    min-height: calc(100vh - 160px);
  }

  .messages-layout.chat-open .messages-inbox {
    display: none;
  }

  .messages-layout:not(.chat-open) .messages-chat {
    display: none;
  }

  .chat-header__back {
    display: flex;
  }
}
