:root {
  --ic-chatbot-primary: #b3261e;
  --ic-chatbot-primary-dark: #8d1d18;
  --ic-chatbot-ink: #1f2933;
  --ic-chatbot-muted: #6b7280;
  --ic-chatbot-surface: #ffffff;
  --ic-chatbot-surface-soft: #f6f7f9;
  --ic-chatbot-border: rgba(17, 24, 39, 0.1);
  --ic-chatbot-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  --ic-chatbot-radius: 20px;
}

html.ic-chatbot-hide-legacy .faq-assistant,
html.ic-chatbot-hide-legacy .floating-wa,
html.ic-chatbot-hide-legacy .whatsapp-float {
  display: none !important;
}

html.ic-chatbot-open,
body.ic-chatbot-open {
  overflow: hidden;
}

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

.ic-chatbot-shell {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  font-family: "Barlow", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: calc(100vw - 2rem);
}

.ic-chatbot-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ic-chatbot-primary) 0%, #d43d32 100%);
  color: #fff;
  padding: 0.95rem 1.15rem;
  min-height: 58px;
  box-shadow: var(--ic-chatbot-shadow);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.ic-chatbot-toggle:hover,
.ic-chatbot-toggle:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.22);
  outline: none;
}

.ic-chatbot-toggle__dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
}

.ic-chatbot-panel {
  width: min(390px, calc(100vw - 1rem));
  height: min(640px, calc(100vh - 1.5rem));
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  border-radius: var(--ic-chatbot-radius);
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #fbfbfc 100%);
  border: 1px solid var(--ic-chatbot-border);
  box-shadow: var(--ic-chatbot-shadow);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.ic-chatbot-panel[hidden] {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  visibility: hidden;
  pointer-events: none;
}

.ic-chatbot-header {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(135deg, var(--ic-chatbot-primary-dark) 0%, var(--ic-chatbot-primary) 100%);
  color: #fff;
  padding: 1rem 1rem 0.95rem;
}

.ic-chatbot-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.ic-chatbot-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.ic-chatbot-header__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  opacity: 0.88;
}

.ic-chatbot-header__actions {
  display: flex;
  gap: 0.45rem;
}

.ic-chatbot-header__button {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.18s ease;
}

.ic-chatbot-header__button:hover,
.ic-chatbot-header__button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.ic-chatbot-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.ic-chatbot-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1rem 0.75rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(246, 247, 249, 0.72), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(179, 38, 30, 0.04), transparent 32%);
}

.ic-chatbot-messages::-webkit-scrollbar {
  width: 8px;
}

.ic-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.28);
  border-radius: 999px;
}

.ic-chatbot-message {
  max-width: 88%;
  margin-bottom: 0.8rem;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  line-height: 1.45;
  font-size: 0.92rem;
  white-space: pre-line;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.ic-chatbot-message--bot {
  background: #fff;
  color: var(--ic-chatbot-ink);
  border-bottom-left-radius: 6px;
}

.ic-chatbot-message--user {
  margin-left: auto;
  background: #f6d9d5;
  color: #6f1914;
  border-bottom-right-radius: 6px;
}

.ic-chatbot-message h4,
.ic-chatbot-message p {
  margin: 0;
}

.ic-chatbot-message p + p,
.ic-chatbot-message ul,
.ic-chatbot-message .ic-chatbot-inline-list {
  margin-top: 0.55rem;
}

.ic-chatbot-inline-list {
  display: grid;
  gap: 0.35rem;
}

.ic-chatbot-controls {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-top: 1px solid var(--ic-chatbot-border);
  background: var(--ic-chatbot-surface);
  padding: 0.95rem;
}

.ic-chatbot-controls > * + * {
  margin-top: 0.8rem;
}

.ic-chatbot-grid {
  display: grid;
  gap: 0.65rem;
}

.ic-chatbot-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ic-chatbot-option,
.ic-chatbot-secondary,
.ic-chatbot-link {
  width: 100%;
  border: 1px solid var(--ic-chatbot-border);
  border-radius: 14px;
  background: var(--ic-chatbot-surface-soft);
  color: var(--ic-chatbot-ink);
  cursor: pointer;
  padding: 0.82rem 0.9rem;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.ic-chatbot-option:hover,
.ic-chatbot-option:focus-visible,
.ic-chatbot-secondary:hover,
.ic-chatbot-secondary:focus-visible,
.ic-chatbot-link:hover,
.ic-chatbot-link:focus-visible {
  border-color: rgba(179, 38, 30, 0.28);
  background: #fff;
  transform: translateY(-1px);
  outline: none;
}

.ic-chatbot-option--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--ic-chatbot-primary) 0%, #cf3a2f 100%);
  color: #fff;
}

.ic-chatbot-option--primary:hover,
.ic-chatbot-option--primary:focus-visible {
  background: linear-gradient(135deg, var(--ic-chatbot-primary-dark) 0%, var(--ic-chatbot-primary) 100%);
}

.ic-chatbot-card {
  border: 1px solid var(--ic-chatbot-border);
  border-radius: 16px;
  background: #fff;
  padding: 0.95rem;
}

.ic-chatbot-card__title {
  margin: 0 0 0.3rem;
  color: var(--ic-chatbot-ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.ic-chatbot-card__text,
.ic-chatbot-card__meta {
  margin: 0;
  color: var(--ic-chatbot-muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

.ic-chatbot-card__meta {
  margin-top: 0.45rem;
  color: #475569;
}

.ic-chatbot-card__button {
  margin-top: 0.7rem;
}

.ic-chatbot-form {
  display: grid;
  gap: 0.7rem;
}

.ic-chatbot-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.1rem;
}

.ic-chatbot-step__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ic-chatbot-ink);
}

.ic-chatbot-step__meta {
  color: var(--ic-chatbot-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.ic-chatbot-field-group {
  display: grid;
  gap: 0.45rem;
}

.ic-chatbot-field-row {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ic-chatbot-label {
  color: #334155;
  font-size: 0.83rem;
  font-weight: 700;
}

.ic-chatbot-input,
.ic-chatbot-textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem 0.8rem;
  font: inherit;
  color: var(--ic-chatbot-ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ic-chatbot-input:focus,
.ic-chatbot-textarea:focus {
  border-color: rgba(179, 38, 30, 0.45);
  box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.08);
  outline: none;
}

.ic-chatbot-textarea {
  min-height: 88px;
  resize: vertical;
}

.ic-chatbot-help {
  margin: 0;
  color: var(--ic-chatbot-muted);
  font-size: 0.79rem;
  line-height: 1.4;
}

.ic-chatbot-actions {
  display: grid;
  gap: 0.6rem;
}

.ic-chatbot-actions--inline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ic-chatbot-note {
  border-top: 1px solid var(--ic-chatbot-border);
  padding: 0.75rem 0.95rem 0.9rem;
  color: var(--ic-chatbot-muted);
  font-size: 0.76rem;
  line-height: 1.45;
  background: #fff;
}

.ic-chatbot-list {
  display: grid;
  gap: 0.45rem;
}

.ic-chatbot-list__item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ic-chatbot-ink);
  font-size: 0.87rem;
}

.ic-chatbot-list__item strong {
  color: var(--ic-chatbot-muted);
  font-weight: 700;
}

.ic-chatbot-summary {
  display: grid;
  gap: 0.5rem;
}

.ic-chatbot-summary__line {
  display: flex;
  gap: 0.55rem;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--ic-chatbot-ink);
}

.ic-chatbot-summary__line strong {
  color: #475569;
  font-weight: 700;
}

@media (max-width: 575.98px) {
  .ic-chatbot-shell {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    max-width: none;
  }

  .ic-chatbot-toggle {
    margin-left: auto;
    min-height: 56px;
    padding: 0.9rem 1rem;
  }

  .ic-chatbot-panel {
    position: fixed;
    inset:
      max(0.5rem, env(safe-area-inset-top))
      0.5rem
      calc(4.9rem + env(safe-area-inset-bottom))
      0.5rem;
    width: auto;
    height: auto;
    max-height: none;
    margin-top: 0;
    border-radius: 24px;
  }

  .ic-chatbot-header {
    padding: 0.95rem 0.95rem 0.85rem;
  }

  .ic-chatbot-header__top {
    align-items: center;
  }

  .ic-chatbot-header__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .ic-chatbot-messages {
    padding: 0.9rem 0.9rem 0.7rem;
  }

  .ic-chatbot-message {
    max-width: 94%;
  }

  .ic-chatbot-controls {
    padding: 0.85rem;
    max-height: min(48vh, 420px);
  }

  .ic-chatbot-note {
    padding:
      0.7rem
      0.85rem
      calc(0.85rem + env(safe-area-inset-bottom));
  }

  .ic-chatbot-grid--two,
  .ic-chatbot-actions--inline,
  .ic-chatbot-field-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ic-chatbot-panel,
  .ic-chatbot-toggle,
  .ic-chatbot-option,
  .ic-chatbot-secondary,
  .ic-chatbot-link {
    transition: none;
  }
}
