/* 1. ГЛАВНЫЙ КОНТЕЙНЕР */
#mcw-root {
    position: fixed !important;
    bottom: var(--mcw-pos-bottom, 20px) !important;
    right: var(--mcw-pos-right, 20px) !important;
    z-index: 9999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    pointer-events: none !important;
    
    line-height: 1 !important;
    font-family: sans-serif !important;
    box-sizing: border-box !important;
    text-align: center !important;
    will-change: transform !important;
}

#mcw-root * {
    box-sizing: border-box !important;
}

#mcw-root.mcw-hidden {
    display: none !important;
}

/* 2. ГЛАВНАЯ КНОПКА */
#mcw-root .mcw-trigger {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: none !important;
    outline: none !important;
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #0066ff, #0044cc) !important;
    
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    cursor: pointer !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4) !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    touch-action: manipulation !important;
    will-change: transform, box-shadow !important;
}

#mcw-root .mcw-trigger:active {
    transform: scale(0.9) !important;
}

/* 3. ИКОНКИ */
#mcw-root .mcw-icons {
    width: 28px !important;
    height: 28px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#mcw-root .mcw-icons svg {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    fill: white !important;
    color: white !important;
    transition: all 0.3s ease !important;
}

/* Состояния иконок */
#mcw-root .mcw-icon-open { opacity: 1; transform: rotate(0) scale(1); }
#mcw-root .mcw-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.5); }

#mcw-root.is-open .mcw-trigger {
    background: #333333 !important; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3) !important;
    animation: none !important;
}

#mcw-root.is-open .mcw-icon-open { opacity: 0 !important; transform: rotate(90deg) scale(0.5) !important; }
#mcw-root.is-open .mcw-icon-close { opacity: 1 !important; transform: rotate(0) scale(1) !important; }

/* 4. МЕНЮ */
#mcw-root .mcw-menu {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 5px !important;
    padding: 0 !important;
    list-style: none !important;
}

/* 5. МАЛЕНЬКИЕ КНОПКИ */
#mcw-root .mcw-item {
    text-decoration: none !important;
    border: none !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    pointer-events: auto !important;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    touch-action: manipulation !important;
}

#mcw-root .mcw-item svg {
    width: 24px !important;
    height: 24px !important;
    fill: white !important;
}

#mcw-root.is-open .mcw-item {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

#mcw-root.is-open .mcw-item:nth-last-child(1) { transition-delay: 0.05s !important; }
#mcw-root.is-open .mcw-item:nth-last-child(2) { transition-delay: 0.1s !important; }
#mcw-root.is-open .mcw-item:nth-last-child(3) { transition-delay: 0.15s !important; }

/* Цвета брендов */
#mcw-root .mcw-tg { background: linear-gradient(135deg, #2AABEE, #229ED9) !important; }
#mcw-root .mcw-in { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important; }
#mcw-root .mcw-ph { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }

/* ПУЛЬСАЦИЯ (автоматическая) */
@keyframes mcw-pulse {
    0%   { 
        box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.75); 
        transform: scale(1);
    }
    40%  { 
        box-shadow: 0 0 0 20px rgba(0, 102, 255, 0.45); 
        transform: scale(1.10);
    }
    60%  { 
        box-shadow: 0 0 0 30px rgba(0, 102, 255, 0.25); 
        transform: scale(1.07);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); 
        transform: scale(1);
    }
}

#mcw-root:not(.is-open) .mcw-trigger {
    animation: mcw-pulse 3s ease-in-out infinite !important;
}

/* МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 768px) {
    #mcw-root {
        bottom: 105px !important;
        right: 18px !important;
    }
    
    #mcw-root .mcw-trigger {
        width: 50px !important;
        height: 50px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25) !important;
    }
    
    #mcw-root .mcw-item {
        width: 46px !important;
        height: 46px !important;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
    }
    
    #mcw-root .mcw-icons svg {
        width: 25px !important;
        height: 25px !important;
    }
    
    #mcw-root .mcw-menu {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }
    
    @keyframes mcw-pulse {
        0%   { 
            box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.6); 
            transform: scale(1);
        }
        70%  { 
            box-shadow: 0 0 0 18px rgba(0, 102, 255, 0); 
            transform: scale(1.05);
        }
        100% { 
            box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); 
            transform: scale(1);
        }
    }
}