/* XAFENTOL CHAT — FUNPAY INSPIRED */

#page-chat {
  color-scheme: light;
  color: #20232b;
  background: #f3f4f6;
  min-height: 100%;
}

#page-chat * {
  box-sizing: border-box;
}

.xf-chat-page {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  color: #20232b;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xf-chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.xf-chat-heading h1 {
  margin: 0;
  color: #20232b;
  font-size: 25px;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.6px;
}

.xf-chat-heading p {
  margin: 6px 0 0;
  color: #858a96;
  font-size: 13px;
}

.xf-chat-heading > button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #555b68;
  background: #fff;
  font-size: 23px;
  cursor: pointer;
  transition: .2s;
}

.xf-chat-heading > button:hover {
  color: #7651d5;
  border-color: #cfc2f5;
  background: #faf8ff;
}

.xf-chat-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 690px;
  height: min(76vh, 850px);
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 13px;
  box-shadow: 0 3px 15px rgba(20, 25, 40, .035);
}

.xf-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid #e9eaee;
}

.xf-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 19px 15px;
}

.xf-sidebar-heading b {
  color: #272a33;
  font-size: 15px;
  font-weight: 750;
}

.xf-sidebar-heading > span {
  display: grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding: 0 7px;
  border-radius: 7px;
  color: #7651d5;
  background: #f1edfb;
  font-size: 11px;
  font-weight: 750;
}

.xf-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 13px 13px;
  padding: 0 12px;
  height: 39px;
  border: 1px solid #e8e9ed;
  border-radius: 8px;
  background: #f8f9fb;
}

.xf-search > span {
  color: #9a9eaa;
  font-size: 21px;
  line-height: 1;
}

.xf-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  outline: none;
  border: 0;
  background: transparent;
  color: #30333b;
  font: inherit;
  font-size: 12px;
}

.xf-search input::placeholder {
  color: #a0a4ae;
}

.xf-threads {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d9dbe1 transparent;
}

.xf-thread {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 76px;
  padding: 12px 15px;
  text-align: left;
  border: 0;
  border-top: 1px solid #f0f1f3;
  background: #fff;
  cursor: pointer;
  transition: background .15s;
}

.xf-thread:hover {
  background: #f8f8fb;
}

.xf-thread.active {
  background: #f4f0fc;
}

.xf-thread.active::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: #8058df;
  content: "";
}

.xf-avatar {
  position: relative;
  display: grid;
  flex: 0 0 41px;
  place-items: center;
  width: 41px;
  height: 41px;
  overflow: hidden;
  border-radius: 50%;
  color: #7150c4;
  background: #eee9fa;
  font-size: 15px;
  font-weight: 750;
}

.xf-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xf-thread-info {
  display: block;
  flex: 1;
  min-width: 0;
}

.xf-thread-top,
.xf-thread-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xf-thread-top b {
  overflow: hidden;
  color: #292c34;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xf-thread-top time {
  flex: 0 0 auto;
  color: #a1a4ad;
  font-size: 10px;
}

.xf-thread-bottom {
  margin-top: 7px;
}

.xf-thread-bottom > span {
  overflow: hidden;
  color: #8b8f99;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xf-thread-bottom small {
  flex: 0 0 auto;
  color: #8d70cb;
  font-size: 10px;
}

.xf-empty {
  padding: 35px 15px;
  color: #a0a3ad;
  text-align: center;
  font-size: 12px;
}

.xf-conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f8f9fb;
}

.xf-conversation-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-height: 73px;
  padding: 14px 21px;
  border-bottom: 1px solid #e9eaee;
  background: #fff;
}

.xf-partner {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.xf-partner b {
  overflow: hidden;
  color: #282b33;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xf-partner span {
  color: #9a9da7;
  font-size: 11px;
}

.xf-mobile-back {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid #e6e7eb;
  border-radius: 8px;
  color: #555b68;
  background: #fff;
  font-size: 19px;
  cursor: pointer;
}

#xfOrders {
  flex: 0 0 auto;
}

.xf-orders-title {
  padding: 12px 19px 8px;
  color: #858995;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.xf-orders-list {
  display: flex;
  gap: 9px;
  padding: 0 19px 12px;
  overflow-x: auto;
}

.xf-order {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 220px;
  max-width: 310px;
  padding: 10px 12px;
  border: 1px solid #e6e4ec;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border .15s, background .15s;
}

.xf-order:hover,
.xf-order.highlight {
  border-color: #bca8ed;
  background: #faf8ff;
}

.xf-order > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 5px;
}

.xf-order b {
  overflow: hidden;
  color: #343640;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xf-order small {
  color: #9699a3;
  font-size: 10px;
}

.xf-order-side {
  align-items: flex-end;
  flex: 0 0 auto;
}

.xf-order-side b {
  color: #7451c7;
}

.xf-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d8dae0 transparent;
}

.xf-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 13px;
}

.xf-date-separator span {
  padding: 5px 11px;
  border: 1px solid #e8e9ed;
  border-radius: 20px;
  color: #969aa4;
  background: #fff;
  font-size: 10px;
}

.xf-message-row {
  display: flex;
  width: 100%;
}

.xf-message-row.incoming {
  justify-content: flex-start;
}

.xf-message-row.own {
  justify-content: flex-end;
}

.xf-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(72%, 570px);
  padding: 10px 13px 7px;
  border: 1px solid #e8e9ed;
  border-radius: 10px 10px 10px 3px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20,25,40,.025);
}

.xf-message-row.own .xf-bubble {
  border-color: #e5dcf8;
  border-radius: 10px 10px 3px 10px;
  background: #eee9f8;
}

.xf-message-text {
  color: #353842;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: normal;
}

.xf-bubble time {
  align-self: flex-end;
  color: #a0a2ab;
  font-size: 9px;
}

.xf-compose {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 10px;
  padding: 13px 17px;
  border-top: 1px solid #e9eaee;
  background: #fff;
}

.xf-compose textarea {
  display: block;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 130px;
  padding: 12px 13px;
  resize: none;
  outline: none;
  border: 1px solid #e4e5e9;
  border-radius: 8px;
  color: #30333b;
  background: #fafbfc;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.xf-compose textarea:focus {
  border-color: #b9a4e9;
  background: #fff;
}

.xf-compose textarea::placeholder {
  color: #a0a3ad;
}

.xf-compose button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 17px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #7954ce;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.xf-compose button:hover {
  background: #6843bd;
}

.xf-compose button:disabled {
  opacity: .55;
  cursor: wait;
}

.xf-compose button span {
  font-size: 14px;
}

.xf-welcome,
.xf-loading,
.xf-error {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 300px;
  padding: 25px;
  color: #989ba5;
  text-align: center;
}

.xf-welcome-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 5px;
  border-radius: 18px;
  color: #7954ce;
  background: #eee9f8;
  font-size: 27px;
}

.xf-welcome b,
.xf-error b {
  color: #383b44;
  font-size: 14px;
}

.xf-welcome span,
.xf-error span,
.xf-loading span {
  font-size: 11px;
}

.xf-loader {
  width: 26px;
  height: 26px;
  border: 3px solid #e8e2f4;
  border-top-color: #7954ce;
  border-radius: 50%;
  animation: xf-spin .8s linear infinite;
}

@keyframes xf-spin {
  to { transform: rotate(360deg); }
}

.xf-error button {
  margin-top: 8px;
  padding: 9px 16px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: #7954ce;
  cursor: pointer;
}

@media (max-width: 900px) {
  .xf-chat-page {
    padding: 16px;
  }

  .xf-chat-layout {
    grid-template-columns: 290px minmax(0, 1fr);
    height: 75vh;
    min-height: 600px;
  }

  .xf-messages {
    padding: 17px;
  }
}

@media (max-width: 650px) {
  #page-chat {
    min-height: calc(100vh - 70px);
  }

  .xf-chat-page {
    padding: 10px;
  }

  .xf-chat-heading {
    margin-bottom: 12px;
  }

  .xf-chat-heading h1 {
    font-size: 21px;
  }

  .xf-chat-heading p {
    font-size: 11px;
  }

  .xf-chat-layout {
    position: relative;
    display: block;
    height: calc(100dvh - 155px);
    min-height: 430px;
    border-radius: 10px;
  }

  .xf-sidebar,
  .xf-conversation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .xf-conversation {
    display: none;
  }

  .xf-conversation.has-active {
    display: flex;
  }

  .xf-chat-layout:has(.xf-conversation.has-active) .xf-sidebar {
    display: none;
  }

  .xf-mobile-back {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
  }

  .xf-conversation-head {
    min-height: 62px;
    padding: 10px 12px;
  }

  .xf-orders-list {
    padding-right: 12px;
    padding-left: 12px;
  }

  .xf-orders-title {
    padding-left: 12px;
  }

  .xf-messages {
    padding: 13px 11px;
  }

  .xf-bubble {
    max-width: 86%;
  }

  .xf-compose {
    gap: 7px;
    padding: 9px;
  }

  .xf-compose textarea {
    min-height: 40px;
    padding: 11px;
  }

  .xf-compose button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 10px;
  }
}

@media (max-width: 380px) {
  .xf-compose button {
    gap: 5px;
    padding: 0 9px;
  }

  .xf-thread {
    padding-right: 10px;
    padding-left: 10px;
  }
}
