/* ShamGate — floating Telegram support */
.sg-support {
  --sg-sup-size: 58px;
  --sg-sup-gap: max(16px, env(safe-area-inset-bottom, 0px));
  --sg-sup-side: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  position: fixed;
  z-index: 9990;
  inset-inline-start: var(--sg-sup-side);
  bottom: var(--sg-sup-gap);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font, 'IBM Plex Sans Arabic', system-ui, sans-serif);
  pointer-events: none;
}

.sg-support * {
  box-sizing: border-box;
}

.sg-support__panel {
  pointer-events: auto;
  width: min(292px, calc(100vw - 32px));
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--stroke, #e8e5e0) 85%, transparent);
  background: color-mix(in srgb, var(--panel, #fff) 94%, transparent);
  color: var(--text, #1a1a1a);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, .14),
    0 2px 8px rgba(0, 0, 0, .06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform-origin: bottom left;
  transform: translateY(10px) scale(.96);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity .22s ease,
    transform .22s ease,
    visibility .22s;
}

html[dir="rtl"] .sg-support__panel,
[dir="rtl"] .sg-support__panel {
  transform-origin: bottom right;
}

.sg-support.is-open .sg-support__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

html[data-theme="dark"] .sg-support__panel {
  background: color-mix(in srgb, var(--panel, rgba(18,26,38,.94)) 92%, transparent);
  border-color: color-mix(in srgb, var(--stroke, rgba(125,211,180,.14)) 100%, transparent);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, .45),
    0 0 0 1px rgba(61, 255, 181, .05);
}

.sg-support__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sg-support__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, #2AABEE 0%, #229ED9 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(34, 158, 217, .35);
}

.sg-support__avatar svg {
  width: 22px;
  height: 22px;
  display: block;
}

.sg-support__meta {
  min-width: 0;
  flex: 1;
}

.sg-support__title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text, #1a1a1a);
}

.sg-support__sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted, #888);
  direction: ltr;
  unicode-bidi: isolate;
}

.sg-support__close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted, #888);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sg-support__close:hover {
  background: color-mix(in srgb, var(--surface, #f7f5f1) 100%, transparent);
  color: var(--text, #1a1a1a);
}

.sg-support__body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--lead, var(--muted, #5c574f));
  margin: 0 0 12px;
}

.sg-support__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  text-decoration: none;
  font: 650 13px var(--font, 'IBM Plex Sans Arabic', system-ui, sans-serif);
  color: #fff;
  background: linear-gradient(145deg, #2AABEE 0%, #1f8fc4 100%);
  box-shadow: 0 10px 22px rgba(34, 158, 217, .28);
  transition: filter .18s ease, transform .18s ease;
}

.sg-support__cta:hover {
  filter: brightness(1.05);
}

.sg-support__cta:active {
  transform: translateY(1px);
}

.sg-support__cta svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sg-support__fab {
  pointer-events: auto;
  position: relative;
  width: var(--sg-sup-size);
  height: var(--sg-sup-size);
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #2AABEE 0%, #1f8fc4 100%);
  box-shadow:
    0 14px 30px rgba(34, 158, 217, .38),
    0 2px 8px rgba(0, 0, 0, .12);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.sg-support__fab:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.04);
}

.sg-support__fab:active {
  transform: translateY(0) scale(.98);
}

.sg-support__fab:focus-visible {
  outline: 3px solid color-mix(in srgb, #2AABEE 55%, transparent);
  outline-offset: 3px;
}

.sg-support__fab svg {
  width: 28px;
  height: 28px;
  display: block;
  position: relative;
  z-index: 1;
}

.sg-support__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(42, 171, 238, .45);
  animation: sgSupportPulse 2.4s ease-out infinite;
  pointer-events: none;
}

.sg-support.is-open .sg-support__pulse {
  animation: none;
  opacity: 0;
}

.sg-support__badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  z-index: 2;
  min-width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid color-mix(in srgb, var(--bg, #fff) 80%, #fff);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .18);
}

.sg-support__hint {
  pointer-events: none;
  position: absolute;
  bottom: calc(100% + 10px);
  inset-inline-start: 0;
  white-space: nowrap;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #1a1a1a);
  background: color-mix(in srgb, var(--panel, #fff) 94%, transparent);
  border: 1px solid var(--stroke, #e8e5e0);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}

.sg-support:not(.is-open) .sg-support__fab:hover .sg-support__hint,
.sg-support:not(.is-open) .sg-support__fab:focus-visible .sg-support__hint {
  opacity: 1;
  transform: translateY(0);
}

@keyframes sgSupportPulse {
  0% {
    transform: scale(1);
    opacity: .55;
  }
  70% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .sg-support {
    --sg-sup-size: 54px;
    --sg-sup-gap: max(14px, env(safe-area-inset-bottom, 0px));
    --sg-sup-side: max(14px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  }

  .sg-support__hint {
    display: none;
  }

  .sg-support__panel {
    width: min(280px, calc(100vw - 28px));
  }
}

@media (max-width: 380px) {
  .sg-support {
    --sg-sup-size: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-support__pulse {
    animation: none !important;
    opacity: 0 !important;
  }

  .sg-support__panel,
  .sg-support__fab,
  .sg-support__hint,
  .sg-support__cta {
    transition: none !important;
  }
}
