.pp-ai-chat {
  --pp-ai-blue-900: #071f3a;
  --pp-ai-blue-950: #041427;
  --pp-ai-blue-800: #0b2f55;
  --pp-ai-blue-700: #16456f;
  --pp-ai-green: #20d37c;
  --pp-ai-green-soft: rgba(32, 211, 124, 0.18);
  --pp-ai-text: #112033;
  --pp-ai-muted: #5d6b7a;
  --pp-ai-surface: #071f3a;
  --pp-ai-bg: #102b44;
  --pp-ai-shadow: 0 22px 54px rgba(0, 8, 22, 0.46);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.pp-ai-chat * {
  box-sizing: border-box;
}

.pp-ai-chat__button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 18px 10px 12px;
  border: 1px solid rgba(32, 211, 124, 0.5);
  border-radius: 999px;
  background: linear-gradient(135deg, #08345c, #0b725d);
  color: #ffffff;
  box-shadow: 0 16px 38px rgba(2, 12, 27, 0.34);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pp-ai-chat__button:hover,
.pp-ai-chat__button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(32, 211, 124, 0.7);
  box-shadow: 0 20px 48px rgba(2, 12, 27, 0.42);
  outline: none;
}

.pp-ai-chat__button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: var(--pp-ai-green);
  color: var(--pp-ai-blue-900);
}

.pp-ai-chat__button-icon svg,
.pp-ai-chat__close svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.pp-ai-chat__button-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.pp-ai-chat__popup {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 132px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(84, 177, 205, 0.52);
  border-radius: 17px;
  background: var(--pp-ai-surface);
  box-shadow: var(--pp-ai-shadow);
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.pp-ai-chat.is-open .pp-ai-chat__popup {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pp-ai-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 86px;
  padding: 18px 18px 15px;
  background: linear-gradient(135deg, #092b4f, #0d3d68 58%, #0d7967);
  color: #ffffff;
  border-bottom: 1px solid rgba(84, 177, 205, 0.36);
}

.pp-ai-chat__heading {
  min-width: 0;
}

.pp-ai-chat__heading strong {
  display: block;
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
}

.pp-ai-chat__heading p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.35;
}

.pp-ai-chat__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
}

.pp-ai-chat__close:hover,
.pp-ai-chat__close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.pp-ai-chat__body {
  min-height: 0;
  overflow: hidden;
  background: #102b44;
  position: relative;
  display: flex;
  flex-direction: column;
}

.pp-ai-chat__body .mwai-chatbot-container,
.pp-ai-chat__body .mwai-chatbot,
.pp-ai-chat__body .mwai-chatbot-container > div {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  flex: 1 1 auto;
}

.pp-ai-chat__body .mwai-chatbot-container {
  min-height: 100%;
}

.pp-ai-chat__body .mwai-chatgpt-theme {
  --mwai-spacing: 14px;
  --mwai-fontSize: 14px;
  --mwai-lineHeight: 1.48;
  --mwai-borderRadius: 13px;
  --mwai-borderColor: rgba(84, 177, 205, 0.28);
  --mwai-width: 100%;
  --mwai-maxHeight: none;
  --mwai-fontColor: rgba(255, 255, 255, 0.94);
  --mwai-backgroundPrimaryColor: #123c5f;
  --mwai-backgroundHeaderColor: #0d3658;
  --mwai-backgroundSecondaryColor: #102b44;
  --mwai-accentColor: #1687f5;
  --mwai-headerColor: rgba(255, 255, 255, 0.9);
  --mwai-iconTextBackgroundColor: #0b725d;
  --mwai-bubbleColor: #0b725d;
  display: flex;
  width: 100% !important;
  max-width: none !important;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  background: #102b44;
}



.pp-ai-chat__body .mwai-chatgpt-theme .mwai-body {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  border-radius: 0;
  background: #102b44;
  display: flex;
  flex-direction: column;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-conversation {
  max-height: none !important;
  min-height: 0;
  padding-top: 4px;
  background:
    radial-gradient(circle at 18% 12%, rgba(32, 211, 124, 0.08), transparent 28%),
    linear-gradient(180deg, #153957 0%, #102b44 100%);
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply {
  padding: 13px 16px;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply.mwai-user .mwai-text {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1687f5, #0e74d6);
  box-shadow: 0 8px 20px rgba(5, 18, 39, 0.2);
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply.mwai-ai .mwai-text {
  color: rgba(255, 255, 255, 0.92);
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply-actions,
.pp-ai-chat__body .mwai-chatgpt-theme .mwai-copy-button,
.pp-ai-chat__body .mwai-chatgpt-theme .mwai-download-button,
.pp-ai-chat__body .mwai-chatgpt-theme .mwai-pdf-button {
  display: none !important;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply .mwai-name .mwai-avatar {
  width: 32px;
  height: 32px;
  margin-right: 9px;
  border-radius: 10px;
  background: linear-gradient(135deg, #20d37c, #117e73);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 18px rgba(0, 8, 22, 0.26);
  position: relative;
  overflow: hidden;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply .mwai-name .mwai-avatar img,
.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply .mwai-name .mwai-avatar svg {
  display: none !important;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply .mwai-name .mwai-avatar::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: url('../img/pp-avatar.png') center/cover no-repeat;
  border-radius: 10px;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-reply .mwai-name .mwai-avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid #153957;
  border-radius: 999px;
  background: #20d37c;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-input {
  margin: 12px auto 14px;
  width: calc(100% - 28px);
  padding: 5px 7px 5px 8px !important;
  border: 1px solid rgba(84, 177, 205, 0.34);
  border-radius: 18px;
  background: #0c3150;
  box-shadow: 0 10px 24px rgba(0, 7, 18, 0.28);
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-input .mwai-input-text textarea {
  color: #ffffff;
  padding: 7px 5px;
}

.pp-ai-chat__body .mwai-chatgpt-theme .mwai-input button {
  border-radius: 14px;
  background: linear-gradient(135deg, #1687f5, #0e74d6);
}

body.pp-ai-chat-lock {
  overflow: hidden;
}

body.pp-ai-hide-native-mwai .mwai-chatgpt-theme.mwai-window {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .pp-ai-chat {
    right: 16px;
    bottom: max(88px, calc(88px + env(safe-area-inset-bottom)));
  }

  .pp-ai-chat--hide-mobile {
    display: none;
  }

  .pp-ai-chat__button {
    min-height: 50px;
    max-width: calc(100vw - 32px);
    padding: 9px 16px 9px 10px;
  }

  .pp-ai-chat__button-icon {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .pp-ai-chat__button-text {
    font-size: 14px;
  }

  .pp-ai-chat__popup {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(146px + env(safe-area-inset-bottom));
    width: auto;
    height: min(560px, calc(100dvh - 166px - env(safe-area-inset-bottom)));
    max-width: none;
    max-height: none;
    border-radius: 16px;
  }

  .pp-ai-chat__header {
    min-height: 82px;
    padding: 15px 15px 13px;
  }


  .pp-ai-chat__heading strong {
    font-size: 15px;
  }

  .pp-ai-chat__heading p {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .pp-ai-chat__button-text {
    max-width: 190px;
  }

  .pp-ai-chat__popup {
    left: 8px;
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-ai-chat__button,
  .pp-ai-chat__popup {
    transition: none;
  }
}
