
.code-chatbot,
.code-chatbot * {
  box-sizing: border-box;
}

.code-chatbot button,
.code-chatbot textarea,
.code-chatbot a {
  font: inherit;
  margin: 0;
  appearance: none;
}

.code-chatbot {
  --code-header-bg: #111111;
  --code-header-text: #ffffff;
  --code-primary: #111111;
  --code-panel-bg: #ffffff;
  --code-surface: #ffffff;
  --code-surface-soft: #f4f5f7;
  --code-border: rgba(17, 17, 17, 0.08);
  --code-text: #111111;
  --code-muted: #6b7280;
  --code-shadow: 0 24px 56px rgba(17, 17, 17, 0.16);
  --code-radius: 18px;
  --code-keyboard-offset: 0px;
  color: var(--code-text);
  font-family: inherit;
}

.code-chatbot.is-floating {
  position: fixed;
  z-index: 2147483647;
}

.code-chatbot.is-floating[data-vertical="bottom"] {
  transform: translateY(calc(-1 * var(--code-keyboard-offset)));
  transition: transform 0.2s ease;
}

.code-chatbot-bubble {
  min-width: max(var(--code-bubble-size, 52px), 122px);
  height: var(--code-bubble-size, 52px);
  padding: 0 16px 0 8px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: #111111;
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(17, 17, 17, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.code-chatbot-bubble:hover,
.code-chatbot.is-hover .code-chatbot-bubble {
  transform: translateY(-1px);
  box-shadow: 0 20px 52px rgba(17, 17, 17, 0.28), 0 0 0 4px rgba(17, 17, 17, 0.06);
}

.code-chatbot.is-open .code-chatbot-bubble {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.96);
}

.code-chatbot-bubble:focus-visible,
.code-chatbot-close:focus-visible,
.code-chatbot-send:focus-visible,
.code-chatbot-suggestion:focus-visible,
.code-chatbot-input:focus-visible,
.code-chatbot-action:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.24);
  outline-offset: 2px;
}

.code-chatbot-bubble-icon,
.code-chatbot-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.06);
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.code-chatbot-bubble-icon img,
.code-chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.code-chatbot-bubble-icon svg,
.code-chatbot-avatar svg {
  width: 58%;
  height: 58%;
}

.code-chatbot-bubble-label {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #ffffff;
}

.code-chatbot-teaser {
  position: absolute;
  right: 0;
  bottom: calc(var(--code-bubble-size, 52px) + 14px);
  max-width: 218px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow: 0 16px 38px rgba(17, 17, 17, 0.14);
  font-size: 13px;
  line-height: 1.35;
  color: #111111;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.code-chatbot-teaser.is-visible {
  opacity: 1;
  transform: translateY(0);
  animation: code-chatbot-teaser-float 2.2s ease-in-out infinite;
}

@keyframes code-chatbot-teaser-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

.code-chatbot-panel {
  width: min(var(--code-panel-width, 332px), calc(100vw - 12px));
  height: min(var(--code-panel-height, 470px), calc(100vh - 74px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--code-panel-bg);
  border-radius: var(--code-radius);
  border: 1px solid var(--code-border);
  box-shadow: var(--code-shadow);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.code-chatbot.is-floating .code-chatbot-panel {
  position: absolute;
}

.code-chatbot[data-vertical="bottom"] .code-chatbot-panel {
  bottom: calc(var(--code-bubble-size, 56px) + 12px);
}

.code-chatbot[data-vertical="top"] .code-chatbot-panel {
  top: calc(var(--code-bubble-size, 56px) + 12px);
}

.code-chatbot[data-side="left"] .code-chatbot-panel {
  left: 0;
}

.code-chatbot[data-side="right"] .code-chatbot-panel {
  right: 0;
}

.code-chatbot.is-open .code-chatbot-panel {
  animation: code-chatbot-panel-in 0.18s ease-out;
}

@keyframes code-chatbot-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.code-chatbot-header {
  min-height: 58px;
  padding: 8px 10px;
  background: var(--code-header-bg);
  color: var(--code-header-text);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-chatbot-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.code-chatbot-profile-copy {
  min-width: 0;
}

.code-chatbot-profile-copy strong {
  display: block;
  font-size: 14px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--code-header-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-chatbot-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.78);
}

.code-chatbot-status i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.code-chatbot-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.code-chatbot-body {
  min-height: 0;
  overflow: hidden;
  background: #f4f5f7;
}

.code-chatbot-messages {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 7px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 17, 0.18) transparent;
}

.code-chatbot-messages::-webkit-scrollbar {
  width: 7px;
}

.code-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(17, 17, 17, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.code-chatbot-row {
  display: flex;
  margin-bottom: 6px;
}

.code-chatbot-row:last-child {
  margin-bottom: 0;
}

.code-chatbot-row--user {
  justify-content: flex-end;
}

.code-chatbot-row--bot,
.code-chatbot-row--admin,
.code-chatbot-row--system {
  justify-content: flex-start;
}

.code-chatbot-message {
  max-width: 84%;
  padding: 6px 8px;
  border-radius: 14px;
  line-height: 1.42;
  font-size: 14px;
  font-weight: 400;
  box-shadow: 0 4px 10px rgba(17, 17, 17, 0.04);
  word-break: break-word;
}

.code-chatbot-message--user {
  background: #111111;
  color: #ffffff;
  border: 1px solid #111111;
  border-bottom-right-radius: 6px;
}

.code-chatbot-message--bot,
.code-chatbot-message--admin,
.code-chatbot-message--system {
  background: #ffffff;
  color: #111111;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-bottom-left-radius: 6px;
}

.code-chatbot-message__label {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--code-muted);
  text-transform: none;
}

.code-chatbot-message--user .code-chatbot-message__label {
  color: rgba(255, 255, 255, 0.72);
}

.code-chatbot-message__text p,
.code-chatbot-message__text ul {
  margin: 0;
}

.code-chatbot-message__text p + p,
.code-chatbot-message__text p + ul,
.code-chatbot-message__text ul + p,
.code-chatbot-message__text ul + ul {
  margin-top: 4px;
}

.code-chatbot-message__list {
  margin: 0;
  padding-left: 16px;
}

.code-chatbot-message__list li + li {
  margin-top: 4px;
}

.code-chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.code-chatbot-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: #ffffff;
  color: #111111;
  text-decoration: none;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.code-chatbot-action:hover {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.code-chatbot-message--typing .code-chatbot-message__text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.code-chatbot-typing-text {
  color: var(--code-muted);
}

.code-chatbot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.68);
  animation: code-chatbot-typing 1.1s infinite ease-in-out;
}

.code-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.code-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes code-chatbot-typing {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.code-chatbot-empty {
  display: grid;
  gap: 10px;
}

.code-chatbot-empty-card {
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.04);
}

.code-chatbot-empty-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #111111;
}

.code-chatbot-empty-card p {
  margin: 0;
  color: var(--code-muted);
  line-height: 1.5;
  font-size: 13px;
}

.code-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-chatbot-suggestion {
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: #ffffff;
  color: #111111;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.code-chatbot-footer {
  padding: 6px 7px;
  border-top: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.98);
}

.code-chatbot-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
}

.code-chatbot-input {
  min-height: 34px;
  max-height: 58px;
  width: 100%;
  resize: none;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background: #ffffff;
  color: #111111;
  border-radius: 13px;
  padding: 8px 10px;
  outline: none;
  line-height: 1.25;
  overflow-y: hidden;
  scrollbar-width: none;
}

.code-chatbot-input::placeholder {
  color: #9ca3af;
}

.code-chatbot-input::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.code-chatbot-send {
  min-width: 56px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  color: #ffffff;
  background: #111111;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.14);
}

.code-chatbot-send[disabled] {
  opacity: 0.74;
  cursor: not-allowed;
}

.code-chatbot.is-inline {
  width: 100%;
}

.code-chatbot.is-inline .code-chatbot-bubble,
.code-chatbot.is-inline .code-chatbot-teaser {
  display: none;
}

.code-chatbot.is-inline .code-chatbot-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .code-chatbot {
    --code-radius: 18px;
  }

  .code-chatbot-bubble {
    min-width: max(var(--code-bubble-size, 46px), 108px);
    padding-right: 14px;
  }

  .code-chatbot-panel {
    width: min(var(--code-panel-width-mobile, 94vw), calc(100vw - 10px));
    height: min(var(--code-panel-height-mobile, 70dvh), calc(100dvh - 12px));
    border-radius: 18px;
  }

  .code-chatbot-header {
    min-height: 54px;
    padding: 7px 8px;
  }

  .code-chatbot-messages {
    padding: 6px;
  }

  .code-chatbot-footer {
    padding: 6px;
  }

  .code-chatbot-message {
    max-width: 88%;
  }

  .code-chatbot-send {
    min-width: 54px;
  }

  .code-chatbot-teaser {
    max-width: min(210px, calc(100vw - 80px));
    font-size: 12px;
  }
}


.code-chatbot-bubble:hover,
.code-chatbot-bubble:focus,
.code-chatbot-bubble:active,
.code-chatbot-bubble:hover .code-chatbot-bubble-label,
.code-chatbot-bubble:focus .code-chatbot-bubble-label,
.code-chatbot-bubble:active .code-chatbot-bubble-label {
  background: #111111 !important;
  color: #ffffff !important;
}

.code-chatbot-send,
.code-chatbot-send:hover,
.code-chatbot-send:focus,
.code-chatbot-send:active {
  background: #111111 !important;
  color: #ffffff !important;
}

.code-chatbot-send span,
.code-chatbot-send:hover span,
.code-chatbot-send:focus span,
.code-chatbot-send:active span {
  color: #ffffff !important;
}

.code-chatbot-close:hover,
.code-chatbot-close:focus {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.code-chatbot-profile-copy strong,
.code-chatbot-message__label {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


.code-chatbot-header {
  min-height: 60px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(17,17,17,1) 0%, rgba(6,25,64,1) 100%);
}

.code-chatbot-profile {
  gap: 10px;
}

.code-chatbot-profile-copy strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.code-chatbot-status {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.86);
}

.code-chatbot-close {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

.code-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.code-chatbot-message__label {
  color: #4b5563;
  font-weight: 700;
}

.code-chatbot-message--bot .code-chatbot-message__label,
.code-chatbot-message--admin .code-chatbot-message__label {
  color: #374151;
}

.code-chatbot-composer {
  gap: 8px;
  padding: 8px 10px;
}

.code-chatbot-input {
  min-height: 44px;
  max-height: 108px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.35;
}

.code-chatbot-input::placeholder {
  font-size: 13px;
  color: #9ca3af;
}

.code-chatbot-send {
  min-width: 74px;
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}

.code-chatbot-actions {
  margin-top: 8px;
}

.code-chatbot-action {
  min-height: 36px;
  font-size: 12px;
  font-weight: 600;
}


/* Layout polish */
.code-chatbot-panel {
  border-radius: 24px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow: 0 28px 70px rgba(17, 17, 17, 0.18);
}

.code-chatbot-header {
  min-height: 64px;
  padding: 12px 14px;
  align-items: center;
}

.code-chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.code-chatbot-avatar img,
.code-chatbot-avatar svg,
.code-chatbot-bubble-icon img,
.code-chatbot-bubble-icon svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.code-chatbot-profile-copy {
  display: grid;
  gap: 4px;
}

.code-chatbot-profile-copy strong {
  font-size: 17px;
  line-height: 1.05;
}

.code-chatbot-status {
  margin-top: 0;
}

.code-chatbot-close {
  width: 34px;
  height: 34px;
  font-size: 18px;
}

.code-chatbot-body {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.92), rgba(244, 245, 247, 0.98) 55%, rgba(239, 241, 244, 1) 100%);
}

.code-chatbot-messages {
  padding: 12px;
}

.code-chatbot-row {
  margin-bottom: 10px;
}

.code-chatbot-message {
  max-width: min(84%, 280px);
  padding: 10px 12px;
  border-radius: 18px;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.05);
}

.code-chatbot-message--user {
  border-bottom-right-radius: 8px;
}

.code-chatbot-message--bot,
.code-chatbot-message--admin,
.code-chatbot-message--system {
  border-bottom-left-radius: 8px;
}

.code-chatbot-message__label {
  margin-bottom: 5px;
  font-size: 11px;
}

.code-chatbot-footer {
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.98);
}

.code-chatbot-composer {
  padding: 0;
  gap: 10px;
  align-items: center;
}

.code-chatbot-input {
  min-height: 48px;
  max-height: 112px;
  border-radius: 16px;
  padding: 13px 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.code-chatbot-input:focus {
  border-color: rgba(17, 17, 17, 0.18);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.05);
}

.code-chatbot-send {
  min-width: 82px;
  height: 48px;
  border-radius: 16px;
  box-shadow: 0 14px 28px rgba(17, 17, 17, 0.16);
}

.code-chatbot-send:hover,
.code-chatbot-send:focus {
  transform: translateY(-1px);
}

@media (max-width: 767px) {
  .code-chatbot-panel {
    border-radius: 22px;
  }

  .code-chatbot-header {
    min-height: 60px;
    padding: 10px 12px;
  }

  .code-chatbot-avatar {
    width: 38px;
    height: 38px;
  }

  .code-chatbot-messages {
    padding: 10px;
  }

  .code-chatbot-message {
    max-width: 86%;
    padding: 9px 11px;
  }

  .code-chatbot-footer {
    padding: 8px 10px 10px;
  }

  .code-chatbot-input {
    min-height: 46px;
    padding: 12px 14px;
  }

  .code-chatbot-send {
    min-width: 76px;
    height: 46px;
  }
}

/* Code AI Chatbot 1.1 UI refinements */
.code-chatbot-header {
  min-height: 62px;
  padding: 10px 12px;
  background: var(--code-header-bg, #111111) !important;
  color: var(--code-header-text, #ffffff) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-chatbot-profile {
  gap: 10px;
}

.code-chatbot-profile-copy strong {
  font-size: 15px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  color: var(--code-header-text, #ffffff) !important;
}

.code-chatbot-status {
  margin-top: 2px;
  font-size: 11px !important;
  line-height: 1.25 !important;
  font-weight: 500;
  color: var(--code-header-text, #ffffff) !important;
  opacity: 0.78;
}

.code-chatbot-status i {
  width: 7px;
  height: 7px;
}

.code-chatbot-close {
  color: var(--code-header-text, #ffffff) !important;
}

.code-chatbot-footer {
  padding-top: 8px;
}

.code-chatbot-footer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 8px;
}

.code-chatbot-footer-tools button {
  border: 0;
  padding: 4px 2px;
  background: transparent;
  color: #5f6673;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

.code-chatbot-footer-tools button:hover {
  color: var(--code-primary, #111111);
  text-decoration: underline;
}

.code-chatbot-language-card {
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(17, 17, 17, 0.08);
  text-align: center;
}

.code-chatbot-language-card > strong {
  display: block;
  margin-bottom: 12px;
  color: #111111;
  font-size: 15px;
  line-height: 1.3;
}

.code-chatbot-language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.code-chatbot-language-option {
  min-height: 42px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 12px;
  padding: 9px 10px;
  background: #f7f7f8;
  color: #111111;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 650;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.code-chatbot-language-option:hover,
.code-chatbot-language-option:focus-visible {
  border-color: var(--code-primary, #111111);
  background: #ffffff;
  transform: translateY(-1px);
}

.code-chatbot-action {
  word-break: break-word;
}

@media (max-width: 420px) {
  .code-chatbot-header {
    min-height: 58px;
    padding: 9px 10px;
  }

  .code-chatbot-profile-copy strong {
    font-size: 14px !important;
  }

  .code-chatbot-language-grid {
    grid-template-columns: 1fr;
  }
}
