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

.aw-chatbot-root {
  --aw-chatbot-red: #ff2a2a;
  --aw-chatbot-red-deep: #a80000;
  --aw-chatbot-ink: #09090c;
  --aw-chatbot-paper: #fffdfc;
  --aw-chatbot-muted: rgba(15, 15, 19, 0.62);
  --aw-chatbot-border: rgba(255, 255, 255, 0.12);
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 60;
  font-family: Inter, Tajawal, "Noto Sans Devanagari", system-ui, sans-serif;
}

.aw-chatbot-launcher {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.24), transparent 35%),
    linear-gradient(135deg, var(--aw-chatbot-red), var(--aw-chatbot-red-deep));
  color: #fff;
  display: inline-grid;
  place-items: center;
  box-shadow:
    0 22px 44px rgba(168, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.aw-chatbot-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 28px 52px rgba(168, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.aw-chatbot-launcher svg {
  width: 28px;
  height: 28px;
}

.aw-chatbot-panel {
  position: absolute;
  left: 0;
  bottom: 86px;
  width: min(420px, calc(100vw - 30px));
  height: min(680px, calc(100vh - 130px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 42, 42, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 250, 250, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow:
    0 34px 90px rgba(9, 9, 12, 0.22),
    0 10px 24px rgba(168, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transform-origin: left bottom;
  transition: opacity 220ms ease, transform 220ms ease;
  backdrop-filter: blur(18px);
}

.aw-chatbot-root.is-open .aw-chatbot-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.aw-chatbot-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 18px;
  background:
    linear-gradient(135deg, rgba(12, 12, 16, 0.98), rgba(26, 8, 8, 0.98));
  color: #fff;
}

.aw-chatbot-header::after {
  content: "";
  position: absolute;
  inset: auto 20px 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 42, 42, 0.5), rgba(255, 255, 255, 0.08));
}

.aw-chatbot-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.aw-chatbot-badge {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.aw-chatbot-badge img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.aw-chatbot-titles {
  min-width: 0;
}

.aw-chatbot-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.aw-chatbot-subtitle {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.83rem;
}

.aw-chatbot-header-actions {
  display: flex;
  gap: 8px;
}

.aw-chatbot-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.aw-chatbot-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.aw-chatbot-icon-btn svg {
  width: 18px;
  height: 18px;
}

.aw-chatbot-body {
  padding: 18px 18px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aw-chatbot-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

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

.aw-chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #111217, #1b0d0d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.aw-chatbot-avatar img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.aw-chatbot-bubble {
  max-width: min(82%, 300px);
  border-radius: 22px;
  padding: 14px 16px;
  line-height: 1.65;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.aw-chatbot-text {
  display: block;
  width: 100%;
}

.aw-chatbot-row.is-bot .aw-chatbot-bubble {
  color: #101116;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 243, 243, 0.98));
  border: 1px solid rgba(15, 15, 19, 0.06);
  box-shadow: 0 14px 34px rgba(15, 15, 19, 0.08);
  border-bottom-left-radius: 8px;
}

.aw-chatbot-row.is-user .aw-chatbot-bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--aw-chatbot-red), var(--aw-chatbot-red-deep));
  box-shadow: 0 18px 36px rgba(168, 0, 0, 0.22);
  border-bottom-right-radius: 8px;
}

.aw-chatbot-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.aw-chatbot-chip,
.aw-chatbot-link {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 15, 19, 0.08);
  background: rgba(255, 255, 255, 0.78);
  color: #111217;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.aw-chatbot-chip:hover,
.aw-chatbot-link:hover {
  background: rgba(255, 239, 239, 0.96);
  transform: translateY(-1px);
}

.aw-chatbot-related {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aw-chatbot-composer {
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.96));
  border-top: 1px solid rgba(15, 15, 19, 0.06);
}

.aw-chatbot-form {
  display: grid;
  gap: 10px;
}

.aw-chatbot-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(15, 15, 19, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.aw-chatbot-input {
  min-height: 52px;
  max-height: 160px;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: #101116;
  font: inherit;
  padding: 6px 8px;
  line-height: 1.5;
}

.aw-chatbot-send {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--aw-chatbot-red), var(--aw-chatbot-red-deep));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 18px 28px rgba(168, 0, 0, 0.22);
}

.aw-chatbot-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.aw-chatbot-send svg {
  width: 20px;
  height: 20px;
}

.aw-chatbot-typing {
  display: inline-flex;
  gap: 5px;
  padding: 6px 0 2px;
}

.aw-chatbot-typing span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 42, 42, 0.5);
  animation: aw-chatbot-dot 1.2s infinite ease-in-out;
}

.aw-chatbot-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.aw-chatbot-typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes aw-chatbot-dot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.42;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

body[data-lang="ar"] .aw-chatbot-root,
html[lang="ar"] .aw-chatbot-root {
  direction: rtl;
}

body[data-lang="ar"] .aw-chatbot-row.is-user,
html[lang="ar"] .aw-chatbot-row.is-user {
  justify-content: flex-start;
}

body[data-lang="ar"] .aw-chatbot-row.is-bot,
html[lang="ar"] .aw-chatbot-row.is-bot {
  flex-direction: row-reverse;
}

body[data-lang="ar"] .aw-chatbot-bubble,
html[lang="ar"] .aw-chatbot-bubble {
  text-align: right;
}

@media (max-width: 720px) {
  .aw-chatbot-root {
    left: 16px;
    bottom: 16px;
  }

  .aw-chatbot-launcher {
    width: 62px;
    height: 62px;
    border-radius: 20px;
  }

  .aw-chatbot-panel {
    position: fixed;
    inset: auto 0 0 0;
    width: 100vw;
    height: min(88svh, 720px);
    border-radius: 24px 24px 0 0;
    transform-origin: center bottom;
    bottom: 0;
    left: 0;
  }

  .aw-chatbot-root.is-open .aw-chatbot-launcher {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
  }

  .aw-chatbot-bubble {
    max-width: 88%;
  }
}
