@import url("/assets/noot-design-tokens.css");

.noot-support-widget {
  --noot-support-green: var(--noot-green);
  --noot-support-deep: var(--noot-forest);
  --noot-support-ink: var(--noot-ink);
  --noot-support-muted: var(--noot-muted);
  --noot-support-line: var(--noot-line);
  --noot-support-soft: #edf7e8;
  --noot-support-paper: var(--noot-paper);
  --noot-support-shadow: var(--noot-shadow-pop);
  color: var(--noot-support-ink);
  font-family: var(--noot-font-sans, "Figtree", ui-sans-serif, system-ui, sans-serif);
  position: fixed;
  -webkit-text-size-adjust: 100%;
  z-index: 2147483000;
}

.noot-support-widget *,
.noot-support-widget *::before,
.noot-support-widget *::after {
  box-sizing: border-box;
}

.noot-support-widget button,
.noot-support-widget input,
.noot-support-widget textarea {
  font: inherit;
}

.noot-support-toggle {
  align-items: center;
  background: var(--noot-support-green);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  bottom: max(18px, env(safe-area-inset-bottom));
  box-shadow: 0 16px 40px rgba(0, 80, 38, 0.28);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  gap: 8px;
  min-height: 54px;
  padding: 8px 17px 8px 8px;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
}

.noot-support-toggle-mark {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: var(--noot-support-green);
  display: inline-flex;
  font-family: var(--noot-font-sans, "Figtree", ui-sans-serif, system-ui, sans-serif);
  font-size: 22px;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.noot-support-presence {
  background: #f1c44b;
  border: 2px solid var(--noot-support-green);
  border-radius: 999px;
  height: 11px;
  position: absolute;
  right: 8px;
  top: 5px;
  width: 11px;
}

.noot-support-presence[data-status="online"] { background: #8eef9d; }
.noot-support-presence[data-status="unknown"] { background: #c6cec8; }

.noot-support-panel {
  background: var(--noot-support-paper);
  border: 1px solid var(--noot-support-line);
  border-radius: var(--noot-radius);
  bottom: 84px;
  box-shadow: var(--noot-support-shadow);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: min(650px, calc(var(--noot-support-viewport-height, 100dvh) - 112px));
  max-height: calc(var(--noot-support-viewport-height, 100dvh) - 112px);
  overflow: hidden;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  width: min(400px, calc(100vw - 28px));
}

.noot-support-panel[hidden],
.noot-support-tab-panel[hidden],
.noot-support-start[hidden],
.noot-support-conversation[hidden],
.noot-support-error[hidden],
.noot-support-start > div[hidden] {
  display: none !important;
}

.noot-support-head {
  align-items: center;
  background: var(--noot-support-deep);
  color: #fff;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 72px;
  padding: 13px 15px;
}

.noot-support-brand {
  align-items: center;
  display: flex;
  gap: 11px;
  min-width: 0;
}

.noot-support-brand > img {
  background: #fff;
  border-radius: var(--noot-radius-sm);
  height: 42px;
  object-fit: contain;
  padding: 6px;
  width: 42px;
}

.noot-support-brand > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.noot-support-brand strong {
  font-family: var(--noot-font-sans, "Figtree", ui-sans-serif, system-ui, sans-serif);
  font-size: 20px;
  line-height: 1;
}

.noot-support-brand small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.noot-support-icon-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 44px;
  font-size: 23px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.noot-support-tabs {
  background: #fff;
  border-bottom: 1px solid var(--noot-support-line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 10px;
}

.noot-support-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--noot-support-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  min-height: 48px;
  padding: 9px 8px 7px;
}

.noot-support-tabs button[aria-selected="true"] {
  border-bottom-color: var(--noot-support-green);
  color: var(--noot-support-deep);
}

.noot-support-tab-panel {
  display: grid;
  grid-template-rows: auto minmax(110px, 1fr) auto auto auto;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.noot-support-context {
  color: var(--noot-support-muted);
  font-size: 10px;
  font-weight: 800;
  min-height: 20px;
  overflow: hidden;
  padding: 1px 3px 7px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.noot-support-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px 3px 10px;
  scrollbar-width: thin;
}

.noot-support-welcome {
  background: var(--noot-support-soft);
  border: 1px solid var(--noot-support-line);
  border-radius: 16px;
  color: var(--noot-support-deep);
  font-size: 13px;
  line-height: 1.45;
  padding: 13px;
}

.noot-support-message {
  display: grid;
  gap: 3px;
  max-width: 88%;
}

.noot-support-message strong,
.noot-support-message small {
  color: var(--noot-support-muted);
  font-size: 10px;
  padding: 0 5px;
}

.noot-support-message p {
  background: #f0f5ed;
  border: 1px solid rgba(6, 45, 24, 0.08);
  border-radius: 7px 17px 17px 17px;
  color: var(--noot-support-ink);
  font-size: 13px;
  line-height: 1.48;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.noot-support-message.is-customer {
  align-self: flex-end;
  justify-items: end;
}

.noot-support-message.is-customer p {
  background: var(--noot-support-green);
  border-color: var(--noot-support-green);
  border-radius: 17px 7px 17px 17px;
  color: #fff;
}

.noot-support-quick-replies {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 6px 2px 9px;
  scrollbar-width: none;
}

.noot-support-quick-replies::-webkit-scrollbar { display: none; }

.noot-support-quick-replies button {
  background: #fff;
  border: 1px solid var(--noot-support-line);
  border-radius: 999px;
  color: var(--noot-support-deep);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  min-height: 44px;
  padding: 7px 10px;
}

.noot-support-composer {
  align-items: end;
  background: #fff;
  border: 1px solid var(--noot-support-line);
  border-radius: 17px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px;
}

.noot-support-widget .noot-support-composer textarea,
.noot-support-widget .noot-support-start input,
.noot-support-widget .noot-support-start textarea {
  background: #fff;
  border: 1px solid var(--noot-support-line);
  border-radius: 12px;
  color: var(--noot-support-ink);
  font-size: 16px;
  line-height: 1.35;
  max-height: 112px;
  min-height: 44px;
  padding: 10px 11px;
  resize: vertical;
  width: 100%;
}

.noot-support-composer textarea {
  border: 0;
  max-height: 88px;
  padding: 8px;
  resize: none;
}

.noot-support-composer button,
.noot-support-start > button {
  background: var(--noot-support-green);
  border: 1px solid var(--noot-support-green);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  min-height: 42px;
  padding: 9px 13px;
}

.noot-support-widget button:disabled,
.noot-support-widget input:disabled,
.noot-support-widget textarea:disabled {
  cursor: wait;
  opacity: 0.58;
}

.noot-support-disclaimer {
  color: var(--noot-support-muted);
  font-size: 9px;
  line-height: 1.35;
  margin: 7px 2px 0;
  text-align: center;
}

.noot-support-error {
  background: #fff0ed;
  border: 1px solid rgba(173, 55, 47, 0.24);
  border-radius: 11px;
  color: #8e302a;
  font-size: 11px;
  line-height: 1.4;
  margin: 4px 0 8px;
  padding: 8px 10px;
}

.noot-support-availability {
  align-items: start;
  background: #fff6db;
  border: 1px solid #ead59b;
  border-radius: 13px;
  display: grid;
  gap: 2px;
  grid-template-columns: 10px minmax(0, 1fr);
  margin-bottom: 10px;
  padding: 10px 11px;
}

.noot-support-availability::before {
  background: #cf8f19;
  border-radius: 999px;
  content: "";
  grid-row: 1 / span 2;
  height: 9px;
  margin-top: 4px;
  width: 9px;
}

.noot-support-availability[data-status="online"] {
  background: var(--noot-support-soft);
  border-color: var(--noot-support-line);
}

.noot-support-availability[data-status="online"]::before { background: var(--noot-support-green); }
.noot-support-availability[data-status="unknown"]::before { background: #9da69f; }

.noot-support-availability strong {
  color: var(--noot-support-deep);
  font-size: 12px;
}

.noot-support-availability span {
  color: var(--noot-support-muted);
  font-size: 10px;
  line-height: 1.35;
}

.noot-support-start {
  display: grid;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
  scroll-padding-block: 12px 88px;
}

.noot-support-start > div,
.noot-support-start > label {
  color: var(--noot-support-deep);
  display: grid;
  font-size: 11px;
  font-weight: 850;
  gap: 5px;
}

.noot-support-start > button {
  min-height: 48px;
}

.noot-support-start input,
.noot-support-start textarea {
  scroll-margin-block: 14px 88px;
}

.noot-support-conversation {
  display: grid;
  grid-template-rows: auto minmax(100px, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.noot-support-ticket-meta {
  color: var(--noot-support-muted);
  font-size: 10px;
  font-weight: 850;
  padding: 0 3px 7px;
  text-transform: uppercase;
}

.noot-support-sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.noot-support-widget :focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 150, 65, 0.24);
  outline: 2px solid transparent;
}

@media (max-width: 640px) {
  .noot-support-toggle {
    bottom: calc(12px + env(safe-area-inset-bottom));
    min-height: 50px;
    right: 12px;
  }

  .noot-home-v3 .noot-support-toggle,
  .noot-v4 .noot-support-toggle {
    padding-right: 8px;
  }

  .noot-home-v3 .noot-support-toggle > span:nth-child(2),
  .noot-v4 .noot-support-toggle > span:nth-child(2) {
    display: none;
  }

  .account-v2-body .noot-support-toggle,
  .checkout-page .noot-support-toggle {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .noot-support-panel {
    border-radius: 20px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    height: min(660px, calc(var(--noot-support-viewport-height, 100dvh) - 84px));
    left: 8px;
    max-height: calc(var(--noot-support-viewport-height, 100dvh) - 84px);
    right: 8px;
    width: auto;
  }

  .noot-support-widget[data-noot-support-keyboard="true"] .noot-support-toggle {
    display: none;
  }

  .noot-support-widget[data-noot-support-keyboard="true"] .noot-support-panel {
    bottom: calc(8px + var(--noot-support-viewport-bottom-inset, 0px));
    height: calc(var(--noot-support-viewport-height, 100dvh) - 16px);
    max-height: calc(var(--noot-support-viewport-height, 100dvh) - 16px);
    scroll-padding-top: calc(var(--noot-support-viewport-offset-top, 0px) + 8px);
  }

  .noot-support-widget[data-noot-support-keyboard="true"] .noot-support-head {
    min-height: 56px;
    padding-block: 7px;
  }

  .noot-support-widget[data-noot-support-keyboard="true"] .noot-support-tab-panel {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .account-v2-body .noot-support-panel,
  .checkout-page .noot-support-panel {
    bottom: calc(132px + env(safe-area-inset-bottom));
    height: min(620px, calc(var(--noot-support-viewport-height, 100dvh) - 144px));
    max-height: calc(var(--noot-support-viewport-height, 100dvh) - 144px);
  }

  .noot-support-head {
    min-height: 64px;
    padding: 10px 12px;
  }

  .noot-support-tab-panel {
    padding: 10px;
  }

  .noot-support-tabs button { min-height: 44px; }

  .noot-support-composer {
    position: sticky;
    bottom: 0;
  }
}

@media (max-width: 380px) {
  .noot-support-toggle > span:nth-child(2) { display: none; }
  .noot-support-toggle { padding-right: 8px; }
  .noot-support-tabs button { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .noot-support-widget *,
  .noot-support-widget *::before,
  .noot-support-widget *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
