.nvh-ai,
.nvh-ai * {
  box-sizing: border-box;
}

.nvh-ai {
  --nvh-green: #127a32;
  --nvh-deep-green: #005c2c;
  --nvh-text: #1f2c26;
  --nvh-muted: #5c6c63;
  --nvh-soft: #f8fbf7;
  --nvh-border: #d8e7da;
  position: fixed;
  right: 24px;
  bottom: 86px;
  z-index: 99998;
  color: var(--nvh-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
}

.nvh-ai button,
.nvh-ai select,
.nvh-ai textarea {
  font: inherit;
}

.nvh-ai__launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 17px 8px 8px;
  border: 0;
  border-radius: 28px;
  background: var(--nvh-green);
  box-shadow: 0 10px 28px rgba(0, 76, 35, 0.22);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.nvh-ai__launcher:hover,
.nvh-ai__launcher:focus-visible {
  background: var(--nvh-deep-green);
}

.nvh-ai__launcher:focus-visible,
.nvh-ai__close:focus-visible,
.nvh-ai__send:focus-visible,
.nvh-ai__language:focus-visible,
.nvh-ai__composer textarea:focus-visible,
.nvh-ai__footer a:focus-visible {
  outline: 3px solid rgba(18, 122, 50, 0.3);
  outline-offset: 2px;
}

.nvh-ai__launcher-icon,
.nvh-ai__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--nvh-deep-green);
  font-size: 20px;
  font-weight: 800;
}

.nvh-ai__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  display: grid;
  grid-template-rows: auto auto minmax(150px, 1fr) auto auto auto;
  width: min(390px, calc(100vw - 32px));
  height: min(610px, calc(100vh - 170px));
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--nvh-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 44, 38, 0.2);
}

.nvh-ai__panel[hidden] {
  display: none;
}

.nvh-ai__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px 14px;
  background: var(--nvh-deep-green);
  color: #fff;
}

.nvh-ai__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nvh-ai__identity strong,
.nvh-ai__status {
  display: block;
}

.nvh-ai__identity strong {
  overflow: hidden;
  max-width: 240px;
  color: #fff;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nvh-ai__status {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.nvh-ai__avatar {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.nvh-ai__close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 27px;
  font-weight: 300;
  line-height: 1;
}

.nvh-ai__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nvh-ai__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #e9f0ea;
  background: var(--nvh-soft);
  color: var(--nvh-muted);
  font-size: 12px;
}

.nvh-ai__language {
  max-width: 205px;
  height: 34px;
  margin: 0;
  padding: 4px 28px 4px 9px;
  border: 1px solid var(--nvh-border);
  border-radius: 6px;
  background-color: #fff;
  color: var(--nvh-text);
  font-size: 13px;
}

.nvh-ai__messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 14px 10px;
  background: #fff;
  overscroll-behavior: contain;
}

.nvh-ai__message {
  width: fit-content;
  max-width: 86%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--nvh-text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.nvh-ai__message--assistant {
  margin-right: auto;
  border: 1px solid var(--nvh-border);
  border-bottom-left-radius: 3px;
  background: var(--nvh-soft);
}

.nvh-ai__message--user {
  margin-left: auto;
  border-bottom-right-radius: 3px;
  background: var(--nvh-green);
  color: #fff;
}

.nvh-ai__message--notice {
  max-width: 100%;
  margin: 2px auto 12px;
  padding: 3px 8px;
  color: var(--nvh-muted);
  font-size: 11px;
  text-align: center;
}

.nvh-ai__message--waiting {
  color: var(--nvh-muted);
  font-style: italic;
}

.nvh-ai__message--error {
  border-color: #e6b7b7;
  background: #fff8f8;
}

.nvh-ai__product-media {
  width: min(240px, 86%);
  padding: 8px;
  background: #fff;
  white-space: normal;
}

.nvh-ai__product-image-link {
  display: block;
  border-radius: 7px;
  background: #fff;
}

.nvh-ai__product-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 230px;
  margin: 0 auto;
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
}

.nvh-ai__product-caption {
  margin-top: 8px;
  color: var(--nvh-text);
  font-weight: 700;
  line-height: 1.35;
}

.nvh-ai__product-name {
  display: block;
  margin-top: 2px;
  color: var(--nvh-muted);
  font-size: 11px;
  line-height: 1.35;
}

.nvh-ai__privacy {
  padding: 7px 14px;
  border-top: 1px solid #edf2ee;
  background: #fffdf4;
  color: #6d6443;
  font-size: 10px;
  line-height: 1.35;
}

.nvh-ai__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #edf2ee;
  background: #fff;
}

.nvh-ai__composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 112px;
  margin: 0;
  padding: 10px 11px;
  resize: none;
  border: 1px solid var(--nvh-border);
  border-radius: 8px;
  background: #fff;
  color: var(--nvh-text);
  line-height: 1.35;
}

.nvh-ai__composer textarea::placeholder {
  color: #7a8a80;
}

.nvh-ai__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--nvh-green);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
}

.nvh-ai__send:hover {
  background: var(--nvh-deep-green);
}

.nvh-ai__send:disabled,
.nvh-ai__composer textarea:disabled,
.nvh-ai__language:disabled {
  cursor: wait;
  opacity: 0.65;
}

.nvh-ai__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 7px 14px 9px;
  background: var(--nvh-soft);
  color: var(--nvh-muted);
  font-size: 10px;
}

.nvh-ai__footer a {
  color: var(--nvh-deep-green);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nvh-ai__sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.nvh-ai__panel[dir="rtl"] .nvh-ai__message--assistant {
  margin-right: 0;
  margin-left: auto;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 10px;
}

.nvh-ai__panel[dir="rtl"] .nvh-ai__message--user {
  margin-right: auto;
  margin-left: 0;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 3px;
}

@media (max-width: 520px) {
  .nvh-ai {
    right: 12px;
    bottom: 76px;
  }

  .nvh-ai__launcher {
    min-width: 54px;
    min-height: 54px;
    padding: 8px;
  }

  .nvh-ai__launcher-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .nvh-ai__panel {
    right: 0;
    width: calc(100vw - 24px);
    height: min(640px, calc(100vh - 150px));
    min-height: 390px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .nvh-ai__launcher {
    transition: background-color 150ms ease, transform 150ms ease;
  }

  .nvh-ai__launcher:hover {
    transform: translateY(-1px);
  }
}
