.agl-chat { position: fixed; right: 24px; bottom: 24px; z-index: 9999; font-family: inherit; }
.agl-chat [hidden] { display: none !important; }

.agl-chat__fab {
  position: relative; width: 60px; height: 60px; border-radius: 50%;
  border: 0; background: #2c9e56; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); transition: transform .15s;
}
.agl-chat__fab:hover { transform: scale(1.06); }

.agl-chat__badge {
  position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 11px; background: #e53935; color: #fff; font-size: 12px; line-height: 22px; text-align: center;
}

.agl-chat__panel {
  width: 360px; max-width: calc(100vw - 32px); height: 480px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}

.agl-chat__head {
  background: #1c5531; color: #fff; padding: 14px 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.agl-chat__close { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }

.agl-chat__body {
  flex: 1; overflow-y: auto; padding: 14px; background: #f4f6f5;
  display: flex; flex-direction: column; gap: 8px;
}
.agl-chat__msg {
  max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.agl-chat__msg--in  { align-self: flex-start; background: #fff; color: #191817; border-bottom-left-radius: 4px; }
.agl-chat__msg--out { align-self: flex-end; background: #2c9e56; color: #fff; border-bottom-right-radius: 4px; }

.agl-chat__error { background: #fdecea; color: #b71c1c; font-size: 13px; padding: 8px 14px; }

.agl-chat__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e5e5; background: #fff; }
.agl-chat__input {
  flex: 1; min-width: 0; border: 1px solid #d6d6d6; border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
.agl-chat__input:focus { border-color: #2c9e56; }
.agl-chat__send {
  border: 0; border-radius: 10px; padding: 0 16px; background: #2c9e56; color: #fff; font-size: 14px; cursor: pointer;
}
.agl-chat__send:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
  .agl-chat { right: 16px; bottom: 16px; }
  .agl-chat__panel { width: calc(100vw - 32px); height: calc(100vh - 32px); }
}

/* AGL-TEASER: salom-matn (teaser) va qimirlash (wiggle) */
.agl-chat__teaser {
  position: absolute; right: calc(100% + 14px); bottom: 6px;
  width: max-content; max-width: min(240px, calc(100vw - 130px));
  background: #fff; color: #191817; border-radius: 14px 14px 4px 14px;
  padding: 12px 32px 12px 14px; font-size: 14px; line-height: 1.4; text-align: left;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22); cursor: pointer;
  animation: aglTeaserIn .35s ease-out both;
}
.agl-chat__teaser::after {
  content: ""; position: absolute; right: -6px; bottom: 16px; width: 14px; height: 14px;
  background: #fff; transform: rotate(45deg); border-radius: 0 3px 0 0;
  box-shadow: 4px 4px 8px rgba(0, 0, 0, .06);
}
.agl-chat__teaser-t { display: block; position: relative; z-index: 1; }
.agl-chat__teaser-x {
  position: absolute; top: 5px; right: 7px; z-index: 2;
  width: auto; min-height: 0; margin: 0; padding: 2px 5px;
  background: none; border: 0; box-shadow: none; color: #8a8a8a;
  font-size: 18px; line-height: 1; cursor: pointer; text-transform: none;
}
.agl-chat__teaser-x:hover { color: #191817; }
@keyframes aglTeaserIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.agl-chat__fab--wiggle { animation: aglWiggle 1s ease-in-out; }
@keyframes aglWiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  10% { transform: rotate(-14deg) scale(1.08); }
  25% { transform: rotate(12deg) scale(1.08); }
  40% { transform: rotate(-9deg) scale(1.05); }
  55% { transform: rotate(6deg) scale(1.03); }
  70% { transform: rotate(-3deg); }
  85% { transform: rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) {
  .agl-chat__fab--wiggle, .agl-chat__teaser { animation: none; }
}
