/* GotripCN in-site messenger widget — floating circular launcher + popover panel. */
.gotripcn-messenger {
  position: fixed;
  right: clamp(18px, 2.4vw, 28px);
  bottom: clamp(18px, 3vh, 30px);
  z-index: 10500;
  font-family: "Roboto", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f6fb;
}

.gotripcn-messenger *,
.gotripcn-messenger *::before,
.gotripcn-messenger *::after {
  box-sizing: border-box;
}

/* --- Circular launcher --- */
.gotripcn-messenger-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  border: 1px solid rgba(17, 19, 29, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #11131d;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.85) inset;
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.gotripcn-messenger-launcher:hover,
.gotripcn-messenger-launcher:focus-visible {
  background: #ffffff;
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.gotripcn-messenger-launcher svg {
  width: 24px;
  height: 24px;
  display: block;
}

.gotripcn-messenger-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: #e5484d;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.gotripcn-messenger-badge.is-visible {
  display: inline-flex;
}

/* --- Panel --- */
.gotripcn-messenger-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(378px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(229, 235, 247, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015) 44%, rgba(217, 182, 111, 0.05)),
    rgba(8, 12, 22, 0.94);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.52), 0 1px 0 rgba(255, 255, 255, 0.07) inset;
  backdrop-filter: blur(28px) saturate(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(1.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: right bottom;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.gotripcn-messenger-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* --- Header --- */
.gotripcn-messenger-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(229, 235, 247, 0.12);
  background: rgba(3, 6, 14, 0.4);
}

.gotripcn-messenger-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f3f6fb;
}

.gotripcn-messenger-back,
.gotripcn-messenger-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  flex: none;
  cursor: pointer;
  border: 1px solid rgba(229, 235, 247, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #a5afbf;
  font-size: 14px;
  line-height: 1;
  transition: background 0.18s ease, color 0.18s ease;
}

.gotripcn-messenger-back:hover,
.gotripcn-messenger-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f3f6fb;
}

.gotripcn-messenger-back.is-hidden {
  display: none;
}

/* --- Body / scroll area --- */
.gotripcn-messenger-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(165, 175, 191, 0.35) transparent;
}

.gotripcn-messenger-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: #a5afbf;
  font-size: 13px;
  line-height: 1.7;
}

.gotripcn-messenger-empty strong {
  color: #f3f6fb;
  font-size: 14px;
}

.gotripcn-messenger-signin {
  display: inline-block;
  margin-top: 6px;
  padding: 11px 26px;
  border: 1px solid rgba(243, 246, 251, 0.2);
  border-radius: 8px;
  background: #f3f6fb;
  color: #050814;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
}

.gotripcn-messenger-signin:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.gotripcn-messenger-signin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.gotripcn-messenger-signin.is-secondary {
  background: transparent;
  color: #f3f6fb;
}

.gotripcn-messenger-signin.is-secondary:hover {
  background: rgba(243, 246, 251, 0.08);
  color: #ffffff;
}

/* --- Conversation list --- */
.gotripcn-messenger-conversation {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  margin: 0 0 6px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  border: 1px solid rgba(229, 235, 247, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.gotripcn-messenger-conversation:hover {
  background: rgba(217, 182, 111, 0.07);
  border-color: rgba(217, 182, 111, 0.3);
}

.gotripcn-messenger-avatar {
  width: 40px;
  height: 40px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(229, 235, 247, 0.16);
  background: rgba(142, 184, 255, 0.14);
  color: #8eb8ff;
  font-size: 15px;
  font-weight: 700;
}

.gotripcn-messenger-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gotripcn-messenger-conversation-main {
  min-width: 0;
}

.gotripcn-messenger-conversation-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f3f6fb;
}

.gotripcn-messenger-conversation-preview {
  margin-top: 3px;
  overflow: hidden;
  font-size: 12px;
  color: #a5afbf;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gotripcn-messenger-conversation-preview.is-locked {
  color: rgba(165, 175, 191, 0.55);
  font-style: italic;
}

.gotripcn-messenger-conversation-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.gotripcn-messenger-conversation-time {
  font-size: 10px;
  color: rgba(165, 175, 191, 0.7);
  letter-spacing: 0.04em;
}

.gotripcn-messenger-conversation-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e5484d;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

/* --- Chat view --- */
.gotripcn-messenger-day {
  margin: 12px 0 8px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(165, 175, 191, 0.6);
}

.gotripcn-messenger-message {
  max-width: 82%;
  width: fit-content;
  margin: 0 0 8px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}

.gotripcn-messenger-message.is-peer {
  margin-right: auto;
  border: 1px solid rgba(229, 235, 247, 0.12);
  border-bottom-left-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3f6fb;
}

.gotripcn-messenger-message.is-own {
  margin-left: auto;
  border: 1px solid rgba(115, 224, 184, 0.24);
  border-bottom-right-radius: 4px;
  background: rgba(115, 224, 184, 0.12);
  color: #d9f6ea;
}

.gotripcn-messenger-message.is-locked {
  position: relative;
  border: 1px dashed rgba(165, 175, 191, 0.3);
  background: rgba(165, 175, 191, 0.06);
  color: transparent;
  text-shadow: 0 0 12px rgba(200, 208, 222, 0.85);
  user-select: none;
}

.gotripcn-messenger-message-time {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(165, 175, 191, 0.62);
}

.gotripcn-messenger-message.is-locked .gotripcn-messenger-message-time {
  color: rgba(165, 175, 191, 0.62);
  text-shadow: none;
}

.gotripcn-messenger-locked-note {
  margin: 0 0 8px;
  max-width: 82%;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: rgba(217, 182, 111, 0.85);
}

/* --- Membership banner (guides without active membership) --- */
.gotripcn-messenger-membership {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 182, 111, 0.3);
  border-radius: 8px;
  background: rgba(217, 182, 111, 0.08);
  color: #ecd7a8;
  font-size: 11.5px;
  line-height: 1.6;
}

.gotripcn-messenger-membership a {
  color: #d9b66f;
  font-weight: 700;
  text-decoration: underline;
}

/* --- Composer --- */
.gotripcn-messenger-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid rgba(229, 235, 247, 0.12);
  background: rgba(3, 6, 14, 0.4);
}

.gotripcn-messenger-input {
  flex: 1;
  min-height: 40px;
  max-height: 110px;
  margin: 0;
  padding: 10px 12px;
  resize: none;
  border: 1px solid rgba(229, 235, 247, 0.14);
  border-radius: 8px;
  background: rgba(3, 6, 14, 0.46);
  color: #f3f6fb;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.gotripcn-messenger-input:focus {
  border-color: rgba(217, 182, 111, 0.58);
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 182, 111, 0.1);
}

.gotripcn-messenger-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gotripcn-messenger-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  flex: none;
  cursor: pointer;
  border: 1px solid rgba(243, 246, 251, 0.2);
  border-radius: 8px;
  background: #f3f6fb;
  color: #050814;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.gotripcn-messenger-send:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
}

.gotripcn-messenger-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gotripcn-messenger-send svg {
  width: 17px;
  height: 17px;
  display: block;
}

.gotripcn-messenger-error {
  padding: 6px 12px 10px;
  font-size: 11px;
  color: #fca5a5;
  display: none;
}

.gotripcn-messenger-error.is-visible {
  display: block;
}

.gotripcn-messenger-loading {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: rgba(165, 175, 191, 0.75);
}

@media (max-width: 560px) {
  .gotripcn-messenger {
    right: 14px;
    bottom: 14px;
  }

  .gotripcn-messenger-launcher {
    width: 52px;
    height: 52px;
  }

  .gotripcn-messenger-panel {
    width: calc(100vw - 28px);
    height: min(520px, calc(100vh - 100px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .gotripcn-messenger-launcher,
  .gotripcn-messenger-panel {
    transition-duration: 0.01ms;
  }
}
