/* Мультисвязь — виджет на витрине */

.qc-widget {
    position: fixed;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    box-sizing: border-box;
    line-height: 1.2;
}

.qc-widget *,
.qc-widget *::before,
.qc-widget *::after {
    box-sizing: border-box;
}

.qc-widget.qc-pos-left {
    align-items: flex-start;
}

/* Обёртка кнопки-триггера */
.qc-trigger-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: none;
    position: relative;
}

.qc-widget.qc-pos-left .qc-trigger-wrap {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* CTA-текст рядом с кнопкой */
.qc-cta-text {
    pointer-events: none;
    background: #fff;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    padding: 7px 13px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    white-space: nowrap;
    animation: qcCtaFadeIn .35s ease both;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes qcCtaFadeIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.qc-widget.qc-pos-left .qc-cta-text {
    animation-name: qcCtaFadeInLeft;
}

@keyframes qcCtaFadeInLeft {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Tooltip при наведении на кнопку (CSS only) */
.qc-trigger[aria-label]:not([aria-label=""]):hover::after,
.qc-trigger[aria-label]:not([aria-label=""]):focus-visible::after {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(30,30,30,.88);
    color: #fff;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qc-widget.qc-pos-left .qc-trigger[aria-label]:not([aria-label=""]):hover::after,
.qc-widget.qc-pos-left .qc-trigger[aria-label]:not([aria-label=""]):focus-visible::after {
    right: auto;
    left: 0;
}

/* Пульс-анимация (запускается JS, 3 раза, один раз за визит) */
@keyframes qcPulse {
    0%   { box-shadow: 0 4px 16px rgba(0,0,0,.22), 0 0 0 0 rgba(22,119,255,.5); }
    70%  { box-shadow: 0 4px 16px rgba(0,0,0,.22), 0 0 0 14px rgba(22,119,255,0); }
    100% { box-shadow: 0 4px 16px rgba(0,0,0,.22), 0 0 0 0 rgba(22,119,255,0); }
}

.qc-trigger.qc-pulse {
    animation: qcPulse 1s ease 3;
}

/* Скрыт до истечения задержки show_delay */
.qc-widget.qc-hidden-delay {
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.qc-widget.qc-hidden-delay.qc-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Кнопка-триггер */
.qc-trigger {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background-color: #1677ff;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
    transition: transform .2s ease, box-shadow .2s ease;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    outline-offset: 3px;
    font: inherit;
    line-height: 1;
    text-decoration: none;
    position: relative;
}

.qc-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 22px rgba(0,0,0,.28);
}

.qc-trigger:focus-visible {
    outline: 2px solid currentColor;
}

.qc-trigger svg {
    width: 50%;
    height: 50%;
    fill: currentColor;
    transition: opacity .15s ease, transform .15s ease;
}

.qc-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(.6);
}

.qc-widget.qc-open .qc-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(.6);
}

.qc-widget.qc-open .qc-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Список каналов */
.qc-items {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease;
}

.qc-widget.qc-pos-left .qc-items {
    align-items: flex-start;
}

.qc-widget.qc-open .qc-items {
    opacity: 1;
    transform: translateY(0);
}

/* ---------------------------------------------------------------
   Режим веера — каналы раскрываются по дуге вокруг кнопки
   --------------------------------------------------------------- */

/* Контейнер: в режиме веера hidden не ставится (Renderer не добавляет его).
   Сбрасываем базовые opacity/transform от .qc-items и .qc-widget.qc-open .qc-items */
.qc-widget.qc-mode-fan .qc-items,
.qc-widget.qc-mode-fan.qc-open .qc-items {
    position: absolute;
    bottom: 0;
    right: 0;
    display: block;
    margin-bottom: 0;
    width: 0;
    height: 0;
    opacity: 1;
    transform: none;
    pointer-events: none;
    overflow: visible;
}

.qc-widget.qc-mode-fan.qc-pos-left .qc-items {
    right: auto;
    left: 0;
}

/* Каждый item: позиционируем абсолютно, в закрытом — схлопнут в точке кнопки */
.qc-widget.qc-mode-fan .qc-item {
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translate(0, 0) scale(0.3);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.2s ease;
}

.qc-widget.qc-mode-fan.qc-pos-left .qc-item {
    right: auto;
    left: 0;
}

/* Раскрытое состояние — координаты задаёт JS через CSS-переменные */
.qc-widget.qc-mode-fan.qc-open .qc-item {
    transform: translate(var(--qc-fan-x, 0px), var(--qc-fan-y, 0px)) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Ссылка: всегда круглая в режиме веера — перебиваем все базовые стили */
.qc-widget.qc-mode-fan .qc-item-link,
.qc-widget.qc-mode-fan.qc-with-labels .qc-item-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    padding: 0 !important;
    gap: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    white-space: nowrap;
    position: relative;
    box-sizing: border-box !important;
}

/* Tooltip с названием при наведении */
.qc-widget.qc-mode-fan .qc-item-label {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20,20,20,.85);
    color: #fff;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
}

.qc-widget.qc-mode-fan.qc-pos-left .qc-item-label {
    right: auto;
    left: calc(100% + 8px);
}

.qc-widget.qc-mode-fan .qc-item-link:hover .qc-item-label,
.qc-widget.qc-mode-fan .qc-item-link:focus-visible .qc-item-label {
    opacity: 1;
}

/* Hover в вееере — масштаб, не сдвиг */
.qc-widget.qc-mode-fan .qc-item-link:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

/* Режим плашки */
.qc-mode-bar .qc-items {
    flex-direction: row;
    gap: 8px;
    margin-bottom: 8px;
}

/* Элемент списка */
.qc-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border-radius: 24px;
    padding: 8px 14px 8px 10px;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    transition: transform .15s ease, box-shadow .15s ease;
    outline-offset: 2px;
    line-height: 1.2;
}

.qc-item-link:hover {
    transform: translateX(-3px);
    box-shadow: 0 4px 14px rgba(0,0,0,.24);
}

.qc-widget.qc-pos-left .qc-item-link:hover {
    transform: translateX(3px);
}

.qc-with-labels:not(.qc-mode-bar) .qc-items {
    align-items: stretch;
}

.qc-with-labels:not(.qc-mode-bar) .qc-item {
    display: flex;
}

.qc-with-labels:not(.qc-mode-bar) .qc-item-link {
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}

.qc-item-link:focus-visible {
    outline: 2px solid currentColor;
}

.qc-item-link svg {
    width: var(--qc-item-icon-size, 24px);
    height: var(--qc-item-icon-size, 24px);
    fill: currentColor;
    flex-shrink: 0;
}

.qc-icons-only .qc-items {
    gap: 12px;
}

.qc-icons-only .qc-item-link {
    box-sizing: border-box;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    gap: 0;
}

.qc-icons-only .qc-item-link:hover,
.qc-icons-only.qc-pos-left .qc-item-link:hover {
    transform: scale(1.08);
}

.qc-icons-only .qc-item-link svg {
    width: var(--qc-item-icon-size, 24px);
    height: var(--qc-item-icon-size, 24px);
}

/* Режим плашки — компактные кнопки без подписей */
.qc-mode-bar .qc-item-link {
    border-radius: 50%;
    padding: 10px;
}

.qc-mode-bar .qc-item-label {
    display: none;
}

.qc-icons-only.qc-mode-bar .qc-item-link {
    padding: 0;
}

/* Мобильные */
@media (max-width: 768px) {
    .qc-trigger {
        width: 48px !important;
        height: 48px !important;
    }

    .qc-item-link {
        font-size: 13px;
        padding: 7px 12px 7px 8px;
    }

    .qc-item-link svg { width: var(--qc-item-icon-size, 20px); height: var(--qc-item-icon-size, 20px); }

    .qc-icons-only .qc-item-link { padding: 0; }

    .qc-cta-text { display: none; }
}

/* Скрыть на мобильных (≤ 768px — тот же breakpoint что и мобильные стили) */
@media (max-width: 768px) {
    .qc-widget.qc-hide-mobile { display: none !important; }
}

/* Скрыть на десктопе (> 768px) */
@media (min-width: 769px) {
    .qc-widget.qc-hide-desktop { display: none !important; }
}
