/* ==========================================================================
   Niwa Chatbot – Frontend Shield
   --------------------------------------------------------------------------
   Final isolation layer loaded after every other Niwa frontend stylesheet.
   Its job is to neutralize aggressive WordPress/theme/global form and button
   rules without changing the widget structure or JS selectors.
   ========================================================================== */

.niwa-widget {
  text-align: left !important;
  font-family: var(--niwa-font-family) !important;
  font-size: var(--niwa-font-size-md) !important;
  font-style: normal !important;
  font-weight: var(--niwa-font-weight-normal) !important;
  line-height: var(--niwa-line-height-normal) !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  --niwa-message-row-max-width: 82%;
  --niwa-message-bot-max-width: 82%;
  --niwa-message-user-max-width: 68%;
}

.niwa-widget--inline {
  isolation: isolate;
}

.niwa-widget .niwa-message__text {
  font-family: var(--niwa-font-family) !important;
  font-size: var(--niwa-font-size-md) !important;
  font-style: normal !important;
  font-weight: var(--niwa-font-weight-normal) !important;
  line-height: var(--niwa-line-height-normal) !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

.niwa-widget .niwa-message__bubble :where(p, div, span, strong, em, a) {
  font-family: var(--niwa-font-family) !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

.niwa-widget .niwa-message__bubble strong {
  font-weight: var(--niwa-font-weight-semibold) !important;
}

.niwa-widget--floating {
  position: relative;
  z-index: var(--niwa-layer-floating) !important;
  isolation: auto !important;
}

.niwa-widget :where(.niwa-morph, .niwa-center) {
  z-index: var(--niwa-layer-floating) !important;
}

.niwa-widget :where(button, input, textarea, select, option) {
  font-family: var(--niwa-font-family) !important;
  font-size: inherit !important;
  font-style: normal !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: none !important;
  text-indent: 0 !important;
  text-shadow: none !important;
  max-width: 100%;
}

.niwa-widget :where(button, input, textarea, select) {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
  filter: none !important;
}

.niwa-widget :where(a, button) {
  text-decoration: none !important;
}

.niwa-widget :where(.niwa-morph__close, .niwa-center__close) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: var(--niwa-radius-full) !important;
  background: none !important;
  box-shadow: none !important;
}

.niwa-widget :where(.niwa-morph__send, .niwa-center__send, .niwa-form__submit, .niwa-input-bar__attachment, .niwa-input-bar__send) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  margin: 0 !important;
  text-align: center !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  background-image: none !important;
  box-shadow: none !important;
}

.niwa-widget .niwa-morph__send,
.niwa-widget .niwa-center__send {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  flex: 0 0 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: #0A1217 !important;
  color: #FFFFFF !important;
  opacity: 0.9 !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  overflow: hidden !important;
  transform: none;
}

.niwa-widget[data-niwa-theme="dark"] .niwa-morph__send,
.niwa-widget[data-niwa-theme="dark"] .niwa-center__send {
  background: #E8E6E1 !important;
  color: #111318 !important;
}

.niwa-widget .niwa-morph__send:hover,
.niwa-widget .niwa-center__send:hover {
  opacity: 1 !important;
}

.niwa-widget .niwa-morph__send--disabled,
.niwa-widget .niwa-center__send--disabled {
  background: #9CA3AF !important;
  opacity: 0.4 !important;
  cursor: default !important;
  pointer-events: none !important;
}

.niwa-widget[data-niwa-theme="dark"] .niwa-morph__send--disabled,
.niwa-widget[data-niwa-theme="dark"] .niwa-center__send--disabled {
  background: #4B5563 !important;
}

.niwa-widget .niwa-morph__send::before,
.niwa-widget .niwa-morph__send::after,
.niwa-widget .niwa-center__send::before,
.niwa-widget .niwa-center__send::after,
.niwa-widget .niwa-form__submit::before,
.niwa-widget .niwa-form__submit::after,
.niwa-widget .niwa-input-bar__send::before,
.niwa-widget .niwa-input-bar__send::after,
.niwa-widget .niwa-input-bar__attachment::before,
.niwa-widget .niwa-input-bar__attachment::after {
  content: none !important;
  display: none !important;
}

.niwa-widget :where(.niwa-action, .niwa-quick-reply, .niwa-btn-pill, .niwa-btn-cart, .niwa-copy-code-btn) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  background-image: none !important;
}

.niwa-widget :where(.niwa-morph__textarea, .niwa-center__textarea, .niwa-input-bar__textarea, .niwa-form__input) {
  text-align: left !important;
  text-transform: none !important;
  text-indent: 0 !important;
  text-shadow: none !important;
  background-image: none !important;
  color: var(--niwa-color-text-primary) !important;
  -webkit-text-fill-color: var(--niwa-color-text-primary) !important;
  caret-color: var(--niwa-color-text-primary) !important;
}

.niwa-widget[data-niwa-theme="dark"] :where(.niwa-morph__textarea, .niwa-center__textarea, .niwa-input-bar__textarea, .niwa-form__input):-webkit-autofill,
.niwa-widget[data-niwa-theme="dark"] :where(.niwa-morph__textarea, .niwa-center__textarea, .niwa-input-bar__textarea, .niwa-form__input):-webkit-autofill:hover,
.niwa-widget[data-niwa-theme="dark"] :where(.niwa-morph__textarea, .niwa-center__textarea, .niwa-input-bar__textarea, .niwa-form__input):-webkit-autofill:focus {
  -webkit-text-fill-color: var(--niwa-color-text-primary) !important;
  caret-color: var(--niwa-color-text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.niwa-widget--frontend-shell .niwa-morph__textarea,
.niwa-widget--frontend-shell .niwa-center__textarea {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  font-family: var(--niwa-font-family) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  height: 22px !important;
  min-height: 22px !important;
  max-height: 96px !important;
  padding: 4px 8px !important;
  margin: 0 !important;
  line-height: 22px !important;
  letter-spacing: -0.14px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  resize: none !important;
  overflow-x: hidden !important;
}

.niwa-widget--frontend-shell .niwa-morph__input,
.niwa-widget--frontend-shell .niwa-center__input {
  min-width: 0 !important;
  min-height: 0 !important;
}

.niwa-widget--frontend-shell .niwa-morph--open:not(.niwa-morph--multiline) .niwa-morph__pill,
.niwa-widget--frontend-shell .niwa-center--open:not(.niwa-center--multiline) .niwa-center__pill {
  height: 48px !important;
  min-height: 48px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  align-items: center !important;
}

.niwa-widget--frontend-shell .niwa-morph--open.niwa-morph--multiline .niwa-morph__pill,
.niwa-widget--frontend-shell .niwa-center--open.niwa-center--multiline .niwa-center__pill {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  align-items: flex-end !important;
}

.niwa-widget--frontend-shell .niwa-morph__chat,
.niwa-widget--frontend-shell .niwa-center__chat {
  margin: 0 !important;
  padding: 0 !important;
}

.niwa-widget--frontend-shell .niwa-morph__header,
.niwa-widget--frontend-shell .niwa-center__header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 var(--niwa-space-lg) !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.niwa-widget--frontend-shell .niwa-morph__wordmark {
  width: auto !important;
  height: 10px !important;
}

.niwa-widget--frontend-shell .niwa-morph__close,
.niwa-widget--frontend-shell .niwa-center__close {
  display: inline-flex !important;
  flex: 0 0 28px !important;
  align-self: center !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  translate: none !important;
}

.niwa-widget--frontend-shell .niwa-morph__close svg,
.niwa-widget--frontend-shell .niwa-center__close svg {
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  translate: none !important;
}

.niwa-widget--frontend-shell .niwa-morph__body,
.niwa-widget--frontend-shell .niwa-center__body {
  background: transparent !important;
}

.niwa-widget--frontend-shell .niwa-welcome__text {
  max-width: 28ch !important;
}

.niwa-widget--frontend-shell[data-niwa-theme="light"] .niwa-messages__date-sep,
.niwa-widget--frontend-shell[data-niwa-theme="light"] .niwa-message__time {
  color: #FFFFFF !important;
}

.niwa-widget--frontend-shell[data-niwa-theme="light"] .niwa-messages__date-sep::before,
.niwa-widget--frontend-shell[data-niwa-theme="light"] .niwa-messages__date-sep::after {
  background: #FFFFFF !important;
}

.niwa-widget :where(.niwa-morph__textarea, .niwa-center__textarea, .niwa-input-bar__textarea, .niwa-form__input)::placeholder {
  text-transform: none !important;
  letter-spacing: normal !important;
}

.niwa-widget :where(.niwa-action__icon, .niwa-morph__send svg, .niwa-center__send svg, .niwa-form__submit svg, .niwa-input-bar__attachment svg, .niwa-input-bar__send svg) {
  flex-shrink: 0;
}

.niwa-widget .niwa-morph__send svg,
.niwa-widget .niwa-center__send svg {
  display: block !important;
  width: 32px !important;
  height: 32px !important;
  fill: none !important;
  stroke: currentColor !important;
  overflow: visible !important;
  pointer-events: none !important;
}

.niwa-attention-bubble {
  z-index: var(--niwa-layer-attention) !important;
  text-align: left !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.niwa-attention-bubble :where(button) {
  font-family: var(--niwa-font-family) !important;
  font-size: inherit !important;
  font-style: normal !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: none !important;
  text-decoration: none !important;
  text-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
  filter: none !important;
}

.niwa-attention-bubble :where(.niwa-bubble-close, .niwa-bubble-action-btn) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

@media (max-width: 782px) {
  .niwa-widget {
    --niwa-message-row-max-width: 86%;
    --niwa-message-bot-max-width: 86%;
    --niwa-message-user-max-width: 74%;
  }
}
