.owa-chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #e30613;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 18px 40px rgba(227, 6, 19, 0.34);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  isolation: isolate;
}

.owa-chat-fab svg {
  width: 44px;
  height: 44px;
  display: block;
  overflow: visible;
}

.owa-chat-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 22px 48px rgba(227, 6, 19, 0.44);
}

.owa-chat-fab__pulse {
  fill: rgba(255, 255, 255, 0.12);
  transform-origin: center;
  animation: owaChatFabPulse 2.8s ease-in-out infinite;
}

.owa-chat-fab__bot {
  animation: owaChatFabFloat 3.1s ease-in-out infinite;
}

.owa-chat-fab__head {
  fill: #fff;
}

.owa-chat-fab__eye,
.owa-chat-fab__antenna-dot {
  fill: #ff584c;
}

.owa-chat-fab__mouth,
.owa-chat-fab__antenna,
.owa-chat-fab__arm {
  fill: none;
  stroke: #ff584c;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.owa-chat-fab__eye {
  transform-origin: center;
  animation: owaChatFabBlink 4.6s ease-in-out infinite;
}

@keyframes owaChatFabPulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.45;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.18;
  }
}

@keyframes owaChatFabFloat {
  0%,
  100% {
    transform: translateY(0);
  }

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

@keyframes owaChatFabBlink {
  0%,
  44%,
  48%,
  100% {
    transform: scaleY(1);
  }

  46% {
    transform: scaleY(0.2);
  }
}

.owa-chat-panel {
  --owa-chat-safe-top: calc(70px + env(safe-area-inset-top) + 16px);
  --owa-chat-safe-bottom: calc(92px + env(safe-area-inset-bottom));
  position: fixed;
  right: 22px;
  bottom: var(--owa-chat-safe-bottom);
  width: 380px;
  max-width: calc(100vw - 28px);
  height: min(620px, calc(100dvh - var(--owa-chat-safe-top) - var(--owa-chat-safe-bottom)));
  max-height: calc(100dvh - var(--owa-chat-safe-top) - var(--owa-chat-safe-bottom));
  min-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
  z-index: 999;
}

.owa-chat-panel[hidden],
.owa-chat-menu[hidden] {
  display: none !important;
}

.owa-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
}

.owa-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.owa-chat-title__logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 999px;
  background: url("/static/img/logo.png") center/contain no-repeat;
}

.owa-chat-header strong {
  display: block;
  color: #111827;
  font-size: 16px;
  line-height: 1.2;
}

.owa-chat-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.35;
}

.owa-chat-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.owa-chat-header button {
  border: 0;
  background: transparent;
  color: #111827;
  cursor: pointer;
}

.owa-chat-actions > button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 22px;
  transition: background 0.2s ease, color 0.2s ease;
}

.owa-chat-actions > button:hover {
  background: #f3f4f6;
  color: #ef4444;
}

.owa-chat-actions i {
  font-size: 18px;
  line-height: 1;
}

.owa-chat-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 34px;
  min-width: 150px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  z-index: 2;
}

.owa-chat-menu button {
  width: 100%;
  height: auto;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #374151;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.owa-chat-menu button:hover {
  background: #f3f4f6;
}

.owa-chat-menu button + button {
  margin-top: 2px;
}

.owa-chat-menu button:last-child {
  color: #dc2626;
}

.owa-chat-menu button:last-child:hover {
  background: #fef2f2;
}

.owa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}

.owa-chat-msg {
  display: flex;
  margin-bottom: 12px;
  animation: owaChatMsgIn 0.3s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes owaChatMsgIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.owa-chat-msg--user {
  justify-content: flex-end;
}

.owa-chat-bubble {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.owa-chat-msg--bot .owa-chat-bubble {
  color: #111827;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 6px;
}

.owa-chat-msg--user .owa-chat-bubble {
  color: #fff;
  background: linear-gradient(135deg, #e30613, #ff4f4b);
  border-bottom-right-radius: 6px;
}

.owa-chat-typing {
  display: flex;
  gap: 4px;
  padding: 11px 16px;
  align-items: center;
  min-height: 38px;
}

.owa-chat-typing__label {
  margin-left: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.owa-chat-typing span {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  display: inline-block;
  animation: owaChatTypingDot 1.4s infinite ease-in-out both;
}

.owa-chat-typing span:nth-child(1) {
  animation-delay: -0.32s;
}

.owa-chat-typing span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes owaChatTypingDot {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.owa-chat-msg--quick-actions {
  margin-top: -2px;
}

.owa-chat-quick-actions {
  width: min(310px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.owa-chat-quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.owa-chat-quick-action:hover {
  border-color: #ef4444;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.owa-chat-quick-action i {
  color: #ef4444;
  font-size: 15px;
}

.owa-chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.owa-chat-input textarea {
  min-height: 56px;
  max-height: 120px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font: inherit;
  outline: none;
}

.owa-chat-input textarea:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.owa-chat-input textarea::placeholder {
  color: #9ca3af;
}

.owa-chat-input button {
  align-self: end;
  min-width: 92px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #e30613, #ff4f4b);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 640px) {
  .owa-chat-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
  }

  .owa-chat-panel {
    --owa-chat-safe-top: calc(70px + env(safe-area-inset-top) + 10px);
    --owa-chat-safe-bottom: calc(74px + env(safe-area-inset-bottom));
    right: 10px;
    left: 10px;
    top: var(--owa-chat-safe-top);
    bottom: var(--owa-chat-safe-bottom);
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    min-height: 0;
    border-radius: 18px;
  }

  .owa-chat-header {
    padding: 14px 14px 12px;
  }

  .owa-chat-input {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .owa-chat-input textarea {
    min-height: 48px;
    max-height: 96px;
  }

  .owa-chat-input button {
    width: 100%;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .owa-chat-fab,
  .owa-chat-fab__pulse,
  .owa-chat-fab__bot,
  .owa-chat-fab__eye,
  .owa-chat-msg,
  .owa-chat-typing span {
    animation: none;
    transition: none;
    transform: none;
  }
}

@media (max-height: 760px) and (min-width: 641px) {
  .owa-chat-panel {
    --owa-chat-safe-top: calc(70px + env(safe-area-inset-top) + 12px);
    --owa-chat-safe-bottom: calc(76px + env(safe-area-inset-bottom));
    top: var(--owa-chat-safe-top);
    bottom: var(--owa-chat-safe-bottom);
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .owa-chat-panel {
    --owa-chat-safe-top: calc(70px + env(safe-area-inset-top) + 8px);
    --owa-chat-safe-bottom: calc(12px + env(safe-area-inset-bottom));
    top: var(--owa-chat-safe-top);
    bottom: var(--owa-chat-safe-bottom);
    right: 12px;
    width: min(420px, calc(100vw - 24px));
    height: auto;
    max-height: none;
    min-height: 0;
    border-radius: 18px;
  }
}

@media (max-width: 420px) {
  .owa-chat-panel {
    right: 8px;
    left: 8px;
    border-radius: 16px;
  }

  .owa-chat-header strong {
    font-size: 14px;
  }

  .owa-chat-header p {
    font-size: 11px;
  }

  .owa-chat-messages {
    padding: 12px;
  }
}

