.sawti-wa {
  --sawti-wa-green: #5dd3b0;
  --sawti-wa-ink: #071d17;
  position: fixed;
  z-index: 2147482990;
  left: max(16px, env(safe-area-inset-left));
  right: auto;
  bottom: max(16px, env(safe-area-inset-bottom));
  direction: rtl;
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  transition: bottom .2s ease;
}

body.sawti-unified-player-open .sawti-wa { bottom: 112px; }

.sawti-wa__toggle,
.sawti-wa__close,
.sawti-wa__submit {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.sawti-wa__toggle {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-inline-end: auto;
  color: var(--sawti-wa-ink);
  background: var(--sawti-wa-green);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .32);
  animation: sawti-wa-breathe 3.4s ease-in-out infinite;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.sawti-wa__toggle:hover {
  color: var(--sawti-wa-ink);
  background: #e8c07e;
  border-color: rgba(232, 192, 126, .7);
}

.sawti-wa__toggle:hover,
.sawti-wa__toggle:focus-visible,
.sawti-wa.is-open .sawti-wa__toggle {
  animation-play-state: paused;
}

.sawti-wa__toggle svg { width: 29px; height: 29px; fill: currentColor; }

.sawti-wa__panel {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 68px;
  width: min(360px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  color: #edf5f2;
  background:
    radial-gradient(circle at 18% 42%, rgba(93, 211, 176, .045) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 72%, rgba(232, 192, 126, .04) 0 2px, transparent 3px),
    rgba(6, 24, 19, .99);
  background-size: 34px 34px, 42px 42px, auto;
  border: 1px solid rgba(93, 211, 176, .38);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .52);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px) scale(.95);
  transform-origin: bottom left;
  transition: opacity .2s ease, transform .24s ease, visibility .24s;
}

.sawti-wa.is-open .sawti-wa__panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  animation: sawti-wa-panel-in .38s cubic-bezier(.2, .9, .25, 1.18) both;
}

.sawti-wa__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  background: linear-gradient(135deg, #123f34, #0d3028);
  border-bottom: 1px solid rgba(93, 211, 176, .18);
}
.sawti-wa__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sawti-wa__identity > div { display: grid; gap: 1px; }
.sawti-wa__identity strong { color: #fff; font-size: 14px; }
.sawti-wa__avatar,
.sawti-wa__mini-avatar {
  display: grid;
  place-items: center;
  color: var(--sawti-wa-ink);
  background: var(--sawti-wa-green);
  border-radius: 50%;
  font-weight: 900;
}
.sawti-wa__avatar { width: 38px; height: 38px; font-size: 16px; }
.sawti-wa__presence { color: #a9c7bd; font-size: 10.5px; }
.sawti-wa__presence i { display: inline-block; width: 7px; height: 7px; margin-inline-end: 3px; background: #69d8b6; border-radius: 50%; box-shadow: 0 0 0 3px rgba(105, 216, 182, .1); }

.sawti-wa__close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #d7e5e0;
  background: rgba(0, 0, 0, .16);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.sawti-wa__conversation { padding: 16px 16px 8px; }
.sawti-wa__bot-row { display: flex; align-items: flex-end; gap: 7px; animation: sawti-wa-message-in .4s .1s both; }
.sawti-wa__mini-avatar { width: 25px; height: 25px; flex: 0 0 25px; font-size: 10px; }
.sawti-wa__bubble {
  position: relative;
  max-width: calc(100% - 35px);
  padding: 11px 13px;
  background: #163b31;
  border: 1px solid rgba(93, 211, 176, .18);
  border-radius: 16px 16px 5px 16px;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .15);
}
.sawti-wa__title { margin: 0; color: #fff; font-size: 15px; line-height: 1.5; }
.sawti-wa__helper { margin: 4px 0 0; color: #b7cec6; font-size: 11.5px; line-height: 1.65; }

.sawti-wa__form { padding: 5px 16px 16px; }
.sawti-wa__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sawti-wa__name-composer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px 35px;
  padding: 3px 11px;
  background: #0e2e26;
  border: 1px solid #2a5548;
  border-radius: 16px 16px 16px 5px;
  animation: sawti-wa-message-in .4s .18s both;
}
.sawti-wa__name,
.sawti-wa__message {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  color: #f7fbf9;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  font: 500 14px/1.65 inherit;
}

.sawti-wa__name { min-width: 0; min-height: 38px; padding-inline: 3px; }
.sawti-wa__message-composer { background: #0d2b23; border: 1px solid #2a5548; border-radius: 17px; animation: sawti-wa-message-in .4s .26s both; }
.sawti-wa__message { min-height: 78px; max-height: 150px; resize: vertical; }
.sawti-wa__name::placeholder,
.sawti-wa__message::placeholder { color: #829b92; }
.sawti-wa__name:focus,
.sawti-wa__message:focus { box-shadow: none; }
.sawti-wa__name-composer:focus-within,
.sawti-wa__message-composer:focus-within { border-color: #5dd3b0; box-shadow: 0 0 0 3px rgba(93, 211, 176, .14); }
.sawti-wa__meta { display: flex; justify-content: space-between; gap: 8px; min-height: 20px; margin-top: 5px; color: #91aaa1; font-size: 11px; }
.sawti-wa__error { color: #ffaaa3; }

.sawti-wa__submit {
  width: 100%;
  min-height: 46px;
  margin-top: 9px;
  padding: 10px 16px;
  color: var(--sawti-wa-ink);
  background: #e8c07e;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(232, 192, 126, .14);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  animation: sawti-wa-message-in .4s .32s both;
}
.sawti-wa__submit:hover { background: #f0cb8d; }
.sawti-wa__submit:disabled { cursor: wait; opacity: .72; }

.sawti-wa button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

@keyframes sawti-wa-breathe {
  0%, 100% { box-shadow: 0 12px 34px rgba(0, 0, 0, .32); }
  50% { box-shadow: 0 12px 42px rgba(93, 211, 176, .24); }
}

@keyframes sawti-wa-panel-in {
  0% { opacity: 0; transform: translateY(20px) scale(.93); }
  68% { opacity: 1; transform: translateY(-3px) scale(1.012); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sawti-wa-message-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 680px) {
  .sawti-wa { left: max(10px, env(safe-area-inset-left)); right: auto; bottom: max(10px, env(safe-area-inset-bottom)); }
  body.sawti-unified-player-open .sawti-wa { bottom: 130px; }
  .sawti-wa__toggle { width: 52px; height: 52px; }
  .sawti-wa__panel { bottom: 62px; width: min(346px, calc(100vw - 20px)); max-height: calc(100vh - 92px); overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sawti-wa,
  .sawti-wa__panel { transition: none; }
  .sawti-wa__toggle { animation: none; }
  .sawti-wa.is-open .sawti-wa__panel { animation: none; }
  .sawti-wa__bot-row,
  .sawti-wa__name-composer,
  .sawti-wa__message-composer,
  .sawti-wa__submit { animation: none; }
}

@media print { .sawti-wa { display: none !important; } }
