/* Cibomio site assistant popup — Text-First shell */

.km-asst-root {
  --km-asst-green: var(--km-primary, #388e3c);
  --km-asst-green-dark: #2e7d32;
  font-family: var(--km-font-body, inherit);
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) 14px max(12px, env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  visibility: hidden;
}

.km-asst-root.is-open {
  pointer-events: auto;
  visibility: visible;
}

.km-asst-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(20, 32, 22, 0.48);
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
}

.km-asst-root.is-open .km-asst-overlay {
  opacity: 1;
}

.km-asst-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(640px, 88vh);
  max-height: min(640px, 88dvh);
  height: min(560px, 88vh);
  height: min(560px, 88dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(26, 46, 28, 0.28);
  transform: scale(0.96) translateY(12px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.km-asst-root.is-open .km-asst-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.km-asst-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 48px 14px 18px;
  background:
    linear-gradient(135deg, var(--km-asst-green) 0%, var(--km-asst-green-dark) 100%);
  color: #fff;
}

.km-asst-head__badge {
  margin: 0 0 6px;
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
}

.km-asst-head__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.km-asst-head__sub {
  margin: 5px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.92;
}

.km-asst-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.km-asst-close:hover,
.km-asst-close:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: none;
}

.km-asst-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(ellipse 70% 40% at 8% 0%, rgba(56, 142, 60, 0.06), transparent 55%),
    #f7faf7;
}

.km-asst-msg {
  max-width: 92%;
  padding: 11px 13px;
  border-radius: 16px;
  box-sizing: border-box;
}

.km-asst-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1.5px solid rgba(56, 142, 60, 0.22);
  border-bottom-left-radius: 5px;
}

.km-asst-msg--user {
  align-self: flex-end;
  background: rgba(56, 142, 60, 0.12);
  border: 1.5px solid rgba(56, 142, 60, 0.18);
  border-bottom-right-radius: 5px;
}

.km-asst-msg__label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--km-asst-green);
}

.km-asst-msg--user .km-asst-msg__label {
  color: #555;
  text-align: right;
}

.km-asst-msg__text {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: #2a2a2a;
  word-break: break-word;
}

.km-asst-foot {
  flex-shrink: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid #e8eee8;
  background: #fff;
}

.km-asst-composer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.km-asst-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #d5e2d6;
  border-radius: 999px;
  background: #fff;
  padding: 3px 3px 3px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.km-asst-field:focus-within {
  border-color: var(--km-asst-green);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.16);
}

.km-asst-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  padding: 8px 0;
}

.km-asst-input::placeholder {
  color: #9aaa9b;
  font-weight: 600;
}

.km-asst-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--km-asst-green);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.km-asst-send:hover,
.km-asst-send:focus-visible {
  background: var(--km-asst-green-dark);
  outline: none;
}

.km-asst-send__icon {
  display: block;
  width: 16px;
  height: 16px;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='M13 6l6 6-6 6'/%3E%3C/svg%3E");
}

.km-asst-mic {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1.5px solid #d5e2d6;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.km-asst-mic:hover,
.km-asst-mic:focus-visible {
  border-color: var(--km-asst-green);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.14);
  outline: none;
}

.km-asst-mic.is-listening {
  border-color: var(--km-asst-green);
  background: #f0f7f1;
  animation: kmAsstMicPulse 1.2s ease-in-out infinite;
}

.km-asst-mic__icon {
  display: block;
  width: 20px;
  height: 20px;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23388e3c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 11a7 7 0 0 1-14 0'/%3E%3Cpath d='M12 18v3'/%3E%3C/svg%3E");
}

@keyframes kmAsstMicPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(56, 142, 60, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(56, 142, 60, 0);
  }
}

.km-asst-hint {
  margin: 8px 2px 0;
  font-size: 11px;
  font-weight: 600;
  color: #8a968b;
  line-height: 1.35;
}

.km-asst-msg__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.km-asst-typing {
  opacity: 0.72;
  font-style: italic;
}

.km-asst-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.km-asst-chip {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #d5e2d6;
  background: #f7faf7;
  color: #1f3a22;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}

.km-asst-chip:hover,
.km-asst-chip:focus-visible {
  border-color: var(--km-asst-green);
  background: #eef6ef;
  outline: none;
}

.km-asst-products {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.km-asst-product {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f4f7f4;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
}

.km-asst-product:hover,
.km-asst-product:focus-visible {
  border-color: #cfe0d0;
  outline: none;
}

.km-asst-product__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.km-asst-product__price {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--km-asst-green-dark);
}

.km-asst-kit {
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef6ef;
  border: 1px solid #d5e8d7;
}

.km-asst-kit__title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: #1f3a22;
}

.km-asst-kit__roles {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.4;
  color: #3d5240;
}

.km-asst-kit__add {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--km-asst-green);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px;
  cursor: pointer;
}

.km-asst-kit__add:disabled {
  opacity: 0.7;
  cursor: default;
}

.km-asst-kit__status {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #2e7d32;
}

.km-asst-mic.is-processing {
  border-color: #b0c4b2;
  opacity: 0.85;
}

.km-asst-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header mic is a button now — keep look of former link */
button.km-voice-btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.km-burger-link--asst {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 480px) {
  .km-asst-dialog {
    width: 100%;
    height: min(92vh, 640px);
    height: min(92dvh, 640px);
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px;
  }

  .km-asst-head {
    padding-right: 46px;
  }

  .km-asst-head__sub {
    font-size: 11px;
  }
}

body.km-asst-open {
  overflow: hidden;
}
