:root {
  --init-chat-primary: #0073aa;
  --init-chat-primary-hover: #005f8d;
  --init-chat-primary-light: #e7f3ff;
  --init-chat-secondary: #6c757d;
  --init-chat-success: #28a745;
  --init-chat-danger: #dc3545;
  --init-chat-warning: #ffc107;
  --init-chat-info: #17a2b8;
  --init-chat-light: #f8f9fa;
  --init-chat-dark: #343a40;
  --init-chat-border: #e1e5ea;
  --init-chat-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  --init-chat-radius: 12px;
  --init-chat-radius-sm: 8px;
  --init-chat-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --init-chat-transition: all 0.2s ease;
  --init-chat-bg-primary: #ffffff;
  --init-chat-bg-secondary: #f8f9fa;
  --init-chat-bg-tertiary: #f7f9fb;
  --init-chat-text-primary: #343a40;
  --init-chat-text-secondary: #6c757d;
  --init-chat-text-muted: #868e96;
  --init-chat-input-bg: #f8f9fa;
  --init-chat-input-border: #e9ecef;
  --init-chat-message-bg: #ffffff;
  --init-chat-message-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --init-chat-scrollbar-track: #f1f1f1;
  --init-chat-scrollbar-thumb: #c1c1c1;
  --init-chat-scrollbar-thumb-hover: #a8a8a8;
}
.init-chatbox-theme-dark {
  --init-chat-primary: #4a9eff;
  --init-chat-primary-hover: #3d8bdb;
  --init-chat-primary-light: #1a2332;
  --init-chat-secondary: #a0aec0;
  --init-chat-success: #48bb78;
  --init-chat-danger: #f56565;
  --init-chat-warning: #ed8936;
  --init-chat-info: #4299e1;
  --init-chat-light: #2d3748;
  --init-chat-dark: #e2e8f0;
  --init-chat-border: #4a5568;
  --init-chat-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  --init-chat-bg-primary: #1a202c;
  --init-chat-bg-secondary: #2d3748;
  --init-chat-bg-tertiary: #2a3441;
  --init-chat-text-primary: #e2e8f0;
  --init-chat-text-secondary: #a0aec0;
  --init-chat-text-muted: #718096;
  --init-chat-input-bg: #2d3748;
  --init-chat-input-border: #4a5568;
  --init-chat-message-bg: #2d3748;
  --init-chat-message-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --init-chat-scrollbar-track: #2d3748;
  --init-chat-scrollbar-thumb: #4a5568;
  --init-chat-scrollbar-thumb-hover: #718096;
}
.ice-hidden {
  display: none !important;
}
.init-chatbox-wrapper {
  max-width: 500px;
  margin: 40px auto;
  background-color: var(--init-chat-bg-primary);
  color: var(--init-chat-text-primary);
  border-radius: var(--init-chat-radius);
  box-shadow: var(--init-chat-shadow);
  overflow: hidden;
  font-family: var(--init-chat-font-family);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--init-chat-transition);
  border: 1px solid var(--init-chat-border);
}
.init-chatbox-wrapper:hover {
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.12);
}
.init-chatbox-theme-dark.init-chatbox-wrapper:hover {
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
}
.init-chatbox-theme-minimal {
  box-shadow: none;
  border: 1px solid var(--init-chat-border);
}
.init-chatbox-theme-rounded {
  border-radius: 24px;
}
.init-chatbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  color: #fff;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.init-chatbox-theme-dark .init-chatbox-header {
  border-bottom: 1px solid var(--init-chat-border);
}
.init-chatbox-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}
.init-chatbox-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.init-chatbox-online-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgb(255 255 255 / 0.9);
}
.init-chatbox-status-indicator {
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
.init-chatbox-messages {
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(
    to bottom,
    var(--init-chat-bg-tertiary),
    var(--init-chat-bg-primary)
  );
  border-bottom: 1px solid var(--init-chat-border);
  position: relative;
  padding-bottom: 20px;
}
.init-chatbox-messages::-webkit-scrollbar {
  width: 6px;
}
.init-chatbox-messages::-webkit-scrollbar-track {
  background: var(--init-chat-scrollbar-track);
  border-radius: 3px;
}
.init-chatbox-messages::-webkit-scrollbar-thumb {
  background: var(--init-chat-scrollbar-thumb);
  border-radius: 3px;
  transition: var(--init-chat-transition);
}
.init-chatbox-messages::-webkit-scrollbar-thumb:hover {
  background: var(--init-chat-scrollbar-thumb-hover);
}
.init-chatbox-messages.shrink {
  height: 115px;
  min-height: 115px;
  max-height: 115px;
}
.init-chatbox-messages.expand {
  height: 350px;
  min-height: 350px;
  max-height: 350px;
}
.init-chatbox-wrapper:has(.init-chatbox-login-required) .init-chatbox-messages {
  height: 280px !important;
  min-height: 280px !important;
  max-height: 280px !important;
}
.init-chatbox-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  color: var(--init-chat-text-secondary);
  gap: 12px;
  flex-direction: column;
}
.init-chatbox-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--init-chat-border);
  border-top: 3px solid var(--init-chat-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.init-chatbox-empty {
  text-align: center;
  color: var(--init-chat-text-secondary);
  padding: 20px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e1e5ea"><path d="M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/></svg>')
    no-repeat center top;
  background-size: 48px 48px;
  padding-top: 60px;
}
.init-chatbox-theme-dark .init-chatbox-empty {
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234a5568"><path d="M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/></svg>')
    no-repeat center top;
  background-size: 48px 48px;
}
.init-chatbox-message {
  margin-bottom: 16px;
  opacity: 1;
  transform: translateY(0);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.init-chatbox-message-header {
  width: 100%;
}
.init-chatbox-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.init-chatbox-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.init-chatbox-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--init-chat-bg-primary);
  box-shadow: var(--init-chat-message-shadow);
  transition: var(--init-chat-transition);
}
.init-chatbox-avatar:hover {
  transform: scale(1.05);
}
.init-chatbox-author {
  font-weight: 600;
  color: var(--init-chat-text-primary);
  text-transform: capitalize;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.init-chatbox-meta-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}
.init-chatbox-time-divider {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--init-chat-text-secondary);
  margin: 4px 0 12px;
  user-select: none;
}
.init-chatbox-message + .init-chatbox-time-divider {
  margin-top: 20px;
}
.init-chatbox-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  max-width: calc(100% - 16px);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--init-chat-text-primary);
  color: var(--init-chat-bg-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease,
    visibility 0s linear 0.12s;
}
.init-chatbox-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
.init-chatbox-tooltip::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 0 solid #fff0;
}
.init-chatbox-tooltip[data-place="top"]::after {
  left: var(--init-chat-tip-arrow-x, 50%);
  bottom: -5px;
  margin-left: -5px;
  border-width: 5px 5px 0;
  border-top-color: var(--init-chat-text-primary);
}
.init-chatbox-tooltip[data-place="bottom"]::after {
  left: var(--init-chat-tip-arrow-x, 50%);
  top: -5px;
  margin-left: -5px;
  border-width: 0 5px 5px;
  border-bottom-color: var(--init-chat-text-primary);
}
.init-chatbox-tooltip[data-place="right"]::after {
  left: -5px;
  top: var(--init-chat-tip-arrow-y, 50%);
  margin-top: -5px;
  border-width: 5px 5px 5px 0;
  border-right-color: var(--init-chat-text-primary);
}
.init-chatbox-tooltip[data-place="left"]::after {
  right: -5px;
  top: var(--init-chat-tip-arrow-y, 50%);
  margin-top: -5px;
  border-width: 5px 0 5px 5px;
  border-left-color: var(--init-chat-text-primary);
}
.init-chatbox-meta-time {
  color: var(--init-chat-text-secondary);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 400;
}
.init-chatbox-message-body {
  background: var(--init-chat-message-bg);
  padding: 12px 16px;
  border-radius: var(--init-chat-radius-sm);
  color: var(--init-chat-text-primary);
  word-break: break-word;
  line-height: 1.5;
  box-shadow: var(--init-chat-message-shadow);
  border: 1px solid var(--init-chat-border);
  position: relative;
  transition: var(--init-chat-transition);
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.init-chatbox-message-body:hover {
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.15);
}
.init-chatbox-theme-dark .init-chatbox-message-body:hover {
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}
.init-chatbox-message.current-user .init-chatbox-message-body {
  background: linear-gradient(
    135deg,
    var(--init-chat-primary),
    var(--init-chat-primary-hover)
  );
  color: #fff;
  border-color: var(--init-chat-primary);
  margin-left: 20px;
  max-width: calc(100% - 20px);
}
.init-chatbox-message.current-user .init-chatbox-author {
  color: var(--init-chat-primary);
  font-weight: 700;
}
.init-chatbox-own-right .init-chatbox-message.current-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-message-header {
  width: 100%;
}
.init-chatbox-own-right .init-chatbox-message.current-user .init-chatbox-meta {
  flex: 1;
  flex-direction: row-reverse;
}
.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-meta-content {
  flex: 1;
  flex-direction: row-reverse;
  justify-content: flex-start;
  min-width: 0;
}
.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-author {
  flex: 0 1 auto;
  text-align: right;
}
.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  margin-left: 0;
  margin-right: 20px;
  max-width: calc(100% - 20px);
  text-align: left;
  border-top-right-radius: 4px;
}
.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-pin-btn {
  right: auto;
  left: 6px;
}
.init-chatbox-message.guest-user .init-chatbox-author {
  color: var(--init-chat-text-secondary);
  font-style: italic;
}
.init-chatbox-message.guest-user .init-chatbox-author::after {
  content: " (guest)";
  font-size: 11px;
  opacity: 0.7;
}
.init-chatbox-load-more {
  text-align: center;
  padding: 10px;
  border-bottom: 1px solid var(--init-chat-border);
  background: linear-gradient(
    to bottom,
    var(--init-chat-bg-tertiary),
    var(--init-chat-bg-primary)
  );
  position: sticky;
  top: 0;
  z-index: 10;
}
.init-chatbox-load-more-btn {
  background: #fff0;
  color: var(--init-chat-primary);
  border: 1px solid var(--init-chat-primary);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 11px;
  transition: var(--init-chat-transition);
  font-weight: 500;
  min-height: 28px;
}
.init-chatbox-load-more-btn:hover {
  background: var(--init-chat-primary);
  color: #fff;
  transform: translateY(-1px);
}
.init-chatbox-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.init-chatbox-load-more-btn:disabled:hover {
  background: #fff0;
  color: var(--init-chat-primary);
}
.init-chatbox-typing {
  padding: 8px 16px;
  background: rgb(74 158 255 / 0.1);
  border-radius: var(--init-chat-radius-sm);
  margin: 8px 0;
  opacity: 1;
}
.init-chatbox-theme-dark .init-chatbox-typing {
  background: rgb(74 158 255 / 0.15);
}
.init-chatbox-typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--init-chat-text-secondary);
  font-size: 12px;
  font-style: italic;
}
.init-chatbox-typing-dots {
  display: flex;
  gap: 3px;
}
.init-chatbox-typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--init-chat-primary);
  border-radius: 50%;
  animation: typingSimple 1.4s infinite ease-in-out;
}
.init-chatbox-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.init-chatbox-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}
@keyframes typingSimple {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}
.init-chatbox-connection-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 100;
  opacity: 1;
}
.init-chatbox-theme-dark .init-chatbox-connection-status {
  background: rgb(26 32 44 / 0.9);
  border: 1px solid var(--init-chat-border);
}
.init-chatbox-connection-status.reconnecting {
  background: var(--init-chat-warning);
  color: var(--init-chat-dark);
}
.init-chatbox-connection-status.connected {
  background: var(--init-chat-success);
}
.init-chatbox-input-wrapper {
  background: var(--init-chat-bg-primary);
  border-top: 1px solid var(--init-chat-border);
  position: relative;
  z-index: 5;
  display: block !important;
  visibility: visible !important;
  min-height: 60px;
  overflow: hidden;
  border-bottom-left-radius: var(--init-chat-radius);
  border-bottom-right-radius: var(--init-chat-radius);
}
.init-chatbox-form {
  padding: 0;
  margin: 0;
}
.init-chatbox-input-group {
  display: flex;
  gap: 8px;
  padding: 16px;
  align-items: flex-end;
}
.init-chatbox-input-name,
.init-chatbox-input-message {
  padding: 12px 16px;
  border: 2px solid var(--init-chat-input-border);
  border-radius: 24px;
  outline: none;
  flex: 1;
  transition: var(--init-chat-transition);
  font-size: 14px;
  background: var(--init-chat-input-bg);
  color: var(--init-chat-text-primary);
  resize: none;
  font-family: inherit;
}
.init-chatbox-input-message {
  min-height: 20px;
  max-height: 100px;
  line-height: 1.4;
}
.init-chatbox-input-name::placeholder,
.init-chatbox-input-message::placeholder {
  color: var(--init-chat-text-muted);
}
.init-chatbox-input-name:focus,
.init-chatbox-input-message:focus {
  border-color: var(--init-chat-primary);
  background: var(--init-chat-bg-primary);
  box-shadow: 0 0 0 3px rgb(74 158 255 / 0.1);
}
.init-chatbox-theme-dark .init-chatbox-input-name:focus,
.init-chatbox-theme-dark .init-chatbox-input-message:focus {
  box-shadow: 0 0 0 3px rgb(74 158 255 / 0.2);
}
.init-chatbox-submit {
  background: linear-gradient(
    135deg,
    var(--init-chat-primary),
    var(--init-chat-primary-hover)
  );
  color: #fff;
  padding: 12px 20px;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: var(--init-chat-transition);
  white-space: nowrap;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgb(74 158 255 / 0.2);
}
.init-chatbox-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(74 158 255 / 0.3);
}
.init-chatbox-submit:active {
  transform: translateY(0);
}
.init-chatbox-submit:disabled {
  background: var(--init-chat-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}
.init-chatbox-submit-icon {
  font-size: 16px;
  line-height: 1;
}
.init-chatbox-input-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 12px;
  font-size: 11px;
  color: var(--init-chat-text-secondary);
}
.init-chatbox-char-count {
  transition: var(--init-chat-transition);
}
.init-chatbox-char-count.warning {
  color: var(--init-chat-warning);
  font-weight: 600;
}
.init-chatbox-char-count.danger {
  color: var(--init-chat-danger);
  font-weight: 600;
}
.init-chatbox-rate-limit {
  color: var(--init-chat-danger);
  font-weight: 600;
  opacity: 1;
}
.init-chatbox-mini-status {
  padding: 8px 16px;
  background: rgb(74 158 255 / 0.05);
  border-bottom: 1px solid var(--init-chat-border);
}
.init-chatbox-theme-dark .init-chatbox-mini-status {
  background: rgb(74 158 255 / 0.1);
}
.init-chatbox-online-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--init-chat-text-secondary);
}
.init-chatbox-status-dot {
  width: 6px;
  height: 6px;
  background: var(--init-chat-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.init-chatbox-guest-wrapper {
  background: var(--init-chat-bg-primary);
  border-top: 1px solid var(--init-chat-border);
  border-bottom-left-radius: var(--init-chat-radius);
  border-bottom-right-radius: var(--init-chat-radius);
  overflow: hidden;
}
.init-chatbox-name-form {
  padding: 24px;
  text-align: center;
  background: linear-gradient(
    135deg,
    var(--init-chat-bg-secondary),
    var(--init-chat-bg-primary)
  );
}
.init-chatbox-name-header {
  margin-bottom: 20px;
}
.init-chatbox-name-header h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: var(--init-chat-text-primary);
  font-weight: 600;
}
.init-chatbox-name-header p {
  margin: 0;
  color: var(--init-chat-text-secondary);
  font-size: 14px;
}
.init-chatbox-name-input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.init-chatbox-guest-notice {
  color: var(--init-chat-text-secondary);
  font-size: 12px;
  line-height: 1.4;
  display: block;
  margin: 0;
}
.init-chatbox-user-info {
  padding: 12px 16px;
  background: var(--init-chat-bg-secondary);
  border-bottom: 1px solid var(--init-chat-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.init-chatbox-current-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.init-chatbox-user-label {
  color: var(--init-chat-text-secondary);
  font-size: 12px;
}
.init-chatbox-user-name {
  color: var(--init-chat-primary);
  font-weight: 600;
  font-size: 14px;
}
.init-chatbox-change-name {
  background: none;
  color: var(--init-chat-primary);
  border: 1px solid var(--init-chat-primary);
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  transition: var(--init-chat-transition);
  display: flex;
  align-items: center;
  gap: 4px;
}
.init-chatbox-change-name:hover {
  background: var(--init-chat-primary);
  color: #fff;
}
.init-chatbox-change-icon {
  font-size: 10px;
}
.init-chatbox-login-required {
  display: flex !important;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(
    135deg,
    var(--init-chat-bg-secondary),
    var(--init-chat-bg-primary)
  );
  text-align: left;
  border-top: 1px solid var(--init-chat-border);
  min-height: 80px;
  position: relative;
  z-index: 10;
  visibility: visible !important;
  opacity: 1 !important;
}
.init-chatbox-input-wrapper .init-chatbox-login-required {
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--init-chat-border);
}
.init-chatbox-login-icon {
  font-size: 32px;
  opacity: 0.7;
  flex-shrink: 0;
  color: var(--init-chat-text-secondary);
}
.init-chatbox-login-content {
  flex: 1;
}
.init-chatbox-login-content p {
  margin: 0 0 8px 0;
  color: var(--init-chat-text-primary);
  font-weight: 500;
  font-size: 14px;
}
.init-chatbox-login-content small {
  color: var(--init-chat-text-secondary);
  font-size: 12px;
  display: block;
}
.init-chatbox-login-required a {
  color: var(--init-chat-primary);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid #fff0;
  transition: var(--init-chat-transition);
}
.init-chatbox-login-required a:hover {
  color: var(--init-chat-primary-hover);
  border-bottom-color: var(--init-chat-primary-hover);
}
.init-chatbox-error,
.init-chatbox-success {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 12px 16px;
  border-radius: var(--init-chat-radius-sm);
  font-size: 13px;
  font-weight: 500;
  opacity: 1;
  transform: translateY(0);
}
.init-chatbox-error {
  background: #fff5f5;
  color: var(--init-chat-danger);
  border: 1px solid #fed7d7;
}
.init-chatbox-theme-dark .init-chatbox-error {
  background: rgb(245 101 101 / 0.1);
  color: var(--init-chat-danger);
  border: 1px solid rgb(245 101 101 / 0.3);
}
.init-chatbox-success {
  background: #f0fff4;
  color: var(--init-chat-success);
  border: 1px solid #9ae6b4;
}
.init-chatbox-theme-dark .init-chatbox-success {
  background: rgb(72 187 120 / 0.1);
  color: var(--init-chat-success);
  border: 1px solid rgb(72 187 120 / 0.3);
}
.init-chatbox-error-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: inherit;
  padding: 0;
  line-height: 1;
  transition: var(--init-chat-transition);
}
.init-chatbox-error-close:hover {
  transform: scale(1.1);
}
.init-chatbox-error-icon,
.init-chatbox-success-icon {
  font-size: 16px;
  line-height: 1;
}
.init-chatbox-footer {
  padding: 8px 16px;
  background: var(--init-chat-bg-secondary);
  border-top: 1px solid var(--init-chat-border);
  text-align: center;
}
.init-chatbox-powered-by {
  font-size: 10px;
  color: var(--init-chat-text-secondary);
  margin: 0;
}
.init-chatbox-powered-by a {
  color: var(--init-chat-primary);
  text-decoration: none;
  font-weight: 500;
}
.init-chatbox-powered-by a:hover {
  text-decoration: underline;
}
.init-chatbox-scroll-to-bottom {
  position: absolute;
  bottom: 120px;
  right: 16px;
  background: var(--init-chat-primary);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  z-index: 1000;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
  transition: var(--init-chat-transition);
}
.init-chatbox-theme-dark .init-chatbox-scroll-to-bottom {
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.4);
}
.init-chatbox-scroll-to-bottom:hover {
  background: var(--init-chat-primary-hover);
  transform: translateY(-1px);
}
.init-chatbox-banned {
  border: 1px solid var(--init-chat-danger);
  border-radius: 8px;
  padding: 20px;
  background: rgb(245 101 101 / 0.1);
  color: var(--init-chat-danger);
  text-align: center;
  max-width: 500px;
  margin: 20px auto;
}
.init-chatbox-theme-dark .init-chatbox-banned {
  background: rgb(245 101 101 / 0.15);
  border-color: rgb(245 101 101 / 0.5);
}
.init-chatbox-ban-notice {
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
}
.init-chatbox-ban-icon {
  font-size: 48px;
  line-height: 1;
}
.init-chatbox-ban-content h4 {
  margin: 0 0 10px 0;
  color: var(--init-chat-danger);
  font-size: 18px;
}
.init-chatbox-ban-content p {
  margin: 5px 0;
  line-height: 1.4;
  color: var(--init-chat-text-primary);
}
.init-chatbox-ban-content small {
  color: var(--init-chat-text-secondary);
  font-style: italic;
}
.init-chat-stats-widget {
  background: var(--init-chat-bg-secondary);
  border: 1px solid var(--init-chat-border);
  border-radius: 6px;
  padding: 15px;
  margin: 10px 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  column-gap: 12px;
}
.init-chat-stat-item {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 56px auto;
  grid-template-columns: subgrid;
  align-items: center;
  column-gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--init-chat-border);
}
.init-chat-stat-item:last-child {
  border-bottom: none;
}
.init-chat-stat-label {
  font-weight: 600;
  color: var(--init-chat-text-primary);
}
.init-chat-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--init-chat-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.init-chat-stat-detail {
  color: var(--init-chat-text-secondary);
  font-size: 12px;
  margin-left: 0;
  text-align: right;
  white-space: nowrap;
}
.init-chat-stats-basic .init-chat-stat-item {
  padding: 5px 0;
}
.init-chat-stats-basic .init-chat-stat-value {
  font-size: 16px;
}
@media (max-width: 768px) {
  .init-chatbox-wrapper {
    margin: 20px 16px;
    max-width: none;
    border-radius: var(--init-chat-radius-sm);
  }
  .init-chatbox-messages.expand {
    height: 300px;
    min-height: 300px;
    max-height: 300px;
  }
  .init-chatbox-input-group {
    padding: 12px;
    flex-wrap: wrap;
  }
  .init-chatbox-submit-text {
    display: none;
  }
  .init-chatbox-submit {
    padding: 12px;
    border-radius: 50%;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }
  .init-chatbox-name-input-group {
    flex-direction: column;
    gap: 8px;
  }
  .init-chatbox-user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .init-chatbox-header {
    padding: 12px 16px;
  }
  .init-chatbox-title {
    font-size: 14px;
  }
}
@media (max-width: 480px) {
  .init-chatbox-wrapper {
    margin: 10px;
    border-radius: var(--init-chat-radius-sm);
  }
  .init-chatbox-messages.expand {
    height: 250px;
    min-height: 250px;
    max-height: 250px;
  }
  .init-chatbox-login-required {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .init-chatbox-message-body {
    padding: 10px 12px;
  }
  .init-chatbox-name-form {
    padding: 16px;
  }
}
@media (prefers-contrast: high) {
  .init-chatbox-wrapper {
    border-width: 2px;
  }
  .init-chatbox-message-body {
    border-width: 2px;
  }
  .init-chatbox-submit {
    border: 2px solid var(--init-chat-primary);
  }
  .init-chatbox-theme-dark {
    --init-chat-border: #718096;
    --init-chat-text-secondary: #cbd5e0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .init-chatbox-typing-dots span {
    animation: none !important;
  }
  .init-chatbox-status-indicator {
    animation: none !important;
  }
  .init-chatbox-status-dot {
    animation: none !important;
  }
}
@media (prefers-color-scheme: dark) {
  .init-chatbox-wrapper:not(.init-chatbox-theme-dark):not(
      .init-chatbox-theme-light
    ) {
    --init-chat-primary: #4a9eff;
    --init-chat-primary-hover: #3d8bdb;
    --init-chat-primary-light: #1a2332;
    --init-chat-secondary: #a0aec0;
    --init-chat-success: #48bb78;
    --init-chat-danger: #f56565;
    --init-chat-warning: #ed8936;
    --init-chat-info: #4299e1;
    --init-chat-light: #2d3748;
    --init-chat-dark: #e2e8f0;
    --init-chat-border: #4a5568;
    --init-chat-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    --init-chat-bg-primary: #1a202c;
    --init-chat-bg-secondary: #2d3748;
    --init-chat-bg-tertiary: #2a3441;
    --init-chat-text-primary: #e2e8f0;
    --init-chat-text-secondary: #a0aec0;
    --init-chat-text-muted: #718096;
    --init-chat-input-bg: #2d3748;
    --init-chat-input-border: #4a5568;
    --init-chat-message-bg: #2d3748;
    --init-chat-message-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --init-chat-scrollbar-track: #2d3748;
    --init-chat-scrollbar-thumb: #4a5568;
    --init-chat-scrollbar-thumb-hover: #718096;
  }
}
.init-chatbox-messages {
  transform: translateZ(0);
  will-change: scroll-position;
}
.init-chatbox-message {
  contain: layout style;
}
.init-chatbox-input-message {
  contain: layout;
}
@media print {
  .init-chatbox-wrapper {
    box-shadow: none;
    border: 1px solid #000;
    background: white !important;
    color: black !important;
  }
  .init-chatbox-theme-dark.init-chatbox-wrapper {
    background: white !important;
    color: black !important;
  }
  .init-chatbox-theme-dark .init-chatbox-message-body,
  .init-chatbox-theme-dark .init-chatbox-messages {
    background: white !important;
    color: black !important;
  }
  .init-chatbox-form,
  .init-chatbox-input-wrapper,
  .init-chatbox-name-form,
  .init-chatbox-footer,
  .init-chatbox-scroll-to-bottom {
    display: none;
  }
  .init-chatbox-messages {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
.init-chatbox-wrapper,
.init-chatbox-wrapper * {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}
.init-chatbox-theme-toggle {
  position: absolute;
  top: 16px;
  right: 80px;
  background: none;
  border: 1px solid rgb(255 255 255 / 0.3);
  color: #fff;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 10px;
  transition: var(--init-chat-transition);
}
.init-chatbox-theme-toggle:hover {
  background: rgb(255 255 255 / 0.1);
}
.init-chatbox-theme-dark ::selection {
  background: rgb(74 158 255 / 0.3);
  color: var(--init-chat-text-primary);
}
.init-chatbox-theme-dark ::-moz-selection {
  background: rgb(74 158 255 / 0.3);
  color: var(--init-chat-text-primary);
}
.init-chatbox-disabled {
  pointer-events: none;
  opacity: 0.6;
}
.init-chatbox-pinned-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: stretch;
  background: #f7efdf;
  border-left: 3px solid #f59e0b;
  border-bottom: 1px solid rgb(245 158 11 / 0.25);
  padding: 8px 12px;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  animation: pinBannerIn 0.2s ease;
  z-index: 20;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.06);
}
.init-chatbox-theme-dark .init-chatbox-pinned-banner {
  background: #2d3748;
}
@keyframes pinBannerIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.init-chatbox-pinned-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.init-chatbox-pinned-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.init-chatbox-pinned-clickable {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  cursor: pointer;
  padding: 2px 0;
  border-radius: 3px;
  transition: opacity 0.15s;
}
.init-chatbox-pinned-clickable:hover {
  opacity: 0.75;
}
.init-chatbox-pinned-clickable:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}
.init-chatbox-pinned-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #b45309;
  line-height: 1;
}
.init-chatbox-pinned-text {
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  opacity: 0.85;
  font-size: 13px;
}
.init-chatbox-pinned-unpin {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgb(185 28 28 / 0.3);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.5;
  color: #b91c1c;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.init-chatbox-pinned-unpin:hover {
  background: rgb(185 28 28 / 0.1);
  border-color: #b91c1c;
}
.init-chatbox-pinned-unpin:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.init-chatbox-message {
  position: relative;
}
.init-chatbox-pin-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, background 0.15s;
  z-index: 5;
  white-space: nowrap;
  line-height: 1.5;
}
.init-chatbox-pin-btn.pinned-active {
  background: rgb(245 158 11 / 0.85);
}
.init-chatbox-message:hover .init-chatbox-pin-btn {
  opacity: 1;
  pointer-events: auto;
}
.init-chatbox-pin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5 !important;
}
.init-chatbox-message.pinned-highlight {
  outline: 2px solid rgb(245 158 11 / 0.6);
  outline-offset: 2px;
  border-radius: 4px;
  animation: pinHighlight 1.4s ease forwards;
}
@keyframes pinHighlight {
  0% {
    outline-color: rgb(245 158 11 / 0.95);
  }
  100% {
    outline-color: #fff0;
  }
}
.init-chatbox-pinned-expand {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
  font-size: 14px;
  padding: 2px 6px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.init-chatbox-theme-dark .init-chatbox-pinned-expand {
  color: var(--init-chat-text-secondary);
}
.init-chatbox-pinned-expand:hover {
  opacity: 1;
}
.init-chatbox-pinned-text.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.init-chatbox-seen {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  animation: init-chatbox-seen-in 0.2s ease-out;
}
.init-chatbox-seen-list {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 1;
}
.init-chatbox-seen-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px #fff;
  background: #e4e6eb;
}
.init-chatbox-seen-avatar + .init-chatbox-seen-avatar {
  margin-inline-start: -4px;
}
.init-chatbox-seen-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #65676b;
}
.init-chatbox-seen-more {
  margin-inline-start: 4px;
  font-size: 11px;
  color: #65676b;
}
.init-chatbox-seen-list:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 8px;
}
@keyframes init-chatbox-seen-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .init-chatbox-seen {
    animation: none;
  }
}

/* ===== NOV CUSTOM OVERRIDES ===== */

/* Nov Custom - Init Chat Engine compatibility */
.init-chatbox-wrapper:not(.init-chatbox-theme-dark):not(
    .init-chatbox-theme-light
  ) {
  --init-chat-primary: var(--theme-color, #3b66f5);
  --init-chat-primary-hover: var(--theme-hover-color, #3158d8);
  --init-chat-border: #e1e5ea;
  --init-chat-bg-primary: #fff;
  --init-chat-bg-secondary: #f8f9fa;
  --init-chat-bg-tertiary: #f7f9fb;
  --init-chat-text-primary: #343a40;
  --init-chat-text-secondary: #6c757d;
  --init-chat-text-muted: #868e96;
  --init-chat-input-bg: #fff;
  --init-chat-input-border: #d8dce2;
  --init-chat-message-bg: #f5f6f8;
  --init-chat-shadow: none;
}

.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-dark):not(
    .init-chatbox-theme-light
  ) {
  --init-chat-primary: var(--theme-color, #3b66f5);
  --init-chat-primary-hover: var(--theme-hover-color, #3158d8);
  --init-chat-border: #42464d;
  --init-chat-bg-primary: #222;
  --init-chat-bg-secondary: #2b2b2b;
  --init-chat-bg-tertiary: #292929;
  --init-chat-text-primary: #eee;
  --init-chat-text-secondary: #c5c5c5;
  --init-chat-text-muted: #999;
  --init-chat-input-bg: #303030;
  --init-chat-input-border: #505050;
  --init-chat-message-bg: #303030;
  --init-chat-shadow: none;
}

.init-chatbox-wrapper {
  background: var(--init-chat-bg-primary) !important;
  color: var(--init-chat-text-primary) !important;
  border: 1px solid var(--init-chat-border) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font-family: inherit;
  overflow: hidden;
}

.init-chatbox-wrapper .init-chatbox-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--init-chat-border);
}

.init-chatbox-wrapper .init-chatbox-title {
  margin: 0;
  color: var(--init-chat-text-primary);
  font-size: 16px;
  font-weight: 600;
}

.init-chatbox-wrapper .init-chatbox-messages {
  background: var(--init-chat-bg-primary);
  color: var(--init-chat-text-primary);
  border-color: var(--init-chat-border);
}

.init-chatbox-wrapper .init-chatbox-loading {
  color: var(--init-chat-text-secondary);
}

.init-chatbox-wrapper .init-chatbox-loading-spinner {
  border-color: var(--init-chat-border);
  border-top-color: var(--theme-color, #3b66f5);
}

.init-chatbox-wrapper .init-chatbox-input-wrapper,
.init-chatbox-wrapper .init-chatbox-guest-wrapper {
  background: var(--init-chat-bg-primary);
}

.init-chatbox-wrapper .init-chatbox-input-group,
.init-chatbox-wrapper .init-chatbox-name-input-group {
  padding: 12px;
  gap: 8px;
}

.init-chatbox-wrapper .init-chatbox-input-message,
.init-chatbox-wrapper .init-chatbox-input-name {
  min-width: 0;
  background: var(--init-chat-input-bg);
  color: var(--init-chat-text-primary);
  border: 1px solid var(--init-chat-input-border);
  border-radius: 24px;
  font: inherit;
  padding: 10px 16px;
  box-shadow: none;
}

.init-chatbox-wrapper .init-chatbox-input-message:focus,
.init-chatbox-wrapper .init-chatbox-input-name:focus {
  border-color: var(--theme-color, #3b66f5);
  outline: none;
  box-shadow: 0 0 0 2px
    color-mix(in srgb, var(--theme-color, #3b66f5) 18%, transparent);
}

.init-chatbox-wrapper .init-chatbox-input-message::placeholder,
.init-chatbox-wrapper .init-chatbox-input-name::placeholder {
  color: var(--init-chat-text-muted);
}

.init-chatbox-wrapper .init-chatbox-submit {
  background: var(--theme-color, #3b66f5);
  color: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.init-chatbox-wrapper .init-chatbox-submit:hover {
  background: var(--theme-hover-color, #3158d8);
  color: #fff;
  transform: none;
}

.init-chatbox-wrapper .init-chatbox-change-name {
  color: var(--theme-color, #3b66f5);
}

.init-chatbox-wrapper .init-chatbox-input-info,
.init-chatbox-wrapper .init-chatbox-guest-notice {
  color: var(--init-chat-text-muted);
}

.init-chatbox-wrapper .init-chatbox-connection-status,
.init-chatbox-wrapper .init-chatbox-error,
.init-chatbox-wrapper .init-chatbox-login-required {
  border-radius: 6px;
}

.uk-light .init-chatbox-wrapper .init-chatbox-message {
  color: var(--init-chat-text-primary);
}

.uk-light .init-chatbox-wrapper .init-chatbox-message-content {
  color: inherit;
}

@media (max-width: 640px) {
  .init-chatbox-wrapper {
    margin: 10px 0;
    border-radius: 8px !important;
  }

  .init-chatbox-wrapper .init-chatbox-input-group,
  .init-chatbox-wrapper .init-chatbox-name-input-group {
    padding: 10px;
  }
}

/* =========================================================
   NOV CUSTOM - INIT CHAT ENGINE DYNAMIC ELEMENTS
   ========================================================= */

/* Message layout */
.init-chatbox-wrapper .init-chatbox-message {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 16px;
  contain: layout style;
}

.init-chatbox-wrapper .init-chatbox-message-header {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  margin-bottom: 7px;
}

.init-chatbox-wrapper .init-chatbox-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.init-chatbox-wrapper .init-chatbox-meta-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.init-chatbox-wrapper .init-chatbox-meta-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.init-chatbox-wrapper .init-chatbox-author {
  color: var(--init-chat-text-primary);
  font-size: 13px;
  font-weight: 600;
}

.init-chatbox-wrapper .init-chatbox-meta-time {
  color: var(--init-chat-text-muted);
  font-size: 11px;
}

.init-chatbox-wrapper .init-chatbox-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--init-chat-bg-primary);
}

.init-chatbox-wrapper .init-chatbox-avatar-fallback {
  flex-shrink: 0;
  overflow: hidden;
}

/* Message bubble */
.init-chatbox-wrapper .init-chatbox-message-body {
  position: relative;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--init-chat-border);
  border-radius: 14px;
  background: var(--init-chat-message-bg);
  color: var(--init-chat-text-primary);
  line-height: 1.55;
  overflow-wrap: anywhere;
  box-shadow: none;
}

.init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  margin-left: 20px;
  max-width: calc(100% - 20px);
  background: var(--init-chat-primary);
  border-color: var(--init-chat-primary);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.init-chatbox-wrapper .init-chatbox-message.current-user .init-chatbox-author {
  color: var(--init-chat-primary);
}

.init-chatbox-wrapper.init-chatbox-own-right
  .init-chatbox-message.current-user {
  align-items: flex-end;
}

.init-chatbox-wrapper.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-meta {
  flex-direction: row-reverse;
}

.init-chatbox-wrapper.init-chatbox-own-right
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  margin-left: 0;
  margin-right: 20px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

.init-chatbox-wrapper .init-chatbox-message.guest-user .init-chatbox-author {
  color: var(--init-chat-text-secondary);
  font-style: italic;
}

.init-chatbox-wrapper .init-chatbox-text {
  color: inherit;
  overflow-wrap: anywhere;
}

.init-chatbox-wrapper .init-chatbox-text a {
  color: var(--init-chat-primary);
  text-decoration: underline;
}

.init-chatbox-wrapper .init-chatbox-message.current-user .init-chatbox-text a {
  color: #fff;
}

.init-chatbox-wrapper .init-chatbox-text img {
  max-width: 100%;
  height: auto;
}

/* Date divider */
.init-chatbox-wrapper .init-chatbox-time-divider {
  margin: 16px 0;
  color: var(--init-chat-text-muted);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

/* Empty state */
.init-chatbox-wrapper .init-chatbox-empty {
  padding: 55px 16px 20px;
  color: var(--init-chat-text-secondary);
  text-align: center;
  background: none;
}

/* Connection and status */
.init-chatbox-wrapper .init-chatbox-connection-status {
  padding: 8px 12px;
  color: var(--init-chat-text-secondary);
  background: var(--init-chat-bg-secondary);
  border-bottom: 1px solid var(--init-chat-border);
  font-size: 12px;
}

.init-chatbox-wrapper .init-chatbox-connection-text {
  color: inherit;
}

.init-chatbox-wrapper .init-chatbox-status,
.init-chatbox-wrapper .init-chatbox-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.init-chatbox-wrapper .init-chatbox-status-indicator,
.init-chatbox-wrapper .init-chatbox-status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Load more */
.init-chatbox-wrapper .init-chatbox-load-more {
  padding: 10px;
  text-align: center;
  background: var(--init-chat-bg-secondary);
  border-bottom: 1px solid var(--init-chat-border);
}

.init-chatbox-wrapper .init-chatbox-load-more-btn {
  padding: 6px 14px;
  border: 1px solid var(--init-chat-primary);
  border-radius: 20px;
  background: transparent;
  color: var(--init-chat-primary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.init-chatbox-wrapper .init-chatbox-load-more-btn:hover {
  background: var(--init-chat-primary);
  color: #fff;
}

/* Scroll to bottom */
.init-chatbox-wrapper .init-chatbox-scroll-to-bottom {
  position: absolute;
  right: 16px;
  bottom: 20px;
  z-index: 20;
  padding: 8px 13px;
  border: 0;
  border-radius: 22px;
  background: var(--init-chat-primary);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.init-chatbox-wrapper .init-chatbox-scroll-to-bottom:hover {
  background: var(--init-chat-primary-hover);
}

/* Pinned message banner */
.init-chatbox-wrapper .init-chatbox-pinned-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--init-chat-border);
  border-left: 3px solid var(--init-chat-primary);
  background: var(--init-chat-bg-secondary);
  color: var(--init-chat-text-primary);
  font-size: 13px;
}

.init-chatbox-wrapper .init-chatbox-pinned-inner {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
}

.init-chatbox-wrapper .init-chatbox-pinned-icon {
  flex-shrink: 0;
  color: var(--init-chat-primary);
}

.init-chatbox-wrapper .init-chatbox-pinned-clickable {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}

.init-chatbox-wrapper .init-chatbox-pinned-label {
  color: var(--init-chat-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.init-chatbox-wrapper .init-chatbox-pinned-text {
  overflow: hidden;
  color: var(--init-chat-text-primary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.init-chatbox-wrapper .init-chatbox-pinned-text.expanded {
  overflow: visible;
  white-space: normal;
}

.init-chatbox-wrapper .init-chatbox-pinned-expand,
.init-chatbox-wrapper .init-chatbox-pinned-unpin {
  flex-shrink: 0;
  padding: 4px 7px;
  border: 1px solid var(--init-chat-border);
  border-radius: 6px;
  background: transparent;
  color: var(--init-chat-text-secondary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.init-chatbox-wrapper .init-chatbox-pinned-unpin {
  color: #dc3545;
}

/* Pin button */
.init-chatbox-wrapper .init-chatbox-pin-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 5;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.init-chatbox-wrapper .init-chatbox-message:hover .init-chatbox-pin-btn,
.init-chatbox-wrapper .init-chatbox-pin-btn.pinned-active {
  opacity: 1;
  pointer-events: auto;
}

.init-chatbox-wrapper .init-chatbox-pin-btn.pinned-active {
  background: #d99416;
}

.init-chatbox-wrapper .init-chatbox-message.pinned-highlight {
  outline: 2px solid #e5a323;
  outline-offset: 3px;
  border-radius: 6px;
}

/* Seen indicators */
.init-chatbox-wrapper .init-chatbox-seen {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
}

.init-chatbox-wrapper .init-chatbox-seen-list {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.init-chatbox-wrapper .init-chatbox-seen-avatar {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--init-chat-bg-primary);
}

.init-chatbox-wrapper .init-chatbox-seen-avatar + .init-chatbox-seen-avatar {
  margin-left: -4px;
}

.init-chatbox-wrapper .init-chatbox-seen-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--init-chat-bg-tertiary);
  color: var(--init-chat-text-secondary);
  font-size: 9px;
}

.init-chatbox-wrapper .init-chatbox-seen-more {
  margin-left: 5px;
  color: var(--init-chat-text-muted);
  font-size: 11px;
}

/* Tooltip */
.init-chatbox-wrapper .init-chatbox-tooltip {
  position: absolute;
  z-index: 30;
  max-width: calc(100% - 16px);
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--init-chat-text-primary);
  color: var(--init-chat-bg-primary);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 3px 12px rgb(0 0 0 / 18%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.init-chatbox-wrapper .init-chatbox-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Character count and submit text */
.init-chatbox-wrapper .init-chatbox-char-count,
.init-chatbox-wrapper .init-chatbox-char-current {
  color: var(--init-chat-text-muted);
  font-size: 11px;
}

.init-chatbox-wrapper .init-chatbox-submit-text {
  color: inherit;
}

/* FX keyword and highlighted text */
.init-chatbox-wrapper .fx-keyword,
.init-chatbox-wrapper .init-fx-highlight-text {
  color: var(--init-chat-primary);
  font-weight: 600;
}

/* Hidden state used by plugin JavaScript */
.init-chatbox-wrapper .ice-hidden {
  display: none !important;
}

/* Dark mode refinements */
.uk-light .init-chatbox-wrapper .init-chatbox-message-body {
  background: var(--init-chat-message-bg);
  color: var(--init-chat-text-primary);
  border-color: var(--init-chat-border);
}

.uk-light
  .init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  background: var(--init-chat-primary);
  color: #fff;
  border-color: var(--init-chat-primary);
}

.uk-light .init-chatbox-wrapper .init-chatbox-pinned-banner {
  background: var(--init-chat-bg-secondary);
  color: var(--init-chat-text-primary);
}

.uk-light .init-chatbox-wrapper .init-chatbox-pinned-text {
  color: var(--init-chat-text-primary);
}

@media (max-width: 640px) {
  .init-chatbox-wrapper .init-chatbox-message-body {
    max-width: 94%;
    padding: 9px 12px;
  }

  .init-chatbox-wrapper .init-chatbox-pin-btn {
    opacity: 1;
    pointer-events: auto;
  }

  .init-chatbox-wrapper .init-chatbox-pinned-banner {
    padding: 8px;
  }
}

/* =========================================================
   NOV CUSTOM - FACEBOOK CHAT STYLE
   ========================================================= */

/* Khung hội thoại */
.init-chatbox-wrapper .init-chatbox-messages {
  background: #f0f2f5;
  padding: 16px;
}

/* Mỗi tin nhắn */
.init-chatbox-wrapper .init-chatbox-message {
  width: 100%;
  margin-bottom: 12px;
  align-items: flex-start;
}

/* Tên người gửi */
.init-chatbox-wrapper .init-chatbox-message-header {
  width: auto;
  max-width: 85%;
  margin-bottom: 4px;
}

/* Avatar */
.init-chatbox-wrapper .init-chatbox-avatar {
  width: 30px;
  height: 30px;
  border: 0;
  box-shadow: none;
}

/* Bong bóng tin nhắn người khác */
.init-chatbox-wrapper
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body {
  background: #e4e6eb;
  color: #050505;
  border: 0;
  border-radius: 18px;
  padding: 9px 13px;
  margin-left: 38px;
  max-width: min(75%, 520px);
  box-shadow: none;
}

/* Tin nhắn của mình */
.init-chatbox-wrapper .init-chatbox-message.current-user {
  align-items: flex-end;
}

.init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-header {
  justify-content: flex-end;
}

.init-chatbox-wrapper .init-chatbox-message.current-user .init-chatbox-meta {
  flex-direction: row-reverse;
}

.init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  /*background: #0084ff; */
  color: #fff;
  border: 0;
  border-radius: 18px;
  padding: 9px 13px;
  margin: 0 0 0 20px;
  max-width: min(75%, 520px);
  box-shadow: none;
}

/* Góc bong bóng kiểu Messenger */
.init-chatbox-wrapper
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body {
  border-top-left-radius: 5px;
}

.init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  border-top-right-radius: 5px;
}

/* Tên và thời gian */
.init-chatbox-wrapper .init-chatbox-author {
  font-size: 12px;
  font-weight: 600;
}

.init-chatbox-wrapper .init-chatbox-meta-time {
  font-size: 11px;
}

/* Chế độ tối */
.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-light)
  .init-chatbox-messages,
.init-chatbox-wrapper.init-chatbox-theme-dark .init-chatbox-messages {
  background: #18191a;
}

.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-light)
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body,
.init-chatbox-wrapper.init-chatbox-theme-dark
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body {
  background: #3a3b3c;
  color: #e4e6eb;
}

.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-light)
  .init-chatbox-message.current-user
  .init-chatbox-message-body,
.init-chatbox-wrapper.init-chatbox-theme-dark
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  background: #0084ff;
  color: #fff;
}

/* Mobile */
@media (max-width: 640px) {
  .init-chatbox-wrapper
    .init-chatbox-message:not(.current-user)
    .init-chatbox-message-body,
  .init-chatbox-wrapper
    .init-chatbox-message.current-user
    .init-chatbox-message-body {
    max-width: 85%;
  }
}

/* =========================================================
   NOV CUSTOM - AVATAR FRAME CHO INIT CHAT ENGINE
   ========================================================= */

/* Vùng chứa avatar và khung */
.init-chatbox-wrapper .nov-chat-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  isolation: isolate;
}

/* Ảnh đại diện hoặc chữ cái fallback */
.init-chatbox-wrapper .nov-chat-avatar-wrap > .init-chatbox-avatar,
.init-chatbox-wrapper .nov-chat-avatar-wrap > .init-chatbox-avatar-fallback {
  position: relative;
  z-index: 1;
  display: block;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  object-fit: cover;
  box-sizing: border-box;
}

/* Khung avatar Nov phủ bên ngoài ảnh */
.init-chatbox-wrapper .nov-chat-avatar-frame {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 155%;
  height: 155%;
  max-width: none;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}

/* Không có ảnh: giữ fallback chữ cái */
.init-chatbox-wrapper .nov-chat-no-avatar .nov-chat-avatar-wrap {
  background: transparent;
}

/* Không có khung: không tạo lớp phủ */
.init-chatbox-wrapper .nov-chat-no-frame .nov-chat-avatar-frame {
  display: none;
}

/* =========================================================
   NOV CUSTOM - CHAT BUBBLE: RED THEME
   ========================================================= */

/* Tin nhắn người khác */
.init-chatbox-wrapper
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body {
  background: #fcebec;
  color: #642d32;
}

/* Tin nhắn của mình */
.init-chatbox-wrapper
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  background: #a8323e;
  color: #ffffff;
}

/* Chế độ tối: tin nhắn người khác */
.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-light)
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body,
.init-chatbox-wrapper.init-chatbox-theme-dark
  .init-chatbox-message:not(.current-user)
  .init-chatbox-message-body {
  background: #492b30;
  color: #fcebec;
}

/* Chế độ tối: tin nhắn của mình */
.uk-light
  .init-chatbox-wrapper:not(.init-chatbox-theme-light)
  .init-chatbox-message.current-user
  .init-chatbox-message-body,
.init-chatbox-wrapper.init-chatbox-theme-dark
  .init-chatbox-message.current-user
  .init-chatbox-message-body {
  background: #a8323e;
  color: #ffffff;
}
