/**
 * YooAI Messicon — стили витрины
 */
.ymi-widget {
  --ymi-size: 56px;
  --ymi-item: 48px;
  --ymi-gap: 10px;
  --ymi-z: 99990;
  --ymi-main: #4A90E2;
  --ymi-top: 20px;
  --ymi-right: 20px;
  --ymi-bottom: 20px;
  --ymi-left: 20px;
  position: fixed;
  z-index: var(--ymi-z);
  display: flex;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  pointer-events: none;
}

.ymi-widget * {
  box-sizing: border-box;
}

.ymi-widget .ymi-main,
.ymi-widget .ymi-item {
  pointer-events: auto;
}

/* Позиции */
.ymi-pos-bottom-right {
  right: var(--ymi-right);
  bottom: var(--ymi-bottom);
}

.ymi-pos-bottom-left {
  left: var(--ymi-left);
  bottom: var(--ymi-bottom);
}

.ymi-pos-top-right {
  right: var(--ymi-right);
  top: var(--ymi-top);
}

.ymi-pos-top-left {
  left: var(--ymi-left);
  top: var(--ymi-top);
}

/* Направление панели */
.ymi-expand-up,
.ymi-expand-down {
  flex-direction: column;
}

.ymi-expand-left,
.ymi-expand-right {
  flex-direction: row;
}

.ymi-expand-up {
  flex-direction: column-reverse;
}

.ymi-expand-left {
  flex-direction: row-reverse;
}

.ymi-panel {
  display: flex;
  align-items: center;
  gap: var(--ymi-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ymi-expand-up .ymi-panel,
.ymi-expand-down .ymi-panel {
  flex-direction: column;
}

.ymi-expand-up .ymi-panel {
  flex-direction: column-reverse;
  margin-bottom: var(--ymi-gap);
}

.ymi-expand-down .ymi-panel {
  margin-top: var(--ymi-gap);
}

.ymi-expand-left .ymi-panel,
.ymi-expand-right .ymi-panel {
  flex-direction: row;
}

.ymi-expand-left .ymi-panel {
  flex-direction: row-reverse;
  margin-right: var(--ymi-gap);
}

.ymi-expand-right .ymi-panel {
  margin-left: var(--ymi-gap);
}

.ymi-panel[hidden] {
  display: none !important;
}

/* Главная кнопка */
.ymi-main {
  position: relative;
  width: var(--ymi-size);
  height: var(--ymi-size);
  border: 0;
  border-radius: 50%;
  background: var(--ymi-main);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.ymi-main:hover,
.ymi-main:focus {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: #fff;
  text-decoration: none;
}

.ymi-main-icon {
  display: flex;
  width: 55%;
  height: 55%;
  align-items: center;
  justify-content: center;
}

.ymi-main-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ymi-icon-close {
  display: none;
}

.ymi-widget.is-open .ymi-icon-open {
  display: none;
}

.ymi-widget.is-open .ymi-icon-close {
  display: flex;
}

/* Пульсация */
.ymi-pulse:not(.is-open) .ymi-main::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ymi-main);
  opacity: 0.45;
  animation: ymi-pulse 2s ease-out infinite;
  z-index: -1;
}

@keyframes ymi-pulse {
  0% {
    transform: scale(1);
    opacity: 0.45;
  }
  70% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

/* Иконки мессенджеров */
.ymi-item {
  position: relative;
  width: var(--ymi-item);
  height: var(--ymi-item);
  border-radius: 50%;
  background: var(--ymi-brand, #888);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transform: scale(0.4);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease, box-shadow .2s ease;
}

.ymi-widget.is-open .ymi-item {
  transform: scale(1);
  opacity: 1;
}

.ymi-widget.is-open .ymi-item:nth-child(1) { transition-delay: .02s; }
.ymi-widget.is-open .ymi-item:nth-child(2) { transition-delay: .05s; }
.ymi-widget.is-open .ymi-item:nth-child(3) { transition-delay: .08s; }
.ymi-widget.is-open .ymi-item:nth-child(4) { transition-delay: .11s; }
.ymi-widget.is-open .ymi-item:nth-child(5) { transition-delay: .14s; }
.ymi-widget.is-open .ymi-item:nth-child(6) { transition-delay: .17s; }

.ymi-item:hover,
.ymi-item:focus {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  color: #fff;
  text-decoration: none;
}

.ymi-item-icon {
  display: flex;
  width: 54%;
  height: 54%;
  align-items: center;
  justify-content: center;
}

.ymi-item-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Instagram — фирменный градиент */
.ymi-item.ymi-instagram,
.ymi-main.ymi-instagram {
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}

/* MAX — фирменный градиент */
.ymi-item.ymi-max,
.ymi-main.ymi-max {
  background: linear-gradient(135deg, #471AFF 0%, #9500FF 100%);
}

/* Подсказки */
.ymi-tip {
  position: absolute;
  white-space: nowrap;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  padding: 5px 9px;
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 2;
}

.ymi-tooltips .ymi-item:hover .ymi-tip,
.ymi-tooltips .ymi-main:hover .ymi-tip {
  opacity: 1;
  visibility: visible;
}

.ymi-pos-bottom-right .ymi-tip,
.ymi-pos-top-right .ymi-tip {
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
}

.ymi-pos-bottom-left .ymi-tip,
.ymi-pos-top-left .ymi-tip {
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 767px) {
  .ymi-hide-mobile {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ymi-pulse:not(.is-open) .ymi-main::before {
    animation: none;
  }
  .ymi-item,
  .ymi-main {
    transition: none;
  }
}
