/* MoggyDay support widget — matches site cyan/navy tokens */

.support-fab {
  --support-acc: #15ccf1;
  --support-acc-2: #0ea8c9;
  --support-lime: #85cf0e;
  --support-bg: #02091a;
  --support-panel: #091733;
  --support-panel-2: #0c1f3d;
  --support-txt: #e8f3fb;
  --support-muted: #8aa3bd;
  --support-line: rgba(21, 204, 241, 0.22);
  position: fixed;
  right: max(1.1rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 9000;
  height: 3.35rem;
  min-width: 3.35rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #02091a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s;
}
.support-fab-glow {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(21, 204, 241, 0.55), transparent 68%);
  opacity: 0.85;
  animation: support-fab-pulse 2.4s ease-out infinite;
  pointer-events: none;
  z-index: 0;
}
.support-fab-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 3.35rem;
  padding: 0 1.05rem 0 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(145deg, #3de0ff 0%, #15ccf1 42%, #0b9fbc 100%);
  box-shadow:
    0 0 0 1px rgba(21, 204, 241, 0.35),
    0 8px 24px rgba(21, 204, 241, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #021018;
  font: 700 0.92rem/1 system-ui, "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  animation: support-fab-float 3.6s ease-in-out infinite;
}
.support-fab-inner::after {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.55) 48%,
    rgba(255, 255, 255, 0.15) 52%,
    transparent 65%
  );
  transform: translateX(-55%) rotate(8deg);
  animation: support-fab-shine 3.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.support-fab-inner > * { position: relative; z-index: 1; }
.support-fab svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}
.support-fab-label { pointer-events: none; }
.support-fab-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #8aa3bd;
  box-shadow: 0 0 0 2px rgba(2, 16, 24, 0.35);
  flex-shrink: 0;
  transition: background 0.25s, box-shadow 0.25s;
}
.support-fab.is-checking .support-fab-dot {
  background: #f0c14a;
  box-shadow: 0 0 0 2px rgba(2, 16, 24, 0.35), 0 0 8px rgba(240, 193, 74, 0.7);
  animation: support-dot-blink 1s ease-in-out infinite;
}
.support-fab.is-online .support-fab-dot {
  background: #85cf0e;
  box-shadow: 0 0 0 2px rgba(2, 16, 24, 0.35), 0 0 10px rgba(133, 207, 14, 0.9);
  animation: support-dot-pulse 1.6s ease-out infinite;
}
.support-fab.is-offline .support-fab-dot {
  background: #ff5f6e;
  box-shadow: 0 0 0 2px rgba(2, 16, 24, 0.35), 0 0 8px rgba(255, 95, 110, 0.65);
  animation: none;
}
.support-fab.is-offline .support-fab-inner {
  filter: saturate(0.55) brightness(0.92);
  animation: none;
}
.support-fab.is-offline .support-fab-inner::after { animation: none; opacity: 0; }
.support-fab.is-offline .support-fab-glow { animation: none; opacity: 0.25; }
.support-fab .support-ico-x { display: none; }
.support-fab.is-open .support-ico-chat { display: none; }
.support-fab.is-open .support-ico-x { display: block; }
.support-fab.is-open .support-fab-label { display: none; }
.support-fab.is-open .support-fab-dot { display: none; }
.support-fab.is-open .support-fab-glow { animation: none; opacity: 0.35; }
.support-fab.is-open .support-fab-inner {
  width: 3.35rem;
  padding: 0;
  background: linear-gradient(145deg, #0ea8c9, #087a90);
  color: #e8f3fb;
  animation: none;
}
.support-fab.is-open .support-fab-inner::after { display: none; }
.support-fab:hover {
  transform: translateY(-3px) scale(1.03);
  filter: drop-shadow(0 14px 28px rgba(21, 204, 241, 0.35));
}
.support-fab:hover .support-fab-inner {
  filter: brightness(1.06);
}
.support-fab:active { transform: scale(0.97); }
.support-fab:focus-visible {
  outline: 2px solid #15ccf1;
  outline-offset: 4px;
}

@keyframes support-fab-pulse {
  0% { transform: scale(0.92); opacity: 0.75; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(0.92); opacity: 0; }
}
@keyframes support-fab-shine {
  0%, 28% { transform: translateX(-55%) rotate(8deg); opacity: 0; }
  38% { opacity: 1; }
  55% { transform: translateX(55%) rotate(8deg); opacity: 0.85; }
  70%, 100% { transform: translateX(70%) rotate(8deg); opacity: 0; }
}
@keyframes support-fab-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes support-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(133, 207, 14, 0.7), 0 0 0 2px rgba(2, 16, 24, 0.35); }
  70% { box-shadow: 0 0 0 7px rgba(133, 207, 14, 0), 0 0 0 2px rgba(2, 16, 24, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(133, 207, 14, 0), 0 0 0 2px rgba(2, 16, 24, 0.35); }
}
@keyframes support-dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.support-avatar.is-offline .support-pulse { background: #ff5f6e; }

.support-panel {
  --support-acc: #15ccf1;
  --support-bg: #02091a;
  --support-panel: #091733;
  --support-panel-2: #0c1f3d;
  --support-txt: #e8f3fb;
  --support-muted: #8aa3bd;
  --support-line: rgba(21, 204, 241, 0.18);
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(4.9rem + env(safe-area-inset-bottom, 0px));
  width: min(22.5rem, calc(100vw - 1.75rem));
  height: min(32rem, 72vh);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  border-radius: 1.1rem;
  border: 1px solid var(--support-line);
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(21, 204, 241, 0.12), transparent 55%),
    linear-gradient(165deg, #0c1f3d 0%, #02091a 55%);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  overflow: hidden;
  transform-origin: 100% 100%;
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.32s;
}
.support-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.support-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(2, 9, 26, 0.45);
  backdrop-filter: blur(8px);
}
.support-avatar {
  position: relative;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.65rem;
  background: linear-gradient(140deg, #15ccf1, #85cf0e);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(21, 204, 241, 0.25);
}
.support-avatar img {
  width: 1.45rem;
  height: 1.45rem;
  object-fit: contain;
  border-radius: 0.25rem;
}
.support-pulse {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: #85cf0e;
  border: 2px solid #02091a;
  box-shadow: 0 0 0 0 rgba(133, 207, 14, 0.55);
  animation: support-online 2s ease-out infinite;
}
@keyframes support-online {
  0% { box-shadow: 0 0 0 0 rgba(133, 207, 14, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(133, 207, 14, 0); }
  100% { box-shadow: 0 0 0 0 rgba(133, 207, 14, 0); }
}
.support-ident { flex: 1; min-width: 0; }
.support-ident b {
  display: block;
  color: var(--support-txt);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.support-ident small {
  display: block;
  color: var(--support-muted);
  font-size: 0.72rem;
  margin-top: 0.12rem;
}
.support-close {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--support-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.support-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--support-txt);
  border-color: rgba(255, 255, 255, 0.08);
}
.support-close svg { width: 1rem; height: 1rem; }

.support-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  font-size: 0.875rem;
  scroll-behavior: smooth;
}
.support-log::-webkit-scrollbar { width: 6px; }
.support-log::-webkit-scrollbar-thumb {
  background: rgba(21, 204, 241, 0.25);
  border-radius: 999px;
}

.support-msg {
  padding: 0.6rem 0.8rem;
  border-radius: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 92%;
  animation: support-msg-in 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes support-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.support-msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, rgba(21, 204, 241, 0.28), rgba(14, 168, 201, 0.18));
  border: 1px solid rgba(21, 204, 241, 0.28);
  color: var(--support-txt);
  border-bottom-right-radius: 0.3rem;
}
.support-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--support-txt);
  border-bottom-left-radius: 0.3rem;
}
.support-msg.bot a {
  color: #7ddcf5;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.support-msg.typing {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.75rem 1rem;
  min-width: 3.2rem;
}
.support-msg.typing i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--support-acc);
  opacity: 0.45;
  animation: support-dot 1.2s ease-in-out infinite;
}
.support-msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.support-msg.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes support-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.support-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.55rem;
}
.support-chip {
  border: 1px solid rgba(21, 204, 241, 0.28);
  background: rgba(21, 204, 241, 0.06);
  color: #b8e9f7;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.15s, border-color 0.15s, color 0.15s;
}
.support-chip:hover {
  transform: translateY(-1px);
  background: rgba(21, 204, 241, 0.14);
  border-color: rgba(21, 204, 241, 0.55);
  color: #e8f3fb;
}
.support-chips[hidden] { display: none !important; }

.support-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.support-preview[hidden] { display: none !important; }
.support-preview img {
  width: 3.4rem;
  height: 3.4rem;
  object-fit: cover;
  border-radius: 0.55rem;
  border: 1px solid rgba(21, 204, 241, 0.35);
}
.support-preview-clear {
  width: 1.7rem;
  height: 1.7rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #8aa3bd;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.support-preview-clear svg { width: 0.85rem; height: 0.85rem; }
.support-msg-shot {
  display: block;
  max-width: min(100%, 11rem);
  max-height: 8rem;
  border-radius: 0.55rem;
  margin-bottom: 0.4rem;
  border: 1px solid rgba(21, 204, 241, 0.25);
  object-fit: cover;
}
.support-msg.bot strong { color: #15ccf1; font-weight: 700; }
.support-attach {
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
  border-radius: 0.85rem;
  border: 1px solid rgba(21, 204, 241, 0.28);
  background: rgba(21, 204, 241, 0.08);
  color: #15ccf1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.support-attach svg { width: 1.1rem; height: 1.1rem; }
.support-attach:hover:not(:disabled) {
  border-color: rgba(21, 204, 241, 0.65);
  background: rgba(21, 204, 241, 0.16);
}
.support-attach:disabled { opacity: 0.45; cursor: wait; }

.support-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(2, 9, 26, 0.55);
  align-items: flex-end;
}
.support-form textarea {
  flex: 1;
  resize: none;
  min-height: 2.45rem;
  max-height: 6rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a1528;
  color: var(--support-txt);
  padding: 0.55rem 0.7rem;
  font: inherit;
  line-height: 1.35;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.support-form textarea::placeholder { color: #6d8299; }
.support-form textarea:focus {
  outline: none;
  border-color: rgba(21, 204, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(21, 204, 241, 0.12);
}
.support-send {
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
  border-radius: 0.85rem;
  border: none;
  background: linear-gradient(145deg, #15ccf1, #0ea8c9);
  color: #02091a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
  box-shadow: 0 6px 16px rgba(21, 204, 241, 0.28);
}
.support-send svg { width: 1.05rem; height: 1.05rem; }
.support-send:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.support-send:disabled {
  opacity: 0.45;
  cursor: wait;
  box-shadow: none;
}

@media (max-width: 640px) {
  /* Above mobile bottom nav (~80px) — keep pill readable */
  .support-fab {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: calc(5.1rem + env(safe-area-inset-bottom, 0px));
  }
  .support-fab-inner {
    height: 3.1rem;
    padding: 0 0.95rem 0 0.8rem;
    font-size: 0.88rem;
  }
  .support-fab.is-open .support-fab-inner {
    width: 3.1rem;
    height: 3.1rem;
  }
  .support-panel {
    bottom: calc(8.7rem + env(safe-area-inset-bottom, 0px));
    right: 0.65rem;
    left: 0.65rem;
    width: auto;
    height: min(70vh, 30rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-fab,
  .support-fab-glow,
  .support-fab-inner,
  .support-fab-inner::after,
  .support-fab-dot,
  .support-pulse,
  .support-msg.typing i {
    animation: none !important;
  }
  .support-panel,
  .support-msg,
  .support-fab,
  .support-chip,
  .support-send {
    transition: none !important;
    animation: none !important;
  }
}
