/* public/css/chat.css */

/* ---------- Base layout helpers ---------- */
.page-chat-index,
.page-chat-invites,
.page-chat-friends,
.page-chat-group-create,
.page-chat-show {
  height: calc(100vh - 0px);
}

/* ---------- Shared max width shell ---------- */
.cp-chat,
.cp-thread {
  max-width: 720px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.10);
}

/* ---------- Headers (60px) ---------- */
.cp-chat__header,
.cp-thread__header {
  height: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(10px);
}

.cp-chat__title,
.cp-thread__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.cp-chat__subtitle,
.cp-thread__meta {
  font-size: 12px;
  opacity: 0.75;
}

.cp-thread__meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cp-thread__meta-dot { opacity: .6; }

.cp-thread__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cp-thread__titleblock {
  min-width: 0;
}

.cp-thread__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-thread__back {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  color: inherit;
}

/* ---------- Tabs (60px) ---------- */
.cp-chat__tabs {
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
}

.cp-chat__tabs-inner {
  display: flex;
  gap: 10px;
  padding: 0 12px;
  width: 100%;
  overflow-x: auto;
}

.cp-chat__tab {
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  flex: 0 0 auto;
}

.cp-chat__tab.is-active {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.22);
}

.cp-chat__badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.18);
}

/* ---------- Scrollable list area (Index/Invites/Friends/Group Create) ---------- */
.cp-chat__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.cp-chat__pagination {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ---------- Empty states ---------- */
.cp-chat__empty {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 14px;
}

.cp-chat__empty-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.cp-chat__empty-subtitle {
  opacity: 0.75;
  font-size: 13px;
}

.cp-chat__empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Conversation list items ---------- */
.cp-chat__items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-chat-item {
  display: block;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  text-decoration: none;
  color: inherit;
}

.cp-chat-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.16);
}

.cp-chat-item.is-active {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

.cp-chat-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cp-chat-item__title {
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-chat-item__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.cp-chat-item__time {
  font-size: 12px;
  opacity: 0.75;
}

.cp-chat-item__unread {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.18);
}

.cp-chat-item__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.85;
}

.cp-chat-item__meta {
  font-size: 12px;
  opacity: 0.75;
}

.cp-chat-item__dot {
  opacity: 0.5;
}

.cp-chat-item__snippet {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Invites list ---------- */
.cp-invites {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-invite {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.cp-invite__badge {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}

.cp-invite__body { flex: 1; min-width: 0; }
.cp-invite__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.cp-invite__title { font-weight: 700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cp-invite__time { font-size: 12px; opacity: 0.75; flex:0 0 auto; }
.cp-invite__subtitle { font-size: 13px; opacity: 0.75; margin-top: 4px; }

.cp-invite__actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Friends list ---------- */
.cp-friends {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.cp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}

.cp-avatar--sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.cp-friend__body { flex: 1; min-width: 0; }
.cp-friend__name { font-weight: 700; }
.cp-friend__meta { font-size: 12px; opacity: 0.75; margin-top: 3px; }

/* ---------- Group create select ---------- */
.cp-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cp-form__block-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.cp-label { font-size: 13px; opacity: .85; display:block; margin-bottom: 6px; }

.cp-input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: inherit;
  outline: none;
}

.cp-input--error { border-color: rgba(255,80,80,0.55); }

.cp-error { margin-top: 8px; font-size: 12px; color: rgba(255,120,120,0.95); }

.cp-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cp-select__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.cp-checkbox {
  width: 16px;
  height: 16px;
}

.cp-select__name {
  font-weight: 650;
}

/* ---------- Thread layout (Chat.show) ---------- */
.cp-thread__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 12px;
  scrollbar-width: none;
}

.cp-thread__footer {
  height: 60px;
  min-height: 60px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.12);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  padding: 0 12px;
}

/* ---------- Messages ---------- */
.cp-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cp-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cp-msg--own { margin-left: auto; align-items: flex-end; }
.cp-msg--other { margin-right: auto; align-items: flex-start; }

.cp-msg__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  opacity: 0.75;
}

.cp-msg__sender { font-weight: 700; opacity: 0.95; }

.cp-msg__bubble {
  padding: 10px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  line-height: 1.45;
  font-size: 14px;
   /* white-space: pre-wrap; */
  word-break: break-word;
}

.cp-msg--own .cp-msg__bubble {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
}

.cp-msg__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cp-attach {
  font-size: 12px;
  text-decoration: none;
  color: inherit;
  opacity: 0.9;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.cp-msg__reactions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cp-react {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.cp-react.is-active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}

.cp-react__count {
  font-size: 12px;
  opacity: 0.8;
}

/* ---------- Composer ---------- */
.cp-compose {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.cp-compose__left,
.cp-compose__right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.cp-compose__mid {
  flex: 1;
  min-width: 0;
}

.cp-compose__attach {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.cp-compose__file { display: none; }

.cp-compose__input {
  width: 100%;
  max-height: 42px;
  height: 42px;
  resize: none;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: inherit;
  outline: none;
  line-height: 20px;
}

.cp-compose__input--error {
  border-color: rgba(255,80,80,0.55);
}

.cp-compose__error {
  position: absolute;
  left: 0;
  bottom: 62px;
  font-size: 12px;
  color: rgba(255,120,120,0.95);
}

/* ---------- Tiny utilities ---------- */
.inline { display: inline-block; }
