/* Admin-only chat transcript. Loaded in wp-admin instead of the frontend stack. */

.niwa-widget--admin .niwa-morph__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--niwa-color-border-default) transparent;
  display: flex;
  flex-direction: column;
  padding: var(--niwa-space-sm) 0;
  gap: var(--niwa-space-xs);
}

.niwa-widget--admin .niwa-morph__body::-webkit-scrollbar {
  width: 6px;
}

.niwa-widget--admin .niwa-morph__body::-webkit-scrollbar-track {
  background: transparent;
}

.niwa-widget--admin .niwa-morph__body::-webkit-scrollbar-thumb {
  background: var(--niwa-color-border-default);
  border-radius: var(--niwa-radius-full);
}

.niwa-widget--admin .niwa-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--niwa-space-xl) var(--niwa-space-lg) var(--niwa-space-lg);
}

.niwa-widget--admin .niwa-welcome__icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--niwa-space-md);
}

.niwa-widget--admin .niwa-welcome__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.niwa-widget--admin .niwa-welcome__text {
  color: var(--niwa-color-text-primary);
  font-size: var(--niwa-font-size-xl);
  font-weight: var(--niwa-font-weight-semibold);
  text-align: center;
}

.niwa-admin-chat__sentinel {
  flex: 0 0 1px;
  min-height: 1px;
}

.niwa-widget--admin .niwa-message {
  display: flex;
  align-items: flex-end;
  gap: var(--niwa-space-sm);
  max-width: var(--niwa-message-row-max-width, 85%);
  margin-left: var(--niwa-space-lg);
  margin-right: var(--niwa-space-lg);
}

.niwa-widget--admin .niwa-message--bot {
  align-self: flex-start;
  max-width: var(--niwa-message-bot-max-width, var(--niwa-message-row-max-width, 85%));
}

.niwa-widget--admin .niwa-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: var(--niwa-message-user-max-width, var(--niwa-message-row-max-width, 85%));
}

.niwa-widget--admin .niwa-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--niwa-radius-full);
  background: var(--niwa-color-primary-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}

.niwa-widget--admin .niwa-message__avatar img {
  width: 28px;
  height: 28px;
  border-radius: var(--niwa-radius-full);
}

.niwa-widget--admin .niwa-message--user .niwa-message__avatar {
  display: none;
}

.niwa-widget--admin .niwa-message__content {
  min-width: 0;
  max-width: 100%;
}

.niwa-widget--admin .niwa-message__bubble {
  max-width: 100%;
  padding: var(--niwa-space-md) var(--niwa-space-lg);
  border-radius: var(--niwa-radius-xl);
  line-height: var(--niwa-line-height-normal);
  overflow: hidden;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.niwa-widget--admin .niwa-message--bot .niwa-message__bubble {
  background: var(--niwa-color-bubble-bot);
  color: var(--niwa-color-bubble-bot-text);
  border-bottom-left-radius: var(--niwa-radius-sm);
}

.niwa-widget--admin[data-niwa-theme="light"] .niwa-message--bot .niwa-message__bubble {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.05);
}

.niwa-widget--admin .niwa-message--user .niwa-message__bubble {
  background: var(--niwa-color-bubble-user);
  color: var(--niwa-color-bubble-user-text);
  border-bottom-right-radius: var(--niwa-radius-sm);
}

.niwa-widget--admin .niwa-message__text {
  margin: 0 !important;
  padding: 0 !important;
  font-size: var(--niwa-font-size-md);
  line-height: var(--niwa-line-height-normal);
}

.niwa-widget--admin .niwa-message__bubble p,
.niwa-widget--admin .niwa-message__bubble div,
.niwa-widget--admin .niwa-message__bubble span {
  margin: 0 !important;
  padding: 0 !important;
}

.niwa-widget--admin .niwa-message__bubble code {
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.08);
  color: inherit;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.42em;
  white-space: break-spaces;
  overflow-wrap: anywhere;
}

.niwa-widget--admin .niwa-message__bubble pre {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: var(--niwa-space-sm) 0 0 !important;
  padding: 12px 14px !important;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.06);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.niwa-widget--admin .niwa-message__bubble pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  white-space: inherit;
}

.niwa-widget--admin .niwa-message__time {
  margin-top: var(--niwa-space-xs);
  padding: 0 var(--niwa-space-xs);
  color: var(--niwa-color-text-tertiary);
  font-size: var(--niwa-font-size-xs);
}

.niwa-widget--admin .niwa-message--user .niwa-message__time {
  text-align: right;
}

.niwa-widget--admin .niwa-admin-chat__date-sep {
  display: flex;
  align-items: center;
  gap: var(--niwa-space-md);
  margin: var(--niwa-space-lg) 0;
  padding: 4px var(--niwa-space-lg);
  background: var(--niwa-color-surface);
  color: var(--niwa-color-text-tertiary);
  font-size: var(--niwa-font-size-xs);
  font-weight: var(--niwa-font-weight-medium);
  letter-spacing: 0;
  text-transform: uppercase;
}

.niwa-widget--admin .niwa-admin-chat__date-sep::before,
.niwa-widget--admin .niwa-admin-chat__date-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--niwa-color-border-subtle);
}

.niwa-widget--admin[data-niwa-theme="dark"] .niwa-message__bubble code {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.niwa-widget--admin[data-niwa-theme="dark"] .niwa-message__bubble pre {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}
