/* Live Agent FAB — circular video + spark ring + pulse + Talk to agent */
.laf {
  --laf-size: 88px;
  --laf-gold: #c9a35a;
  --laf-gold-hi: #e8c97a;
  --laf-navy: #0b1f3a;
  position: fixed;
  z-index: 60;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.laf > * {
  pointer-events: auto;
}

.laf-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 200px));
  overflow: auto;
  margin-bottom: 2px;
  padding: 10px;
  background: linear-gradient(180deg, #0c1628 0%, #08101c 100%);
  border: 1px solid rgba(201, 163, 90, 0.28);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.laf-picker[hidden] {
  display: none;
}

.laf__hit {
  position: relative;
  width: var(--laf-size);
  height: var(--laf-size);
  display: grid;
  place-items: center;
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  font: inherit;
  color: inherit;
}

.laf__hit:focus-visible {
  outline: 2px solid var(--laf-gold);
  outline-offset: 4px;
}

/* spinning spark orbit */
.laf__ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 300deg,
    rgba(201, 163, 90, 0.15) 320deg,
    var(--laf-gold-hi) 340deg,
    #fff6d6 350deg,
    transparent 360deg
  );
  animation: laf-spin 3.2s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}

.laf__spark {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--laf-gold-hi) 45%, transparent 72%);
  box-shadow:
    0 0 8px 2px rgba(255, 230, 160, 0.95),
    0 0 18px 6px rgba(201, 163, 90, 0.55);
}

.laf__avatar {
  position: relative;
  width: calc(var(--laf-size) - 10px);
  height: calc(var(--laf-size) - 10px);
  border-radius: 50%;
  overflow: hidden;
  background: #050b16;
  box-shadow:
    0 0 0 2px rgba(201, 163, 90, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.45);
  animation: laf-blink 2.4s ease-in-out infinite;
  z-index: 1;
}

.laf__video,
.laf__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.06);
}

.laf__initial {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font: 700 28px/1 Manrope, system-ui, sans-serif;
  color: #f5e6c8;
  background: #001640;
}

.laf__live {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 700 9px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ecfff4;
  background: rgba(16, 140, 72, 0.95);
  padding: 4px 8px 4px 7px;
  border-radius: 999px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 0 0 0 rgba(46, 200, 110, 0.55);
  animation: laf-online-glow 2s ease-in-out infinite;
}

.laf__live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b8ffd0;
  box-shadow: 0 0 6px 2px rgba(120, 255, 170, 0.85);
  animation: laf-online-dot 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes laf-online-glow {
  0%,
  100% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.35),
      0 0 0 0 rgba(46, 200, 110, 0.35);
  }
  50% {
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.4),
      0 0 14px 3px rgba(46, 200, 110, 0.55);
  }
}

@keyframes laf-online-dot {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.laf__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f3e2b5 0%, var(--laf-gold) 100%);
  color: var(--laf-navy);
  font: 700 13px/1 Manrope, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.laf__cta:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.28) inset;
}

.laf__cta:active {
  transform: translateY(0);
}

/* Ask page: lift above sticky composer */
.mobot-page .laf {
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px));
}

.mobot-page.is-chatting .laf {
  --laf-size: 72px;
  bottom: max(108px, calc(env(safe-area-inset-bottom) + 96px));
}

@keyframes laf-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes laf-blink {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(201, 163, 90, 0.45),
      0 10px 28px rgba(0, 0, 0, 0.45),
      0 0 0 0 rgba(201, 163, 90, 0);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(232, 201, 122, 0.95),
      0 10px 28px rgba(0, 0, 0, 0.45),
      0 0 22px 6px rgba(201, 163, 90, 0.55);
  }
}

@media (max-width: 480px) {
  .laf {
    --laf-size: 76px;
  }
  .laf__cta {
    font-size: 12px;
    min-height: 34px;
    padding: 0 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .laf__ring,
  .laf__avatar,
  .laf__live,
  .laf__live::before {
    animation: none !important;
  }
  .laf__ring {
    background: linear-gradient(90deg, transparent, var(--laf-gold), transparent);
    opacity: 0.7;
  }
}

/* —— Conversation drawer —— */
body.laf-drawer-open {
  overflow: hidden;
}

body.laf-drawer-open .laf__cta {
  display: none;
}

.laf-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: right;
  direction: ltr;
}

.laf-drawer[hidden] {
  display: none !important;
}

.laf-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.55);
  backdrop-filter: blur(2px);
}

.laf-drawer__panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  height: min(640px, calc(100dvh - 24px));
  margin: 12px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0c1628 0%, #08101c 100%);
  border: 1px solid rgba(201, 163, 90, 0.28);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.laf-drawer__head {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.laf-drawer__avatar {
  width: 52px !important;
  height: 52px !important;
  animation: none !important;
}

.laf-drawer__avatar .laf__live {
  font-size: 8px;
  bottom: 4px;
  padding: 2px 5px;
}

.laf-drawer__title {
  margin: 0;
  font: 700 16px/1.2 Manrope, system-ui, sans-serif;
  color: #f5f7fb;
}

.laf-drawer__sub {
  margin: 4px 0 0;
  font: 500 12px/1.35 Manrope, system-ui, sans-serif;
  color: rgba(220, 228, 240, 0.7);
}

.laf-drawer__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.laf-drawer__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.laf-drawer__head-text {
  cursor: pointer;
}

.laf-roster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 248px;
  overflow: auto;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.laf-roster[hidden] {
  display: none;
}

.laf-roster__row {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px;
  min-height: 44px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.laf-roster__row.is-active {
  box-shadow: inset 0 0 0 1px #c9a35a;
}

.laf-roster__row.is-busy {
  opacity: 0.92;
}

.laf-roster__photo {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #001640;
}

.laf-roster__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.laf-roster__ini {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font: 700 12px/1 Manrope, system-ui, sans-serif;
  color: #f5e6c8;
}

.laf-roster__dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ec86e;
  box-shadow: 0 0 0 2px #0c1628;
}

.laf-roster__dot.is-busy,
.laf-face.is-busy .laf-face__dot {
  background: #d4a017;
}

.laf-roster__name {
  display: block;
  font: 700 12.5px/1.2 Manrope, system-ui, sans-serif;
  color: #f5f7fb;
}

.laf-roster__line {
  display: block;
  margin-top: 2px;
  font: 500 11px/1.3 Manrope, system-ui, sans-serif;
  color: rgba(220, 228, 240, 0.7);
}

.laf-roster__row.is-busy .laf-roster__line {
  color: #e8c97a;
}

.laf-drawer.is-sabri-desk .laf-roster {
  display: none;
}

.laf-faces {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.laf-faces[hidden] {
  display: none;
}

.laf-face {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  font: inherit;
  color: inherit;
}

.laf-face__photo {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #001640;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.laf-face.is-active .laf-face__photo {
  box-shadow: 0 0 0 2px #c9a35a;
}

.laf-face__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.laf-face__ini {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font: 700 12px/1 Manrope, system-ui, sans-serif;
  color: #f5e6c8;
}

.laf-face__dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ec86e;
  box-shadow: 0 0 0 2px #0c1628;
}

.laf-face__lang {
  font: 700 9px/1 Manrope, system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: rgba(220, 228, 240, 0.72);
}

.laf-face.is-active .laf-face__lang {
  color: #e8c97a;
}

.laf-drawer.is-sabri-desk .laf-faces {
  display: none;
}

.laf-drawer__thread {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.laf-drawer__msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font: 500 13.5px/1.45 Manrope, system-ui, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.laf-drawer__msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: #e8eef8;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.laf-drawer__msg--user {
  align-self: flex-end;
  background: rgba(201, 163, 90, 0.2);
  color: #fff8e8;
  border: 1px solid rgba(201, 163, 90, 0.35);
}

.laf-drawer__msg--typing {
  max-width: fit-content;
  width: auto;
  padding: 8px 10px;
}

.laf-typing {
  display: inline-flex;
  gap: 4px;
}

.laf-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(201, 163, 90, 0.9);
  animation: laf-dot 1s ease-in-out infinite;
}

.laf-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.laf-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes laf-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.laf-drawer.is-sabri-desk .laf-drawer__title {
  color: #f0d9a0;
}

.laf-drawer__img {
  display: block;
  width: 100%;
  max-width: 220px;
  border-radius: 10px;
  cursor: zoom-in;
}

.laf-drawer__form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.laf-drawer__form.is-locked {
  opacity: 0.55;
  pointer-events: none;
}

.laf-drawer.is-sabri-desk .laf-drawer__form {
  grid-template-columns: auto 1fr auto;
}

.laf-drawer__attach {
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  color: #f0d9a0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.laf-drawer__attach[hidden] {
  display: none;
}

.laf-drawer__mic {
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  color: #f0d9a0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.laf-drawer__mic[hidden] {
  display: none;
}

.laf-drawer__mic.is-recording {
  border-color: rgba(201, 163, 90, 0.85);
  color: #c9a35a;
  box-shadow: 0 0 0 2px rgba(201, 163, 90, 0.28);
}

.laf-drawer__mic.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.laf-drawer__input {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 0 12px;
  font: 500 14px/1 Manrope, system-ui, sans-serif;
}

.laf-drawer__input:focus {
  outline: 2px solid rgba(201, 163, 90, 0.55);
  outline-offset: 1px;
}

.laf-drawer__send {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--laf-gold);
  color: var(--laf-navy);
  font: 700 13px/1 Manrope, system-ui, sans-serif;
  cursor: pointer;
}

.laf-drawer__foot {
  padding: 0 12px 14px;
}

.laf-drawer__escalate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(201, 163, 90, 0.45);
  background: rgba(201, 163, 90, 0.1);
  color: #f0d9a0;
  font: 700 13px/1 Manrope, system-ui, sans-serif;
  text-decoration: none;
}

.laf-drawer__escalate:hover {
  background: rgba(201, 163, 90, 0.18);
}

.asst-rating {
  align-self: flex-start;
  margin: 4px 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 163, 90, 0.35);
  border-radius: 10px;
  background: rgba(11, 31, 58, 0.55);
  max-width: 280px;
}

.asst-rating__label,
.asst-rating__done {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-primary, #e8eef8);
}

.asst-rating__done {
  margin: 0;
}

.asst-rating__stars {
  display: flex;
  gap: 4px;
}

.asst-rating__star {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: rgba(201, 163, 90, 0.45);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.asst-rating__star:hover,
.asst-rating__star:focus-visible {
  color: var(--laf-gold, #c9a35a);
}

@media (max-width: 520px) {
  .laf-drawer {
    align-items: stretch;
    justify-content: stretch;
  }
  .laf-drawer__panel {
    width: 100%;
    height: min(92dvh, 720px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}
