/* Minimal customizable floating widget */
:root {
  /* Match requested color exactly (#7BC56F / rgb(123,197,111)) */
  --mcw-color: #82BF31;
  --mcw-size-w: 50px;
  --mcw-size-h: 153px;
  --mcw-radius: 16px;
  --mcw-panel-width: 260px;
  --mcw-z: 2147483000;
}

.mcw {
  position: fixed;
  right: 0;
  bottom: 20px;
  z-index: var(--mcw-z);
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  border-radius: 16px 0 0 16px;
}



/* Collapsed button */
.mcw__toggle {
  position: relative;
  width: auto;
  min-width: var(--mcw-size-w);
  height: var(--mcw-size-h);
  border: 0;
  outline: none;
  background: var(--mcw-color);
  color: #fff;
  border-radius: var(--mcw-radius) 0 0 var(--mcw-radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  padding: 0;
  transition: height .3s ease;
}
.mcw__toggle::after {
  content: attr(data-label);
  pointer-events: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .3px;
  transition: opacity .2s ease;
}
.mcw.is-open .mcw__toggle::after { opacity: 0; }
.mcw.is-open .mcw__toggle { height: 175px; } /* was 222px earlier, adjusted per latest changes */

/* Inline icons layout inside the same rectangle */
.mcw__inline {
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.mcw.is-open .mcw__inline { opacity: 1; pointer-events: auto; }

/* Staggered appearance for items */
.mcw__inline > * {
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transition: opacity .18s ease, transform .25s ease;
}
.mcw.is-open .mcw__inline > * { opacity: 1; transform: none; }
.mcw.is-open .mcw__inline > *:nth-child(1) { transition-delay: .05s; }
.mcw.is-open .mcw__inline > *:nth-child(2) { transition-delay: .10s; }
.mcw.is-open .mcw__inline > *:nth-child(3) { transition-delay: .15s; }
.mcw.is-open .mcw__inline > *:nth-child(4) { transition-delay: .20s; }

/* Panel (not used in compact mode, kept for future) */
.mcw__panel {
  position: absolute;
  inset: 0 auto 0 -var(--mcw-panel-width);
  width: var(--mcw-panel-width);
  background: var(--mcw-color);
  border-radius: var(--mcw-radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform .3s ease;
  pointer-events: none;
}
.mcw.is-open .mcw__panel {
  transform: translateX(0);
  pointer-events: auto;
}

.mcw__row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mcw__item,
.mcw__chat,
.mcw__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: background .2s ease, transform .2s ease;
}
.mcw__item:hover,
.mcw__chat:hover,
.mcw__close:hover { background: rgba(255,255,255,.28); transform: translateY(-1px); }

/* Simple icon placeholders; replace with background-image if needed */
.mcw__item[data-icon]::before,
.mcw__chat::before,
.mcw__close::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  background-color: #fff;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 22px 22px;
  mask-size: 22px 22px;
}

@keyframes mcw-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Loading indicator for chat button */
.mcw__chat.is-loading::before { opacity: 0; }
.mcw__chat.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: mcw-spin .9s linear infinite;
}
.mcw__item[data-icon="vk"]::before { -webkit-mask-image: url('/assets/libs/site-widget/icons/mcw_vk.svg'); mask-image: url('/assets/libs/site-widget/icons/mcw_vk.svg'); }
.mcw__item[data-icon="tg"]::before { -webkit-mask-image: url('/assets/libs/site-widget/icons/mcw_tg.svg'); mask-image: url('/assets/libs/site-widget/icons/mcw_tg.svg'); }
.mcw__item[data-icon="wa"]::before { -webkit-mask-image: url('/assets/libs/site-widget/icons/mcw_tg.svg'); mask-image: url('/assets/libs/site-widget/icons/mcw_tg.svg'); } /* заменить при необходимости */
.mcw__chat::before { -webkit-mask-image: url('/assets/libs/site-widget/icons/mcw_chat.svg'); mask-image: url('/assets/libs/site-widget/icons/mcw_chat.svg'); }
.mcw__close::before { -webkit-mask-image: url('/assets/libs/site-widget/icons/mcw_close.svg'); mask-image: url('/assets/libs/site-widget/icons/mcw_close.svg'); width:20px; height:20px; -webkit-mask-size:20px 20px; mask-size:20px 20px; }

/* Mobile safe area */
@supports (padding: max(0px)) {
  .mcw { right: max(0px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* Mobile: pin bottom-center */
@media (max-width: 767px) {
  .mcw {
    left: 50%;
    right: auto;
    transform: translate(-50%, 50%) rotate(90deg);
    transform-origin: center center;
    bottom: 0;
  }
  .mcw__item[data-icon]::before,
  .mcw__chat::before,
  .mcw__close::before {
    transform: rotate(-90deg);
  }

  @supports (padding: max(0px)) {
    .mcw { bottom: calc(20px + env(safe-area-inset-bottom)); }
  }
}

/* Enforce clean solid color and remove any possible visual modifiers (on the button only) */
.mcw__toggle {
  background-color: var(--mcw-color) !important;
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  overflow: hidden; /* hide any inner overflow to avoid artifacts */
}

/* Ensure inner round buttons don't tint the background */
.mcw__item,
.mcw__chat,
.mcw__close {
  background: transparent !important;
}
